00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one 00003 * or more contributor license agreements. See the NOTICE file 00004 * distributed with this work for additional information 00005 * regarding copyright ownership. The ASF licenses this file 00006 * to you under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 #if !defined(XERCESCDATASECTIONBRIDGE_HEADER_GUARD_1357924680) 00019 #define XERCESCDATASECTIONBRIDGE_HEADER_GUARD_1357924680 00020 00021 00022 00023 #include <xalanc/XercesParserLiaison/XercesParserLiaisonDefinitions.hpp> 00024 00025 00026 00027 #if XERCES_VERSION_MAJOR >= 2 00028 #include <xercesc/dom/deprecated/DOM_CDATASection.hpp> 00029 #else 00030 #include <xercesc/dom/DOM_CDATASection.hpp> 00031 #endif 00032 00033 00034 00035 #include <xalanc/XalanDOM/XalanCDATASection.hpp> 00036 00037 00038 00039 #include <xalanc/XercesParserLiaison/Deprecated/XercesBridgeTypes.hpp> 00040 00041 00042 00043 XALAN_CPP_NAMESPACE_BEGIN 00044 00045 00046 00047 class XercesBridgeNavigator; 00048 00049 00050 /** 00051 * This class is deprecated. 00052 * 00053 * @deprecated This class is part of the deprecated Xerces DOM bridge. 00054 */ 00055 class XALAN_XERCESPARSERLIAISON_EXPORT XercesCDATASectionBridge : public XalanCDATASection 00056 { 00057 public: 00058 00059 XercesCDATASectionBridge( 00060 const DOM_CDATASectionType& theXercesCDATASection, 00061 const XercesBridgeNavigator& theNavigator); 00062 00063 virtual 00064 ~XercesCDATASectionBridge(); 00065 00066 00067 /** 00068 * Gets the name of this node. 00069 */ 00070 virtual const XalanDOMString& 00071 getNodeName() const; 00072 00073 /** 00074 * Gets the value of this node, depending on its type. 00075 */ 00076 virtual const XalanDOMString& 00077 getNodeValue() const; 00078 00079 /** 00080 * An enum value representing the type of the underlying object. 00081 */ 00082 virtual NodeType 00083 getNodeType() const; 00084 00085 /** 00086 * Gets the parent of this node. 00087 * 00088 * All nodes, except <code>Document</code>, 00089 * <code>DocumentFragment</code>, and <code>Attr</code> may have a parent. 00090 * However, if a node has just been created and not yet added to the tree, 00091 * or if it has been removed from the tree, a <code>null</code> DOM_Node 00092 * is returned. 00093 */ 00094 virtual XalanNode* 00095 getParentNode() const; 00096 00097 /** 00098 * Gets a <code>NodeList</code> that contains all children of this node. 00099 * 00100 * If there 00101 * are no children, this is a <code>NodeList</code> containing no nodes. 00102 * The content of the returned <code>NodeList</code> is "live" in the sense 00103 * that, for instance, changes to the children of the node object that 00104 * it was created from are immediately reflected in the nodes returned by 00105 * the <code>NodeList</code> accessors; it is not a static snapshot of the 00106 * content of the node. This is true for every <code>NodeList</code>, 00107 * including the ones returned by the <code>getElementsByTagName</code> 00108 * method. 00109 */ 00110 virtual const XalanNodeList* 00111 getChildNodes() const; 00112 00113 /** 00114 * Gets the first child of this node. 00115 * 00116 * If there is no such node, this returns <code>null</code>. 00117 */ 00118 virtual XalanNode* 00119 getFirstChild() const; 00120 00121 /** 00122 * Gets the last child of this node. 00123 * 00124 * If there is no such node, this returns <code>null</code>. 00125 */ 00126 virtual XalanNode* 00127 getLastChild() const; 00128 00129 /** 00130 * Gets the node immediately preceding this node. 00131 * 00132 * If there is no such node, this returns <code>null</code>. 00133 */ 00134 virtual XalanNode* 00135 getPreviousSibling() const; 00136 00137 /** 00138 * Gets the node immediately following this node. 00139 * 00140 * If there is no such node, this returns <code>null</code>. 00141 */ 00142 virtual XalanNode* 00143 getNextSibling() const; 00144 00145 /** 00146 * Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it 00147 * is an <code>Element</code>) or <code>null</code> otherwise. 00148 */ 00149 virtual const XalanNamedNodeMap* 00150 getAttributes() const; 00151 00152 /** 00153 * Gets the <code>DOM_Document</code> object associated with this node. 00154 * 00155 * This is also 00156 * the <code>DOM_Document</code> object used to create new nodes. When this 00157 * node is a <code>DOM_Document</code> or a <code>DOM_DocumentType</code> 00158 * which is not used with any <code>DOM_Document</code> yet, this is 00159 * <code>null</code>. 00160 */ 00161 virtual XalanDocument* 00162 getOwnerDocument() const; 00163 00164 //@} 00165 /** @name Cloning function. */ 00166 //@{ 00167 00168 /** 00169 * Returns a duplicate of this node. 00170 * 00171 * This function serves as a generic copy constructor for nodes. 00172 * 00173 * The duplicate node has no parent ( 00174 * <code>parentNode</code> returns <code>null</code>.). 00175 * <br>Cloning an <code>Element</code> copies all attributes and their 00176 * values, including those generated by the XML processor to represent 00177 * defaulted attributes, but this method does not copy any text it contains 00178 * unless it is a deep clone, since the text is contained in a child 00179 * <code>Text</code> node. Cloning any other type of node simply returns a 00180 * copy of this node. 00181 * @param deep If <code>true</code>, recursively clone the subtree under the 00182 * specified node; if <code>false</code>, clone only the node itself (and 00183 * its attributes, if it is an <code>Element</code>). 00184 * @return The duplicate node. 00185 */ 00186 #if defined(XALAN_NO_COVARIANT_RETURN_TYPE) 00187 virtual XalanNode* 00188 #else 00189 virtual XercesCDATASectionBridge* 00190 #endif 00191 cloneNode(bool deep) const; 00192 00193 //@} 00194 /** @name Functions to modify the DOM Node. */ 00195 //@{ 00196 00197 /** 00198 * Inserts the node <code>newChild</code> before the existing child node 00199 * <code>refChild</code>. 00200 * 00201 * If <code>refChild</code> is <code>null</code>, 00202 * insert <code>newChild</code> at the end of the list of children. 00203 * <br>If <code>newChild</code> is a <code>DocumentFragment</code> object, 00204 * all of its children are inserted, in the same order, before 00205 * <code>refChild</code>. If the <code>newChild</code> is already in the 00206 * tree, it is first removed. Note that a <code>DOM_Node</code> that 00207 * has never been assigned to refer to an actual node is == null. 00208 * @param newChild The node to insert. 00209 * @param refChild The reference node, i.e., the node before which the new 00210 * node must be inserted. 00211 * @return The node being inserted. 00212 */ 00213 virtual XalanNode* 00214 insertBefore( 00215 XalanNode* newChild, 00216 XalanNode* refChild); 00217 00218 /** 00219 * Replaces the child node <code>oldChild</code> with <code>newChild</code> 00220 * in the list of children, and returns the <code>oldChild</code> node. 00221 * 00222 * If <CODE>newChild</CODE> is a <CODE>DOM_DocumentFragment</CODE> object, 00223 * <CODE>oldChild</CODE> is replaced by all of the <CODE>DOM_DocumentFragment</CODE> 00224 * children, which are inserted in the same order. 00225 * 00226 * If the <code>newChild</code> is already in the tree, it is first removed. 00227 * @param newChild The new node to put in the child list. 00228 * @param oldChild The node being replaced in the list. 00229 * @return The node replaced. 00230 */ 00231 virtual XalanNode* 00232 replaceChild( 00233 XalanNode* newChild, 00234 XalanNode* oldChild); 00235 00236 /** 00237 * Removes the child node indicated by <code>oldChild</code> from the list 00238 * of children, and returns it. 00239 * 00240 * @param oldChild The node being removed. 00241 * @return The node removed. 00242 */ 00243 virtual XalanNode* 00244 removeChild(XalanNode* oldChild); 00245 00246 /** 00247 * Adds the node <code>newChild</code> to the end of the list of children of 00248 * this node. 00249 * 00250 * If the <code>newChild</code> is already in the tree, it is 00251 * first removed. 00252 * @param newChild The node to add.If it is a <code>DocumentFragment</code> 00253 * object, the entire contents of the document fragment are moved into 00254 * the child list of this node 00255 * @return The node added. 00256 */ 00257 virtual XalanNode* 00258 appendChild(XalanNode* newChild); 00259 00260 //@} 00261 /** @name Query functions. */ 00262 //@{ 00263 00264 /** 00265 * This is a convenience method to allow easy determination of whether a 00266 * node has any children. 00267 * 00268 * @return <code>true</code> if the node has any children, 00269 * <code>false</code> if the node has no children. 00270 */ 00271 virtual bool 00272 hasChildNodes() const; 00273 00274 00275 //@} 00276 /** @name Set functions. */ 00277 //@{ 00278 00279 00280 /** 00281 * Sets the value of the node. 00282 * 00283 * Any node which can have a nodeValue (@see getNodeValue) will 00284 * also accept requests to set it to a string. The exact response to 00285 * this varies from node to node -- Attribute, for example, stores 00286 * its values in its children and has to replace them with a new Text 00287 * holding the replacement value. 00288 * 00289 * For most types of Node, value is null and attempting to set it 00290 * will throw DOMException(NO_MODIFICATION_ALLOWED_ERR). This will 00291 * also be thrown if the node is read-only. 00292 */ 00293 virtual void 00294 setNodeValue(const XalanDOMString& nodeValue); 00295 00296 //@} 00297 /** @name Functions introduced in DOM Level 2. */ 00298 //@{ 00299 00300 /** 00301 * Puts all <CODE>DOM_Text</CODE> 00302 * nodes in the full depth of the sub-tree underneath this <CODE>DOM_Node</CODE>, 00303 * including attribute nodes, into a "normal" form where only markup (e.g., 00304 * tags, comments, processing instructions, CDATA sections, and entity 00305 * references) separates <CODE>DOM_Text</CODE> 00306 * nodes, i.e., there are no adjacent <CODE>DOM_Text</CODE> 00307 * nodes. This can be used to ensure that the DOM view of a document is the 00308 * same as if it were saved and re-loaded, and is useful when operations 00309 * (such as XPointer lookups) that depend on a particular document tree 00310 * structure are to be used. 00311 * <P><B>Note:</B> In cases where the document contains <CODE>DOM_CDATASections</CODE>, 00312 * the normalize operation alone may not be sufficient, since XPointers do 00313 * not differentiate between <CODE>DOM_Text</CODE> 00314 * nodes and <CODE>DOM_CDATASection</CODE> nodes.</P> 00315 */ 00316 virtual void 00317 normalize(); 00318 00319 /** 00320 * Tests whether the DOM implementation implements a specific 00321 * feature and that feature is supported by this node. 00322 * @param feature The string of the feature to test. This is the same 00323 * name as what can be passed to the method <code>hasFeature</code> on 00324 * <code>DOMImplementation</code>. 00325 * @param version This is the version number of the feature to test. In 00326 * Level 2, version 1, this is the string "2.0". If the version is not 00327 * specified, supporting any version of the feature will cause the 00328 * method to return <code>true</code>. 00329 * @return Returns <code>true</code> if the specified feature is supported 00330 * on this node, <code>false</code> otherwise. 00331 */ 00332 virtual bool 00333 isSupported( 00334 const XalanDOMString& feature, 00335 const XalanDOMString& version) const; 00336 00337 /** 00338 * Get the <em>namespace URI</em> of 00339 * this node, or <code>null</code> if it is unspecified. 00340 * <p> 00341 * This is not a computed value that is the result of a namespace lookup 00342 * based on an examination of the namespace declarations in scope. It is 00343 * merely the namespace URI given at creation time. 00344 * <p> 00345 * For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and 00346 * <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method, 00347 * such as <CODE>createElement</CODE> from the <CODE>Document</CODE> 00348 * interface, this is always <CODE>null</CODE>. 00349 */ 00350 virtual const XalanDOMString& 00351 getNamespaceURI() const; 00352 00353 /** 00354 * Get the <em>namespace prefix</em> 00355 * of this node, or <code>null</code> if it is unspecified. 00356 */ 00357 virtual const XalanDOMString& 00358 getPrefix() const; 00359 00360 /** 00361 * Returns the local part of the <em>qualified name</em> of this node. 00362 * <p> 00363 * For nodes created with a DOM Level 1 method, such as 00364 * <code>createElement</code> from the <code>DOM_Document</code> interface, 00365 * it is null. 00366 */ 00367 virtual const XalanDOMString& 00368 getLocalName() const; 00369 00370 /** 00371 * Set the <em>namespace prefix</em> of this node. 00372 * <p> 00373 * Note that setting this attribute, when permitted, changes 00374 * the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified 00375 * name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE> 00376 * attributes of the <CODE>DOM_Element</CODE> and <CODE>DOM_Attr</CODE> 00377 * interfaces, when applicable. 00378 * <p> 00379 * Note also that changing the prefix of an 00380 * attribute, that is known to have a default value, does not make a new 00381 * attribute with the default value and the original prefix appear, since the 00382 * <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change. 00383 * 00384 * @param prefix The prefix of this node. 00385 * @exception DOMException 00386 * INVALID_CHARACTER_ERR: Raised if the specified prefix contains 00387 * an illegal character. 00388 * <br> 00389 * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 00390 * <br> 00391 * NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is 00392 * malformed, if the specified prefix is "xml" and the 00393 * <CODE>namespaceURI</CODE> of this node is different from 00394 * "http://www.w3.org/XML/1998/namespace", if specified prefix is 00395 * "xmlns" and the <CODE>namespaceURI</CODE> is neither 00396 * <CODE>null</CODE> nor an empty string, or if the 00397 * <CODE>localName</CODE> is <CODE>null</CODE>. 00398 */ 00399 virtual void 00400 setPrefix(const XalanDOMString& prefix); 00401 00402 virtual bool 00403 isIndexed() const; 00404 00405 virtual IndexType 00406 getIndex() const; 00407 00408 //@} 00409 00410 // These interfaces are inherited from XalanCDATASection... 00411 00412 /** @name Getter functions. */ 00413 //@{ 00414 /** 00415 * Returns the character data of the node that implements this interface. 00416 * 00417 * The DOM implementation may not put arbitrary limits on the amount of data that 00418 * may be stored in a <code>CharacterData</code> node. However, 00419 * implementation limits may mean that the entirety of a node's data may 00420 * not fit into a single <code>DOMString</code>. In such cases, the user 00421 * may call <code>substringData</code> to retrieve the data in 00422 * appropriately sized pieces. 00423 * @exception DOMException 00424 * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. 00425 * @exception DOMException 00426 * DOMSTRING_SIZE_ERR: Raised when it would return more characters than 00427 * fit in a <code>DOMString</code> variable on the implementation 00428 * platform. 00429 */ 00430 virtual const XalanDOMString& 00431 getData() const; 00432 00433 /** 00434 * Returns the number of characters that are available through <code>data</code> and 00435 * the <code>substringData</code> method below. 00436 * 00437 * This may have the value 00438 * zero, i.e., <code>CharacterData</code> nodes may be empty. 00439 */ 00440 virtual unsigned int 00441 getLength() const; 00442 00443 /** 00444 * Extracts a range of data from the node. 00445 * 00446 * @param offset Start offset of substring to extract. 00447 * @param count The number of characters to extract. 00448 * @return The specified substring. If the sum of <code>offset</code> and 00449 * <code>count</code> exceeds the <code>length</code>, then all 00450 * characters to the end of the data are returned. 00451 * @exception DOMException 00452 * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater 00453 * than the number of characters in <code>data</code>, or if the 00454 * specified <code>count</code> is negative. 00455 * <br>DOMSTRING_SIZE_ERR: Raised if the specified range of text does not 00456 * fit into a <code>DOMString</code>. 00457 */ 00458 virtual XalanDOMString 00459 substringData( 00460 unsigned int offset, 00461 unsigned int count) const; 00462 00463 //@} 00464 /** @name Functions that set or change data. */ 00465 //@{ 00466 /** 00467 * Append the string to the end of the character data of the node. 00468 * 00469 * Upon success, <code>data</code> provides access to the concatenation of 00470 * <code>data</code> and the <code>DOMString</code> specified. 00471 * @param arg The <code>DOMString</code> to append. 00472 * @exception DOMException 00473 * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 00474 */ 00475 virtual void 00476 appendData(const XalanDOMString& arg); 00477 00478 /** 00479 * Insert a string at the specified character offset. 00480 * 00481 * @param offset The character offset at which to insert. 00482 * @param arg The <code>DOMString</code> to insert. 00483 * @exception DOMException 00484 * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater 00485 * than the number of characters in <code>data</code>. 00486 * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 00487 */ 00488 virtual void 00489 insertData( 00490 unsigned int offset, 00491 const XalanDOMString& arg); 00492 00493 /** 00494 * Remove a range of characters from the node. 00495 * 00496 * Upon success, 00497 * <code>data</code> and <code>length</code> reflect the change. 00498 * @param offset The offset from which to remove characters. 00499 * @param count The number of characters to delete. If the sum of 00500 * <code>offset</code> and <code>count</code> exceeds <code>length</code> 00501 * then all characters from <code>offset</code> to the end of the data 00502 * are deleted. 00503 * @exception DOMException 00504 * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater 00505 * than the number of characters in <code>data</code>, or if the 00506 * specified <code>count</code> is negative. 00507 * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 00508 */ 00509 virtual void 00510 deleteData( 00511 unsigned int offset, 00512 unsigned int count); 00513 00514 /** 00515 * Replace the characters starting at the specified character offset with 00516 * the specified string. 00517 * 00518 * @param offset The offset from which to start replacing. 00519 * @param count The number of characters to replace. If the sum of 00520 * <code>offset</code> and <code>count</code> exceeds <code>length</code> 00521 * , then all characters to the end of the data are replaced (i.e., the 00522 * effect is the same as a <code>remove</code> method call with the same 00523 * range, followed by an <code>append</code> method invocation). 00524 * @param arg The <code>DOMString</code> with which the range must be 00525 * replaced. 00526 * @exception DOMException 00527 * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater 00528 * than the number of characters in <code>data</code>, or if the 00529 * specified <code>count</code> is negative. 00530 * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 00531 */ 00532 virtual void 00533 replaceData( 00534 unsigned int offset, 00535 unsigned int count, 00536 const XalanDOMString& arg); 00537 00538 //@} 00539 00540 //@} 00541 /** @name Functions to modify the Text node. */ 00542 //@{ 00543 00544 /** 00545 * Breaks this node into two nodes at the specified 00546 * offset, keeping both in the tree as siblings. 00547 * 00548 * This node then only 00549 * contains all the content up to the <code>offset</code> point. And a new 00550 * node of the same nodeType, which is inserted as the next sibling of this 00551 * node, contains all the content at and after the <code>offset</code> 00552 * point. When the <code>offset</code> is equal to the lenght of this node, 00553 * the new node has no data. 00554 * @param offset The offset at which to split, starting from 0. 00555 * @return The new <code>Text</code> node. 00556 * @exception DOMException 00557 * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater 00558 * than the number of characters in <code>data</code>. 00559 * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 00560 */ 00561 virtual XalanText* 00562 splitText(unsigned int offset); 00563 00564 //@} 00565 00566 virtual bool 00567 isWhitespace() const; 00568 00569 /** 00570 * Get the Xerces node this instance represent. 00571 * 00572 * @return The Xerces node 00573 */ 00574 DOM_CDATASectionType 00575 getXercesNode() const 00576 { 00577 return m_xercesNode; 00578 } 00579 00580 private: 00581 00582 // Not implemented... 00583 XercesCDATASectionBridge(const XercesCDATASectionBridge& theSource); 00584 00585 XercesCDATASectionBridge& 00586 operator=(const XercesCDATASectionBridge& theSource); 00587 00588 bool 00589 operator==(const XercesCDATASectionBridge& theRHS) const; 00590 00591 // Data members... 00592 DOM_CDATASectionType m_xercesNode; 00593 00594 const XercesBridgeNavigator& m_navigator; 00595 }; 00596 00597 00598 00599 XALAN_CPP_NAMESPACE_END 00600 00601 00602 00603 #endif // !defined(XERCESCDATASECTIONBRIDGE_HEADER_GUARD_1357924680)
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.11 |
|