KHTML
dom_xml.cpp
Go to the documentation of this file.00001 00024 #include "dom/dom_xml.h" 00025 #include "dom/dom_exception.h" 00026 #include "xml/dom_textimpl.h" 00027 #include "xml/dom_xmlimpl.h" 00028 00029 using namespace DOM; 00030 00031 CDATASection::CDATASection() 00032 { 00033 } 00034 00035 CDATASection::CDATASection(const CDATASection &) : Text() 00036 { 00037 } 00038 00039 CDATASection &CDATASection::operator = (const Node &other) 00040 { 00041 NodeImpl* ohandle = other.handle(); 00042 if ( impl != ohandle ) { 00043 if (!ohandle || ohandle->nodeType() != CDATA_SECTION_NODE) { 00044 if ( impl ) impl->deref(); 00045 impl = 0; 00046 } else { 00047 Node::operator =(other); 00048 } 00049 } 00050 return *this; 00051 } 00052 00053 CDATASection &CDATASection::operator = (const CDATASection &other) 00054 { 00055 Node::operator =(other); 00056 return *this; 00057 } 00058 00059 CDATASection::~CDATASection() 00060 { 00061 } 00062 00063 CDATASection::CDATASection(CDATASectionImpl *i) : Text(i) 00064 { 00065 } 00066 00067 // ---------------------------------------------------------------------------- 00068 Entity::Entity() 00069 { 00070 } 00071 00072 Entity::Entity(const Entity &) : Node() 00073 { 00074 } 00075 00076 Entity &Entity::operator = (const Node &other) 00077 { 00078 NodeImpl* ohandle = other.handle(); 00079 if ( impl != ohandle ) { 00080 if (!ohandle || ohandle->nodeType() != ENTITY_NODE) { 00081 if ( impl ) impl->deref(); 00082 impl = 0; 00083 } else { 00084 Node::operator =(other); 00085 } 00086 } 00087 return *this; 00088 } 00089 00090 Entity &Entity::operator = (const Entity &other) 00091 { 00092 Node::operator =(other); 00093 return *this; 00094 } 00095 00096 Entity::~Entity() 00097 { 00098 } 00099 00100 DOMString Entity::publicId() const 00101 { 00102 if (!impl) 00103 return DOMString(); // ### enable throw DOMException(DOMException::NOT_FOUND_ERR); 00104 00105 return ((EntityImpl*)impl)->publicId(); 00106 } 00107 00108 DOMString Entity::systemId() const 00109 { 00110 if (!impl) 00111 return DOMString(); // ### enable throw DOMException(DOMException::NOT_FOUND_ERR); 00112 00113 return ((EntityImpl*)impl)->systemId(); 00114 } 00115 00116 DOMString Entity::notationName() const 00117 { 00118 if (!impl) 00119 return DOMString(); // ### enable throw DOMException(DOMException::NOT_FOUND_ERR); 00120 00121 return ((EntityImpl*)impl)->notationName(); 00122 } 00123 00124 Entity::Entity(EntityImpl *i) : Node(i) 00125 { 00126 } 00127 00128 // ---------------------------------------------------------------------------- 00129 00130 EntityReference::EntityReference() 00131 { 00132 } 00133 00134 EntityReference::EntityReference(const EntityReference &) : Node() 00135 { 00136 } 00137 00138 EntityReference &EntityReference::operator = (const Node &other) 00139 { 00140 NodeImpl* ohandle = other.handle(); 00141 if ( impl != ohandle ) { 00142 if (!ohandle || ohandle->nodeType() != ENTITY_REFERENCE_NODE) { 00143 if ( impl ) impl->deref(); 00144 impl = 0; 00145 } else { 00146 Node::operator =(other); 00147 } 00148 } 00149 return *this; 00150 } 00151 00152 EntityReference &EntityReference::operator = (const EntityReference &other) 00153 { 00154 Node::operator =(other); 00155 return *this; 00156 } 00157 00158 EntityReference::~EntityReference() 00159 { 00160 } 00161 00162 EntityReference::EntityReference(EntityReferenceImpl *i) : Node(i) 00163 { 00164 } 00165 00166 // ---------------------------------------------------------------------------- 00167 00168 Notation::Notation() 00169 { 00170 } 00171 00172 Notation::Notation(const Notation &) : Node() 00173 { 00174 } 00175 00176 Notation &Notation::operator = (const Node &other) 00177 { 00178 NodeImpl* ohandle = other.handle(); 00179 if ( impl != ohandle ) { 00180 if (!ohandle || ohandle->nodeType() != NOTATION_NODE) { 00181 if ( impl ) impl->deref(); 00182 impl = 0; 00183 } else { 00184 Node::operator =(other); 00185 } 00186 } 00187 return *this; 00188 } 00189 00190 Notation &Notation::operator = (const Notation &other) 00191 { 00192 Node::operator =(other); 00193 return *this; 00194 } 00195 00196 Notation::~Notation() 00197 { 00198 } 00199 00200 DOMString Notation::publicId() const 00201 { 00202 if (!impl) 00203 return DOMString(); // ### enable throw DOMException(DOMException::NOT_FOUND_ERR); 00204 00205 return ((NotationImpl*)impl)->publicId(); 00206 } 00207 00208 DOMString Notation::systemId() const 00209 { 00210 if (!impl) 00211 return DOMString(); // ### enable throw DOMException(DOMException::NOT_FOUND_ERR); 00212 00213 return ((NotationImpl*)impl)->systemId(); 00214 } 00215 00216 Notation::Notation(NotationImpl *i) : Node(i) 00217 { 00218 } 00219 00220 00221 // ---------------------------------------------------------------------------- 00222 00223 ProcessingInstruction::ProcessingInstruction() 00224 { 00225 } 00226 00227 ProcessingInstruction::ProcessingInstruction(const ProcessingInstruction &) 00228 : Node() 00229 { 00230 } 00231 00232 ProcessingInstruction &ProcessingInstruction::operator = (const Node &other) 00233 { 00234 NodeImpl* ohandle = other.handle(); 00235 if ( impl != ohandle ) { 00236 if (!ohandle || ohandle->nodeType() != PROCESSING_INSTRUCTION_NODE) { 00237 if ( impl ) impl->deref(); 00238 impl = 0; 00239 } else { 00240 Node::operator =(other); 00241 } 00242 } 00243 return *this; 00244 } 00245 00246 ProcessingInstruction &ProcessingInstruction::operator = (const ProcessingInstruction &other) 00247 { 00248 Node::operator =(other); 00249 return *this; 00250 } 00251 00252 ProcessingInstruction::~ProcessingInstruction() 00253 { 00254 } 00255 00256 DOMString ProcessingInstruction::target() const 00257 { 00258 if (!impl) 00259 return DOMString(); // ### enable throw DOMException(DOMException::NOT_FOUND_ERR); 00260 00261 return ((ProcessingInstructionImpl*)impl)->target(); 00262 } 00263 00264 DOMString ProcessingInstruction::data() const 00265 { 00266 if (!impl) 00267 return DOMString(); // ### enable throw DOMException(DOMException::NOT_FOUND_ERR); 00268 00269 return ((ProcessingInstructionImpl*)impl)->data(); 00270 } 00271 00272 void ProcessingInstruction::setData( const DOMString &_data ) 00273 { 00274 if (!impl) 00275 return; // ### enable throw DOMException(DOMException::NOT_FOUND_ERR); 00276 00277 int exceptioncode = 0; 00278 ((ProcessingInstructionImpl*)impl)->setData(_data, exceptioncode); 00279 if (exceptioncode) 00280 throw DOMException(exceptioncode); 00281 } 00282 00283 ProcessingInstruction::ProcessingInstruction(ProcessingInstructionImpl *i) : Node(i) 00284 { 00285 } 00286 00287 StyleSheet ProcessingInstruction::sheet() const 00288 { 00289 if (impl) return ((ProcessingInstructionImpl*)impl)->sheet(); 00290 return 0; 00291 } 00292 00293