|
||||
File indexing completed on 2025-01-18 10:14:50
0001 /* 0002 * Licensed to the Apache Software Foundation (ASF) under one or more 0003 * contributor license agreements. See the NOTICE file distributed with 0004 * this work for additional information regarding copyright ownership. 0005 * The ASF licenses this file to You under the Apache License, Version 2.0 0006 * (the "License"); you may not use this file except in compliance with 0007 * the License. You may obtain a copy of the License at 0008 * 0009 * http://www.apache.org/licenses/LICENSE-2.0 0010 * 0011 * Unless required by applicable law or agreed to in writing, software 0012 * distributed under the License is distributed on an "AS IS" BASIS, 0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0014 * See the License for the specific language governing permissions and 0015 * limitations under the License. 0016 */ 0017 0018 /* 0019 * $Id$ 0020 */ 0021 0022 #if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENT_HPP) 0023 #define XERCESC_INCLUDE_GUARD_DOMDOCUMENT_HPP 0024 0025 #include <xercesc/util/XercesDefs.hpp> 0026 #include <xercesc/dom/DOMNode.hpp> 0027 #include <xercesc/dom/DOMDocumentRange.hpp> 0028 #include <xercesc/dom/DOMDocumentTraversal.hpp> 0029 #include <xercesc/dom/DOMXPathEvaluator.hpp> 0030 0031 XERCES_CPP_NAMESPACE_BEGIN 0032 0033 class DOMConfiguration; 0034 class DOMDocumentType; 0035 class DOMElement; 0036 class DOMDocumentFragment; 0037 class DOMComment; 0038 class DOMCDATASection; 0039 class DOMProcessingInstruction; 0040 class DOMAttr; 0041 class DOMEntity; 0042 class DOMEntityReference; 0043 class DOMImplementation; 0044 class DOMNodeFilter; 0045 class DOMNodeList; 0046 class DOMNotation; 0047 class DOMText; 0048 class DOMNode; 0049 0050 0051 /** 0052 * The <code>DOMDocument</code> interface represents the entire XML 0053 * document. Conceptually, it is the root of the document tree, and provides 0054 * the primary access to the document's data. 0055 * <p>Since elements, text nodes, comments, processing instructions, etc. 0056 * cannot exist outside the context of a <code>DOMDocument</code>, the 0057 * <code>DOMDocument</code> interface also contains the factory methods needed 0058 * to create these objects. The <code>DOMNode</code> objects created have a 0059 * <code>ownerDocument</code> attribute which associates them with the 0060 * <code>DOMDocument</code> within whose context they were created. 0061 * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>. 0062 */ 0063 0064 class CDOM_EXPORT DOMDocument: public DOMDocumentRange, 0065 public DOMXPathEvaluator, 0066 public DOMDocumentTraversal, 0067 public DOMNode { 0068 0069 0070 protected: 0071 // ----------------------------------------------------------------------- 0072 // Hidden constructors 0073 // ----------------------------------------------------------------------- 0074 /** @name Hidden constructors */ 0075 //@{ 0076 DOMDocument() {}; 0077 //@} 0078 0079 private: 0080 // ----------------------------------------------------------------------- 0081 // Unimplemented constructors and operators 0082 // ----------------------------------------------------------------------- 0083 /** @name Unimplemented constructors and operators */ 0084 //@{ 0085 DOMDocument(const DOMDocument &); 0086 DOMDocument & operator = (const DOMDocument &); 0087 //@} 0088 0089 public: 0090 // ----------------------------------------------------------------------- 0091 // All constructors are hidden, just the destructor is available 0092 // ----------------------------------------------------------------------- 0093 /** @name Destructor */ 0094 //@{ 0095 /** 0096 * Destructor 0097 * 0098 */ 0099 virtual ~DOMDocument() {}; 0100 //@} 0101 0102 // ----------------------------------------------------------------------- 0103 // Virtual DOMDocument interface 0104 // ----------------------------------------------------------------------- 0105 /** @name Functions introduced in DOM Level 1 */ 0106 //@{ 0107 /** 0108 * Creates an element of the type specified. Note that the instance 0109 * returned implements the <code>DOMElement</code> interface, so attributes 0110 * can be specified directly on the returned object. 0111 * <br>In addition, if there are known attributes with default values, 0112 * <code>DOMAttr</code> nodes representing them are automatically created 0113 * and attached to the element. 0114 * <br>To create an element with a qualified name and namespace URI, use 0115 * the <code>createElementNS</code> method. 0116 * @param tagName The name of the element type to instantiate. For XML, 0117 * this is case-sensitive. 0118 * @return A new <code>DOMElement</code> object with the 0119 * <code>nodeName</code> attribute set to <code>tagName</code>, and 0120 * <code>localName</code>, <code>prefix</code>, and 0121 * <code>namespaceURI</code> set to <code>null</code>. 0122 * @exception DOMException 0123 * INVALID_CHARACTER_ERR: Raised if the specified name contains an 0124 * illegal character. 0125 * @since DOM Level 1 0126 */ 0127 virtual DOMElement *createElement(const XMLCh *tagName) = 0; 0128 0129 /** 0130 * Creates an empty <code>DOMDocumentFragment</code> object. 0131 * @return A new <code>DOMDocumentFragment</code>. 0132 * @since DOM Level 1 0133 */ 0134 virtual DOMDocumentFragment *createDocumentFragment() = 0; 0135 0136 /** 0137 * Creates a <code>DOMText</code> node given the specified string. 0138 * @param data The data for the node. 0139 * @return The new <code>DOMText</code> object. 0140 * @since DOM Level 1 0141 */ 0142 virtual DOMText *createTextNode(const XMLCh *data) = 0; 0143 0144 /** 0145 * Creates a <code>DOMComment</code> node given the specified string. 0146 * @param data The data for the node. 0147 * @return The new <code>DOMComment</code> object. 0148 * @since DOM Level 1 0149 */ 0150 virtual DOMComment *createComment(const XMLCh *data) = 0; 0151 0152 /** 0153 * Creates a <code>DOMCDATASection</code> node whose value is the specified 0154 * string. 0155 * @param data The data for the <code>DOMCDATASection</code> contents. 0156 * @return The new <code>DOMCDATASection</code> object. 0157 * @since DOM Level 1 0158 */ 0159 virtual DOMCDATASection *createCDATASection(const XMLCh *data) = 0; 0160 0161 /** 0162 * Creates a <code>DOMProcessingInstruction</code> node given the specified 0163 * name and data strings. 0164 * @param target The target part of the processing instruction. 0165 * @param data The data for the node. 0166 * @return The new <code>DOMProcessingInstruction</code> object. 0167 * @exception DOMException 0168 * INVALID_CHARACTER_ERR: Raised if the specified target contains an 0169 * illegal character. 0170 * @since DOM Level 1 0171 */ 0172 virtual DOMProcessingInstruction *createProcessingInstruction(const XMLCh *target, 0173 const XMLCh *data) = 0; 0174 0175 0176 /** 0177 * Creates an <code>DOMAttr</code> of the given name. Note that the 0178 * <code>DOMAttr</code> instance can then be set on an <code>DOMElement</code> 0179 * using the <code>setAttributeNode</code> method. 0180 * <br>To create an attribute with a qualified name and namespace URI, use 0181 * the <code>createAttributeNS</code> method. 0182 * @param name The name of the attribute. 0183 * @return A new <code>DOMAttr</code> object with the <code>nodeName</code> 0184 * attribute set to <code>name</code>, and <code>localName</code>, 0185 * <code>prefix</code>, and <code>namespaceURI</code> set to 0186 * <code>null</code>. The value of the attribute is the empty string. 0187 * @exception DOMException 0188 * INVALID_CHARACTER_ERR: Raised if the specified name contains an 0189 * illegal character. 0190 * @since DOM Level 1 0191 */ 0192 virtual DOMAttr *createAttribute(const XMLCh *name) = 0; 0193 0194 0195 /** 0196 * Creates an <code>DOMEntityReference</code> object. In addition, if the 0197 * referenced entity is known, the child list of the 0198 * <code>DOMEntityReference</code> node is made the same as that of the 0199 * corresponding <code>DOMEntity</code> node.If any descendant of the 0200 * <code>DOMEntity</code> node has an unbound namespace prefix, the 0201 * corresponding descendant of the created <code>DOMEntityReference</code> 0202 * node is also unbound; (its <code>namespaceURI</code> is 0203 * <code>null</code>). The DOM Level 2 does not support any mechanism to 0204 * resolve namespace prefixes. 0205 * @param name The name of the entity to reference. 0206 * @return The new <code>DOMEntityReference</code> object. 0207 * @exception DOMException 0208 * INVALID_CHARACTER_ERR: Raised if the specified name contains an 0209 * illegal character. 0210 * @since DOM Level 1 0211 */ 0212 virtual DOMEntityReference *createEntityReference(const XMLCh *name) = 0; 0213 0214 /** 0215 * The Document Type Declaration (see <code>DOMDocumentType</code>) 0216 * associated with this document. For XML 0217 * documents without a document type declaration this returns 0218 * <code>null</code>. The DOM Level 2 does not support editing the 0219 * Document Type Declaration. <code>docType</code> cannot be altered in 0220 * any way, including through the use of methods inherited from the 0221 * <code>DOMNode</code> interface, such as <code>insertNode</code> or 0222 * <code>removeNode</code>. 0223 * @since DOM Level 1 0224 */ 0225 virtual DOMDocumentType *getDoctype() const = 0; 0226 0227 /** 0228 * The <code>DOMImplementation</code> object that handles this document. A 0229 * DOM application may use objects from multiple implementations. 0230 * @since DOM Level 1 0231 */ 0232 virtual DOMImplementation *getImplementation() const = 0; 0233 0234 /** 0235 * This is a convenience attribute that allows direct access to the child 0236 * node that is the root element of the document. 0237 * @since DOM Level 1 0238 */ 0239 virtual DOMElement *getDocumentElement() const = 0; 0240 0241 /** 0242 * Returns a <code>DOMNodeList</code> of all the <code>DOMElement(s)</code> with a 0243 * given tag name in the order in which they are encountered in a 0244 * preorder traversal of the <code>DOMDocument</code> tree. 0245 * 0246 * The returned node list is "live", in that changes 0247 * to the document tree made after a nodelist was initially 0248 * returned will be immediately reflected in the node list. 0249 * @param tagname The name of the tag to match on. The special value "*" 0250 * matches all tags. 0251 * @return A new <code>DOMNodeList</code> object containing all the matched 0252 * <code>DOMElement(s)</code>. 0253 * @since DOM Level 1 0254 */ 0255 virtual DOMNodeList *getElementsByTagName(const XMLCh *tagname) const = 0; 0256 0257 //@} 0258 0259 /** @name Functions introduced in DOM Level 2. */ 0260 //@{ 0261 0262 /** 0263 * Imports a node from another document to this document. The returned 0264 * node has no parent; (<code>parentNode</code> is <code>null</code>). 0265 * The source node is not altered or removed from the original document; 0266 * this method creates a new copy of the source node. 0267 * <br>For all nodes, importing a node creates a node object owned by the 0268 * importing document, with attribute values identical to the source 0269 * node's <code>nodeName</code> and <code>nodeType</code>, plus the 0270 * attributes related to namespaces (<code>prefix</code>, 0271 * <code>localName</code>, and <code>namespaceURI</code>). As in the 0272 * <code>cloneNode</code> operation on a <code>DOMNode</code>, the source 0273 * node is not altered. 0274 * <br>Additional information is copied as appropriate to the 0275 * <code>nodeType</code>, attempting to mirror the behavior expected if 0276 * a fragment of XML source was copied from one document to 0277 * another, recognizing that the two documents may have different DTDs 0278 * in the XML case. The following list describes the specifics for each 0279 * type of node. 0280 * <dl> 0281 * <dt>ATTRIBUTE_NODE</dt> 0282 * <dd>The <code>ownerElement</code> attribute 0283 * is set to <code>null</code> and the <code>specified</code> flag is 0284 * set to <code>true</code> on the generated <code>DOMAttr</code>. The 0285 * descendants of the source <code>DOMAttr</code> are recursively imported 0286 * and the resulting nodes reassembled to form the corresponding subtree. 0287 * Note that the <code>deep</code> parameter has no effect on 0288 * <code>DOMAttr</code> nodes; they always carry their children with them 0289 * when imported.</dd> 0290 * <dt>DOCUMENT_FRAGMENT_NODE</dt> 0291 * <dd>If the <code>deep</code> option 0292 * was set to <code>true</code>, the descendants of the source element 0293 * are recursively imported and the resulting nodes reassembled to form 0294 * the corresponding subtree. Otherwise, this simply generates an empty 0295 * <code>DOMDocumentFragment</code>.</dd> 0296 * <dt>DOCUMENT_NODE</dt> 0297 * <dd><code>DOMDocument</code> 0298 * nodes cannot be imported.</dd> 0299 * <dt>DOCUMENT_TYPE_NODE</dt> 0300 * <dd><code>DOMDocumentType</code> 0301 * nodes cannot be imported.</dd> 0302 * <dt>ELEMENT_NODE</dt> 0303 * <dd>Specified attribute nodes of the 0304 * source element are imported, and the generated <code>DOMAttr</code> 0305 * nodes are attached to the generated <code>DOMElement</code>. Default 0306 * attributes are not copied, though if the document being imported into 0307 * defines default attributes for this element name, those are assigned. 0308 * If the <code>importNode</code> <code>deep</code> parameter was set to 0309 * <code>true</code>, the descendants of the source element are 0310 * recursively imported and the resulting nodes reassembled to form the 0311 * corresponding subtree.</dd> 0312 * <dt>ENTITY_NODE</dt> 0313 * <dd><code>DOMEntity</code> nodes can be 0314 * imported, however in the current release of the DOM the 0315 * <code>DOMDocumentType</code> is readonly. Ability to add these imported 0316 * nodes to a <code>DOMDocumentType</code> will be considered for addition 0317 * to a future release of the DOM.On import, the <code>publicId</code>, 0318 * <code>systemId</code>, and <code>notationName</code> attributes are 0319 * copied. If a <code>deep</code> import is requested, the descendants 0320 * of the the source <code>DOMEntity</code> are recursively imported and 0321 * the resulting nodes reassembled to form the corresponding subtree.</dd> 0322 * <dt> 0323 * ENTITY_REFERENCE_NODE</dt> 0324 * <dd>Only the <code>DOMEntityReference</code> itself is 0325 * copied, even if a <code>deep</code> import is requested, since the 0326 * source and destination documents might have defined the entity 0327 * differently. If the document being imported into provides a 0328 * definition for this entity name, its value is assigned.</dd> 0329 * <dt>NOTATION_NODE</dt> 0330 * <dd> 0331 * <code>DOMNotation</code> nodes can be imported, however in the current 0332 * release of the DOM the <code>DOMDocumentType</code> is readonly. Ability 0333 * to add these imported nodes to a <code>DOMDocumentType</code> will be 0334 * considered for addition to a future release of the DOM.On import, the 0335 * <code>publicId</code> and <code>systemId</code> attributes are copied. 0336 * Note that the <code>deep</code> parameter has no effect on 0337 * <code>DOMNotation</code> nodes since they never have any children.</dd> 0338 * <dt> 0339 * PROCESSING_INSTRUCTION_NODE</dt> 0340 * <dd>The imported node copies its 0341 * <code>target</code> and <code>data</code> values from those of the 0342 * source node.</dd> 0343 * <dt>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE</dt> 0344 * <dd>These three 0345 * types of nodes inheriting from <code>DOMCharacterData</code> copy their 0346 * <code>data</code> and <code>length</code> attributes from those of 0347 * the source node.</dd> 0348 * </dl> 0349 * @param importedNode The node to import. 0350 * @param deep If <code>true</code>, recursively import the subtree under 0351 * the specified node; if <code>false</code>, import only the node 0352 * itself, as explained above. This has no effect on <code>DOMAttr</code> 0353 * , <code>DOMEntityReference</code>, and <code>DOMNotation</code> nodes. 0354 * @return The imported node that belongs to this <code>DOMDocument</code>. 0355 * @exception DOMException 0356 * NOT_SUPPORTED_ERR: Raised if the type of node being imported is not 0357 * supported. 0358 * @since DOM Level 2 0359 */ 0360 virtual DOMNode *importNode(const DOMNode *importedNode, bool deep) = 0; 0361 0362 /** 0363 * Creates an element of the given qualified name and namespace URI. 0364 * @param namespaceURI The namespace URI of the element to create. 0365 * @param qualifiedName The qualified name of the element type to 0366 * instantiate. 0367 * @return A new <code>DOMElement</code> object with the following 0368 * attributes: 0369 * <table border='1'> 0370 * <tr> 0371 * <td valign='top' rowspan='1' colspan='1'><code>Attribute</code></td> 0372 * <td valign='top' rowspan='1' colspan='1'> 0373 * <code>Value</code></td> 0374 * </tr> 0375 * <tr> 0376 * <td valign='top' rowspan='1' colspan='1'><code>DOMNode.nodeName</code></td> 0377 * <td valign='top' rowspan='1' colspan='1'> 0378 * <code>qualifiedName</code></td> 0379 * </tr> 0380 * <tr> 0381 * <td valign='top' rowspan='1' colspan='1'><code>DOMNode.namespaceURI</code></td> 0382 * <td valign='top' rowspan='1' colspan='1'> 0383 * <code>namespaceURI</code></td> 0384 * </tr> 0385 * <tr> 0386 * <td valign='top' rowspan='1' colspan='1'><code>DOMNode.prefix</code></td> 0387 * <td valign='top' rowspan='1' colspan='1'>prefix, extracted 0388 * from <code>qualifiedName</code>, or <code>null</code> if there is 0389 * no prefix</td> 0390 * </tr> 0391 * <tr> 0392 * <td valign='top' rowspan='1' colspan='1'><code>DOMNode.localName</code></td> 0393 * <td valign='top' rowspan='1' colspan='1'>local name, extracted from 0394 * <code>qualifiedName</code></td> 0395 * </tr> 0396 * <tr> 0397 * <td valign='top' rowspan='1' colspan='1'><code>DOMElement.tagName</code></td> 0398 * <td valign='top' rowspan='1' colspan='1'> 0399 * <code>qualifiedName</code></td> 0400 * </tr> 0401 * </table> 0402 * @exception DOMException 0403 * INVALID_CHARACTER_ERR: Raised if the specified qualified name 0404 * contains an illegal character, per the XML 1.0 specification . 0405 * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is 0406 * malformed per the Namespaces in XML specification, if the 0407 * <code>qualifiedName</code> has a prefix and the 0408 * <code>namespaceURI</code> is <code>null</code>, or if the 0409 * <code>qualifiedName</code> has a prefix that is "xml" and the 0410 * <code>namespaceURI</code> is different from " 0411 * http://www.w3.org/XML/1998/namespace" . 0412 * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not 0413 * support the <code>"XML"</code> feature, since namespaces were 0414 * defined by XML. 0415 * @since DOM Level 2 0416 */ 0417 virtual DOMElement *createElementNS(const XMLCh *namespaceURI, 0418 const XMLCh *qualifiedName) = 0; 0419 0420 /** 0421 * Creates an attribute of the given qualified name and namespace URI. 0422 * @param namespaceURI The namespace URI of the attribute to create. 0423 * @param qualifiedName The qualified name of the attribute to 0424 * instantiate. 0425 * @return A new <code>DOMAttr</code> object with the following attributes: 0426 * <table border='1'> 0427 * <tr> 0428 * <td valign='top' rowspan='1' colspan='1'><code>Attribute</code></td> 0429 * <td valign='top' rowspan='1' colspan='1'> 0430 * <code>Value</code></td> 0431 * </tr> 0432 * <tr> 0433 * <td valign='top' rowspan='1' colspan='1'><code>DOMNode.nodeName</code></td> 0434 * <td valign='top' rowspan='1' colspan='1'>qualifiedName</td> 0435 * </tr> 0436 * <tr> 0437 * <td valign='top' rowspan='1' colspan='1'> 0438 * <code>DOMNode.namespaceURI</code></td> 0439 * <td valign='top' rowspan='1' colspan='1'><code>namespaceURI</code></td> 0440 * </tr> 0441 * <tr> 0442 * <td valign='top' rowspan='1' colspan='1'> 0443 * <code>DOMNode.prefix</code></td> 0444 * <td valign='top' rowspan='1' colspan='1'>prefix, extracted from 0445 * <code>qualifiedName</code>, or <code>null</code> if there is no 0446 * prefix</td> 0447 * </tr> 0448 * <tr> 0449 * <td valign='top' rowspan='1' colspan='1'><code>DOMNode.localName</code></td> 0450 * <td valign='top' rowspan='1' colspan='1'>local name, extracted from 0451 * <code>qualifiedName</code></td> 0452 * </tr> 0453 * <tr> 0454 * <td valign='top' rowspan='1' colspan='1'><code>DOMAttr.name</code></td> 0455 * <td valign='top' rowspan='1' colspan='1'> 0456 * <code>qualifiedName</code></td> 0457 * </tr> 0458 * <tr> 0459 * <td valign='top' rowspan='1' colspan='1'><code>DOMNode.nodeValue</code></td> 0460 * <td valign='top' rowspan='1' colspan='1'>the empty 0461 * string</td> 0462 * </tr> 0463 * </table> 0464 * @exception DOMException 0465 * INVALID_CHARACTER_ERR: Raised if the specified qualified name 0466 * contains an illegal character, per the XML 1.0 specification . 0467 * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is 0468 * malformed per the Namespaces in XML specification, if the 0469 * <code>qualifiedName</code> has a prefix and the 0470 * <code>namespaceURI</code> is <code>null</code>, if the 0471 * <code>qualifiedName</code> has a prefix that is "xml" and the 0472 * <code>namespaceURI</code> is different from " 0473 * http://www.w3.org/XML/1998/namespace", or if the 0474 * <code>qualifiedName</code>, or its prefix, is "xmlns" and the 0475 * <code>namespaceURI</code> is different from " 0476 * http://www.w3.org/2000/xmlns/". 0477 * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not 0478 * support the <code>"XML"</code> feature, since namespaces were 0479 * defined by XML. 0480 * @since DOM Level 2 0481 */ 0482 virtual DOMAttr *createAttributeNS(const XMLCh *namespaceURI, 0483 const XMLCh *qualifiedName) = 0; 0484 0485 /** 0486 * Returns a <code>DOMNodeList</code> of all the <code>DOMElement(s)</code> with a 0487 * given local name and namespace URI in the order in which they are 0488 * encountered in a preorder traversal of the <code>DOMDocument</code> tree. 0489 * @param namespaceURI The namespace URI of the elements to match on. The 0490 * special value "*" matches all namespaces. 0491 * @param localName The local name of the elements to match on. The 0492 * special value "*" matches all local names. 0493 * @return A new <code>DOMNodeList</code> object containing all the matched 0494 * <code>DOMElement(s)</code>. 0495 * @since DOM Level 2 0496 */ 0497 virtual DOMNodeList *getElementsByTagNameNS(const XMLCh *namespaceURI, 0498 const XMLCh *localName) const = 0; 0499 0500 /** 0501 * Returns the <code>DOMElement</code> whose <code>ID</code> is given by 0502 * <code>elementId</code>. If no such element exists, returns 0503 * <code>null</code>. Behavior is not defined if more than one element 0504 * has this <code>ID</code>. The DOM implementation must have 0505 * information that says which attributes are of type ID. Attributes 0506 * with the name "ID" are not of type ID unless so defined. 0507 * Implementations that do not know whether attributes are of type ID or 0508 * not are expected to return <code>null</code>. 0509 * @param elementId The unique <code>id</code> value for an element. 0510 * @return The matching element. 0511 * @since DOM Level 2 0512 */ 0513 virtual DOMElement * getElementById(const XMLCh *elementId) const = 0; 0514 //@} 0515 0516 /** @name Functions introduced in DOM Level 3. */ 0517 //@{ 0518 0519 /** 0520 * An attribute specifying the encoding used for this document at the time of the parsing. 0521 * This is <code>null</code> when it is not known, such as when the DOMDocument was created in memory. 0522 * 0523 * @since DOM Level 3 0524 */ 0525 virtual const XMLCh* getInputEncoding() const = 0; 0526 0527 /** 0528 * An attribute specifying, as part of the XML declaration, the encoding of this document. 0529 * This is <code>null</code> when unspecified or when it is not known, such as when the 0530 * DOMDocument was created in memory. 0531 * 0532 * @since DOM Level 3 0533 */ 0534 virtual const XMLCh* getXmlEncoding() const = 0; 0535 0536 /** 0537 * An attribute specifying, as part of the XML declaration, whether this document is standalone. 0538 * This is <code>false</code> when unspecified. 0539 * 0540 * @since DOM Level 3 0541 */ 0542 virtual bool getXmlStandalone() const = 0; 0543 0544 /** 0545 * An attribute specifying, as part of the XML declaration, whether this 0546 * document is standalone. 0547 * <br> This attribute represents the property [standalone] defined in . 0548 * 0549 * @since DOM Level 3 0550 */ 0551 virtual void setXmlStandalone(bool standalone) = 0; 0552 0553 /** 0554 * An attribute specifying, as part of the XML declaration, the version 0555 * number of this document. This is <code>null</code> when unspecified. 0556 * <br> This attribute represents the property [version] defined in . 0557 * 0558 * @since DOM Level 3 0559 */ 0560 virtual const XMLCh* getXmlVersion() const = 0; 0561 0562 /** 0563 * An attribute specifying, as part of the XML declaration, the version 0564 * number of this document. This is <code>null</code> when unspecified. 0565 * <br> This attribute represents the property [version] defined in . 0566 * 0567 * @since DOM Level 3 0568 */ 0569 virtual void setXmlVersion(const XMLCh* version) = 0; 0570 0571 /** 0572 * The location of the document or <code>null</code> if undefined. 0573 * <br>Beware that when the <code>DOMDocument</code> supports the feature 0574 * "HTML" , the href attribute of the HTML BASE element takes precedence 0575 * over this attribute. 0576 * 0577 * @since DOM Level 3 0578 */ 0579 virtual const XMLCh* getDocumentURI() const = 0; 0580 /** 0581 * The location of the document or <code>null</code> if undefined. 0582 * <br>Beware that when the <code>DOMDocument</code> supports the feature 0583 * "HTML" , the href attribute of the HTML BASE element takes precedence 0584 * over this attribute. 0585 * 0586 * @since DOM Level 3 0587 */ 0588 virtual void setDocumentURI(const XMLCh* documentURI) = 0; 0589 0590 /** 0591 * An attribute specifying whether errors checking is enforced or not. 0592 * When set to <code>false</code>, the implementation is free to not 0593 * test every possible error case normally defined on DOM operations, 0594 * and not raise any <code>DOMException</code>. In case of error, the 0595 * behavior is undefined. This attribute is <code>true</code> by 0596 * defaults. 0597 * 0598 * @since DOM Level 3 0599 */ 0600 virtual bool getStrictErrorChecking() const = 0; 0601 /** 0602 * An attribute specifying whether errors checking is enforced or not. 0603 * When set to <code>false</code>, the implementation is free to not 0604 * test every possible error case normally defined on DOM operations, 0605 * and not raise any <code>DOMException</code>. In case of error, the 0606 * behavior is undefined. This attribute is <code>true</code> by 0607 * defaults. 0608 * 0609 * @since DOM Level 3 0610 */ 0611 virtual void setStrictErrorChecking(bool strictErrorChecking) = 0; 0612 0613 /** 0614 * Rename an existing node. When possible this simply changes the name of 0615 * the given node, otherwise this creates a new node with the specified 0616 * name and replaces the existing node with the new node as described 0617 * below. This only applies to nodes of type <code>ELEMENT_NODE</code> 0618 * and <code>ATTRIBUTE_NODE</code>. 0619 * <br>When a new node is created, the following operations are performed: 0620 * the new node is created, any registered event listener is registered 0621 * on the new node, any user data attached to the old node is removed 0622 * from that node, the old node is removed from its parent if it has 0623 * one, the children are moved to the new node, if the renamed node is 0624 * an <code>DOMElement</code> its attributes are moved to the new node, the 0625 * new node is inserted at the position the old node used to have in its 0626 * parent's child nodes list if it has one, the user data that was 0627 * attached to the old node is attach to the new node, the user data 0628 * event <code>NODE_RENAMED</code> is fired. 0629 * <br>When the node being renamed is an <code>DOMAttr</code> that is 0630 * attached to an <code>DOMElement</code>, the node is first removed from 0631 * the <code>DOMElement</code> attributes map. Then, once renamed, either 0632 * by modifying the existing node or creating a new one as described 0633 * above, it is put back. 0634 * 0635 * @param n The node to rename. 0636 * @param namespaceURI The new namespaceURI. 0637 * @param qualifiedName The new qualified name. 0638 * @return The renamed node. This is either the specified node or the new 0639 * node that was created to replace the specified node. 0640 * @exception DOMException 0641 * NOT_SUPPORTED_ERR: Raised when the type of the specified node is 0642 * neither <code>ELEMENT_NODE</code> nor <code>ATTRIBUTE_NODE</code>. 0643 * <br>WRONG_DOCUMENT_ERR: Raised when the specified node was created 0644 * from a different document than this document. 0645 * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is 0646 * malformed per the Namespaces in XML specification, if the 0647 * <code>qualifiedName</code> has a prefix and the 0648 * <code>namespaceURI</code> is <code>null</code>, or if the 0649 * <code>qualifiedName</code> has a prefix that is "xml" and the 0650 * <code>namespaceURI</code> is different from " 0651 * http://www.w3.org/XML/1998/namespace" . Also raised, when the node 0652 * being renamed is an attribute, if the <code>qualifiedName</code>, 0653 * or its prefix, is "xmlns" and the <code>namespaceURI</code> is 0654 * different from "http://www.w3.org/2000/xmlns/". 0655 * @since DOM Level 3 0656 */ 0657 virtual DOMNode* renameNode(DOMNode* n, const XMLCh* namespaceURI, const XMLCh* qualifiedName) = 0; 0658 0659 0660 /** 0661 * Changes the <code>ownerDocument</code> of a node, its children, as well 0662 * as the attached attribute nodes if there are any. If the node has a 0663 * parent it is first removed from its parent child list. This 0664 * effectively allows moving a subtree from one document to another. The 0665 * following list describes the specifics for each type of node. 0666 * 0667 * <dl> 0668 * <dt> 0669 * ATTRIBUTE_NODE</dt> 0670 * <dd>The <code>ownerElement</code> attribute is set to 0671 * <code>null</code> and the <code>specified</code> flag is set to 0672 * <code>true</code> on the adopted <code>DOMAttr</code>. The descendants 0673 * of the source <code>DOMAttr</code> are recursively adopted.</dd> 0674 * <dt> 0675 * DOCUMENT_FRAGMENT_NODE</dt> 0676 * <dd>The descendants of the source node are 0677 * recursively adopted.</dd> 0678 * <dt>DOCUMENT_NODE</dt> 0679 * <dd><code>DOMDocument</code> nodes cannot 0680 * be adopted.</dd> 0681 * <dt>DOCUMENT_TYPE_NODE</dt> 0682 * <dd><code>DOMDocumentType</code> nodes cannot 0683 * be adopted.</dd> 0684 * <dt>ELEMENT_NODE</dt> 0685 * <dd>Specified attribute nodes of the source 0686 * element are adopted, and the generated <code>DOMAttr</code> nodes. 0687 * Default attributes are discarded, though if the document being 0688 * adopted into defines default attributes for this element name, those 0689 * are assigned. The descendants of the source element are recursively 0690 * adopted.</dd> 0691 * <dt>ENTITY_NODE</dt> 0692 * <dd><code>DOMEntity</code> nodes cannot be adopted.</dd> 0693 * <dt> 0694 * ENTITY_REFERENCE_NODE</dt> 0695 * <dd>Only the <code>DOMEntityReference</code> node 0696 * itself is adopted, the descendants are discarded, since the source 0697 * and destination documents might have defined the entity differently. 0698 * If the document being imported into provides a definition for this 0699 * entity name, its value is assigned.</dd> 0700 * <dt>NOTATION_NODE</dt> 0701 * <dd><code>DOMNotation</code> 0702 * nodes cannot be adopted.</dd> 0703 * <dt>PROCESSING_INSTRUCTION_NODE, TEXT_NODE, 0704 * CDATA_SECTION_NODE, COMMENT_NODE</dt> 0705 * <dd>These nodes can all be adopted. No 0706 * specifics.</dd> 0707 * </dl> 0708 * @param source The node to move into this document. 0709 * @return The adopted node, or <code>null</code> if this operation 0710 * fails, such as when the source node comes from a different 0711 * implementation. 0712 * @exception DOMException 0713 * NOT_SUPPORTED_ERR: Raised if the source node is of type 0714 * <code>DOCUMENT</code>, <code>DOCUMENT_TYPE</code>. 0715 * <br>NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is 0716 * readonly. 0717 * @since DOM Level 3 0718 */ 0719 virtual DOMNode* adoptNode(DOMNode* source) = 0; 0720 0721 /** 0722 * This method acts as if the document was going through a save and load 0723 * cycle, putting the document in a "normal" form. The actual result 0724 * depends on the features being set. See <code>DOMConfiguration</code> for 0725 * details. 0726 * 0727 * <br>Noticeably this method normalizes <code>DOMText</code> nodes, makes 0728 * the document "namespace wellformed", according to the algorithm 0729 * described below in pseudo code, by adding missing namespace 0730 * declaration attributes and adding or changing namespace prefixes, 0731 * updates the replacement tree of <code>DOMEntityReference</code> nodes, 0732 * normalizes attribute values, etc. 0733 * <br>Mutation events, when supported, are generated to reflect the 0734 * changes occurring on the document. 0735 * Note that this is a partial implementation. Not all the required features are implemented. 0736 * Currently <code>DOMAttr</code> and <code>DOMText</code> nodes are normalized. 0737 * Features to remove <code>DOMComment</code> and <code>DOMCDATASection</code> work. 0738 * @since DOM Level 3 0739 * 0740 */ 0741 virtual void normalizeDocument() = 0; 0742 0743 0744 /** 0745 * The configuration used when DOMDocument::normalizeDocument is invoked. 0746 * 0747 * @return The <code>DOMConfiguration</code> from this <code>DOMDocument</code> 0748 * 0749 * @since DOM Level 3 0750 */ 0751 virtual DOMConfiguration* getDOMConfig() const = 0; 0752 0753 //@} 0754 0755 // ----------------------------------------------------------------------- 0756 // Non-standard extension 0757 // ----------------------------------------------------------------------- 0758 /** @name Non-standard extension */ 0759 //@{ 0760 /** 0761 * Non-standard extension 0762 * 0763 * Create a new entity. 0764 * @param name The name of the entity to instantiate 0765 * 0766 */ 0767 virtual DOMEntity *createEntity(const XMLCh *name) = 0; 0768 0769 /** 0770 * Non-standard extension 0771 * 0772 * Create a DOMDocumentType node. 0773 * @return A <code>DOMDocumentType</code> that references the newly 0774 * created DOMDocumentType node. 0775 * 0776 */ 0777 virtual DOMDocumentType *createDocumentType(const XMLCh *name) = 0; 0778 0779 /*** 0780 * Provide default implementation to maintain source code compatibility 0781 ***/ 0782 virtual DOMDocumentType* createDocumentType(const XMLCh *qName, 0783 const XMLCh*, //publicId, 0784 const XMLCh* //systemId 0785 ) 0786 { 0787 return createDocumentType(qName); 0788 } 0789 0790 /** 0791 * Non-standard extension. 0792 * 0793 * Create a Notation. 0794 * @param name The name of the notation to instantiate 0795 * @return A <code>DOMNotation</code> that references the newly 0796 * created DOMNotation node. 0797 */ 0798 virtual DOMNotation *createNotation(const XMLCh *name) = 0; 0799 0800 /** 0801 * Non-standard extension. 0802 * 0803 * Creates an element of the given qualified name and 0804 * namespace URI, and also stores line/column number info. 0805 * Used by internally XSDXercesDOMParser during schema traversal. 0806 * 0807 * @see createElementNS(const XMLCh *namespaceURI, const XMLCh *qualifiedName) 0808 */ 0809 virtual DOMElement *createElementNS(const XMLCh *namespaceURI, 0810 const XMLCh *qualifiedName, 0811 const XMLFileLoc lineNum, 0812 const XMLFileLoc columnNum) = 0; 0813 //@} 0814 0815 }; 0816 0817 XERCES_CPP_NAMESPACE_END 0818 0819 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |