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(XERCESENTITYBRIDGE_HEADER_GUARD_1357924680) 00019 #define XERCESENTITYBRIDGE_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_Entity.hpp> 00029 #else 00030 #include <xercesc/dom/DOM_Entity.hpp> 00031 #endif 00032 00033 00034 00035 #include <xalanc/XalanDOM/XalanEntity.hpp> 00036 00037 00038 00039 #include <xalanc/XercesParserLiaison/Deprecated/XercesNodeListBridge.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 XercesEntityBridge : public XalanEntity 00056 { 00057 public: 00058 00059 typedef XERCES_CPP_NAMESPACE_QUALIFIER DOM_Entity DOM_EntityType; 00060 00061 XercesEntityBridge( 00062 const DOM_EntityType& theXercesDOMEntity, 00063 const XercesBridgeNavigator& theNavigator); 00064 00065 virtual 00066 ~XercesEntityBridge(); 00067 00068 00069 // These interfaces are inherited from XalanNode... 00070 00071 virtual const XalanDOMString& 00072 getNodeName() const; 00073 00074 /** 00075 * Gets the value of this node, depending on its type. 00076 */ 00077 virtual const XalanDOMString& 00078 getNodeValue() const; 00079 00080 /** 00081 * An enum value representing the type of the underlying object. 00082 */ 00083 virtual NodeType 00084 getNodeType() const; 00085 00086 /** 00087 * Gets the parent of this node. 00088 * 00089 * All nodes, except <code>Document</code>, 00090 * <code>DocumentFragment</code>, and <code>Attr</code> may have a parent. 00091 * However, if a node has just been created and not yet added to the tree, 00092 * or if it has been removed from the tree, a <code>null</code> DOM_Node 00093 * is returned. 00094 */ 00095 virtual XalanNode* 00096 getParentNode() const; 00097 00098 /** 00099 * Gets a <code>NodeList</code> that contains all children of this node. 00100 * 00101 * If there 00102 * are no children, this is a <code>NodeList</code> containing no nodes. 00103 * The content of the returned <code>NodeList</code> is "live" in the sense 00104 * that, for instance, changes to the children of the node object that 00105 * it was created from are immediately reflected in the nodes returned by 00106 * the <code>NodeList</code> accessors; it is not a static snapshot of the 00107 * content of the node. This is true for every <code>NodeList</code>, 00108 * including the ones returned by the <code>getElementsByTagName</code> 00109 * method. 00110 */ 00111 virtual const XalanNodeList* 00112 getChildNodes() const; 00113 00114 /** 00115 * Gets the first child of this node. 00116 * 00117 * If there is no such node, this returns <code>null</code>. 00118 */ 00119 virtual XalanNode* 00120 getFirstChild() const; 00121 00122 /** 00123 * Gets the last child of this node. 00124 * 00125 * If there is no such node, this returns <code>null</code>. 00126 */ 00127 virtual XalanNode* 00128 getLastChild() const; 00129 00130 /** 00131 * Gets the node immediately preceding this node. 00132 * 00133 * If there is no such node, this returns <code>null</code>. 00134 */ 00135 virtual XalanNode* 00136 getPreviousSibling() const; 00137 00138 /** 00139 * Gets the node immediately following this node. 00140 * 00141 * If there is no such node, this returns <code>null</code>. 00142 */ 00143 virtual XalanNode* 00144 getNextSibling() const; 00145 00146 /** 00147 * Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it 00148 * is an <code>Element</code>) or <code>null</code> otherwise. 00149 */ 00150 virtual const XalanNamedNodeMap* 00151 getAttributes() const; 00152 00153 /** 00154 * Gets the <code>DOM_Document</code> object associated with this node. 00155 * 00156 * This is also 00157 * the <code>DOM_Document</code> object used to create new nodes. When this 00158 * node is a <code>DOM_Document</code> or a <code>DOM_DocumentType</code> 00159 * which is not used with any <code>DOM_Document</code> yet, this is 00160 * <code>null</code>. 00161 */ 00162 virtual XalanDocument* 00163 getOwnerDocument() const; 00164 00165 //@} 00166 /** @name Cloning function. */ 00167 //@{ 00168 00169 /** 00170 * Returns a duplicate of this node. 00171 * 00172 * This function serves as a generic copy constructor for nodes. 00173 * 00174 * The duplicate node has no parent ( 00175 * <code>parentNode</code> returns <code>null</code>.). 00176 * <br>Cloning an <code>Element</code> copies all attributes and their 00177 * values, including those generated by the XML processor to represent 00178 * defaulted attributes, but this method does not copy any text it contains 00179 * unless it is a deep clone, since the text is contained in a child 00180 * <code>Text</code> node. Cloning any other type of node simply returns a 00181 * copy of this node. 00182 * @param deep If <code>true</code>, recursively clone the subtree under the 00183 * specified node; if <code>false</code>, clone only the node itself (and 00184 * its attributes, if it is an <code>Element</code>). 00185 * @return The duplicate node. 00186 */ 00187 #if defined(XALAN_NO_COVARIANT_RETURN_TYPE) 00188 virtual XalanNode* 00189 #else 00190 virtual XercesEntityBridge* 00191 #endif 00192 cloneNode(bool deep) const; 00193 00194 //@} 00195 /** @name Functions to modify the DOM Node. */ 00196 //@{ 00197 00198 /** 00199 * Inserts the node <code>newChild</code> before the existing child node 00200 * <code>refChild</code>. 00201 * 00202 * If <code>refChild</code> is <code>null</code>, 00203 * insert <code>newChild</code> at the end of the list of children. 00204 * <br>If <code>newChild</code> is a <code>DocumentFragment</code> object, 00205 * all of its children are inserted, in the same order, before 00206 * <code>refChild</code>. If the <code>newChild</code> is already in the 00207 * tree, it is first removed. Note that a <code>DOM_Node</code> that 00208 * has never been assigned to refer to an actual node is == null. 00209 * @param newChild The node to insert. 00210 * @param refChild The reference node, i.e., the node before which the new 00211 * node must be inserted. 00212 * @return The node being inserted. 00213 */ 00214 virtual XalanNode* 00215 insertBefore( 00216 XalanNode* newChild, 00217 XalanNode* refChild); 00218 00219 /** 00220 * Replaces the child node <code>oldChild</code> with <code>newChild</code> 00221 * in the list of children, and returns the <code>oldChild</code> node. 00222 * 00223 * If <CODE>newChild</CODE> is a <CODE>DOM_DocumentFragment</CODE> object, 00224 * <CODE>oldChild</CODE> is replaced by all of the <CODE>DOM_DocumentFragment</CODE> 00225 * children, which are inserted in the same order. 00226 * 00227 * If the <code>newChild</code> is already in the tree, it is first removed. 00228 * @param newChild The new node to put in the child list. 00229 * @param oldChild The node being replaced in the list. 00230 * @return The node replaced. 00231 */ 00232 virtual XalanNode* 00233 replaceChild( 00234 XalanNode* newChild, 00235 XalanNode* oldChild); 00236 00237 /** 00238 * Removes the child node indicated by <code>oldChild</code> from the list 00239 * of children, and returns it. 00240 * 00241 * @param oldChild The node being removed. 00242 * @return The node removed. 00243 */ 00244 virtual XalanNode* 00245 removeChild(XalanNode* oldChild); 00246 00247 /** 00248 * Adds the node <code>newChild</code> to the end of the list of children of 00249 * this node. 00250 * 00251 * If the <code>newChild</code> is already in the tree, it is 00252 * first removed. 00253 * @param newChild The node to add.If it is a <code>DocumentFragment</code> 00254 * object, the entire contents of the document fragment are moved into 00255 * the child list of this node 00256 * @return The node added. 00257 */ 00258 virtual XalanNode* 00259 appendChild(XalanNode* newChild); 00260 00261 //@} 00262 /** @name Query functions. */ 00263 //@{ 00264 00265 /** 00266 * This is a convenience method to allow easy determination of whether a 00267 * node has any children. 00268 * 00269 * @return <code>true</code> if the node has any children, 00270 * <code>false</code> if the node has no children. 00271 */ 00272 virtual bool 00273 hasChildNodes() const; 00274 00275 00276 //@} 00277 /** @name Set functions. */ 00278 //@{ 00279 00280 00281 /** 00282 * Sets the value of the node. 00283 * 00284 * Any node which can have a nodeValue (@see getNodeValue) will 00285 * also accept requests to set it to a string. The exact response to 00286 * this varies from node to node -- Attribute, for example, stores 00287 * its values in its children and has to replace them with a new Text 00288 * holding the replacement value. 00289 * 00290 * For most types of Node, value is null and attempting to set it 00291 * will throw DOMException(NO_MODIFICATION_ALLOWED_ERR). This will 00292 * also be thrown if the node is read-only. 00293 */ 00294 virtual void 00295 setNodeValue(const XalanDOMString& nodeValue); 00296 00297 //@} 00298 /** @name Functions introduced in DOM Level 2. */ 00299 //@{ 00300 00301 /** 00302 * Puts all <CODE>DOM_Text</CODE> 00303 * nodes in the full depth of the sub-tree underneath this <CODE>DOM_Node</CODE>, 00304 * including attribute nodes, into a "normal" form where only markup (e.g., 00305 * tags, comments, processing instructions, CDATA sections, and entity 00306 * references) separates <CODE>DOM_Text</CODE> 00307 * nodes, i.e., there are no adjacent <CODE>DOM_Text</CODE> 00308 * nodes. This can be used to ensure that the DOM view of a document is the 00309 * same as if it were saved and re-loaded, and is useful when operations 00310 * (such as XPointer lookups) that depend on a particular document tree 00311 * structure are to be used. 00312 * <P><B>Note:</B> In cases where the document contains <CODE>DOM_CDATASections</CODE>, 00313 * the normalize operation alone may not be sufficient, since XPointers do 00314 * not differentiate between <CODE>DOM_Text</CODE> 00315 * nodes and <CODE>DOM_CDATASection</CODE> nodes.</P> 00316 */ 00317 virtual void 00318 normalize(); 00319 00320 /** 00321 * Tests whether the DOM implementation implements a specific 00322 * feature and that feature is supported by this node. 00323 * @param feature The string of the feature to test. This is the same 00324 * name as what can be passed to the method <code>hasFeature</code> on 00325 * <code>DOMImplementation</code>. 00326 * @param version This is the version number of the feature to test. In 00327 * Level 2, version 1, this is the string "2.0". If the version is not 00328 * specified, supporting any version of the feature will cause the 00329 * method to return <code>true</code>. 00330 * @return Returns <code>true</code> if the specified feature is supported 00331 * on this node, <code>false</code> otherwise. 00332 */ 00333 virtual bool 00334 isSupported( 00335 const XalanDOMString& feature, 00336 const XalanDOMString& version) const; 00337 00338 /** 00339 * Get the <em>namespace URI</em> of 00340 * this node, or <code>null</code> if it is unspecified. 00341 * <p> 00342 * This is not a computed value that is the result of a namespace lookup 00343 * based on an examination of the namespace declarations in scope. It is 00344 * merely the namespace URI given at creation time. 00345 * <p> 00346 * For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and 00347 * <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method, 00348 * such as <CODE>createElement</CODE> from the <CODE>Document</CODE> 00349 * interface, this is always <CODE>null</CODE>. 00350 */ 00351 virtual const XalanDOMString& 00352 getNamespaceURI() const; 00353 00354 /** 00355 * Get the <em>namespace prefix</em> 00356 * of this node, or <code>null</code> if it is unspecified. 00357 */ 00358 virtual const XalanDOMString& 00359 getPrefix() const; 00360 00361 /** 00362 * Returns the local part of the <em>qualified name</em> of this node. 00363 * <p> 00364 * For nodes created with a DOM Level 1 method, such as 00365 * <code>createElement</code> from the <code>DOM_Document</code> interface, 00366 * it is null. 00367 */ 00368 virtual const XalanDOMString& 00369 getLocalName() const; 00370 00371 /** 00372 * Set the <em>namespace prefix</em> of this node. 00373 * <p> 00374 * Note that setting this attribute, when permitted, changes 00375 * the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified 00376 * name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE> 00377 * attributes of the <CODE>DOM_Element</CODE> and <CODE>DOM_Attr</CODE> 00378 * interfaces, when applicable. 00379 * <p> 00380 * Note also that changing the prefix of an 00381 * attribute, that is known to have a default value, does not make a new 00382 * attribute with the default value and the original prefix appear, since the 00383 * <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change. 00384 * 00385 * @param prefix The prefix of this node. 00386 * @exception DOMException 00387 * INVALID_CHARACTER_ERR: Raised if the specified prefix contains 00388 * an illegal character. 00389 * <br> 00390 * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 00391 * <br> 00392 * NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is 00393 * malformed, if the specified prefix is "xml" and the 00394 * <CODE>namespaceURI</CODE> of this node is different from 00395 * "http://www.w3.org/XML/1998/namespace", if specified prefix is 00396 * "xmlns" and the <CODE>namespaceURI</CODE> is neither 00397 * <CODE>null</CODE> nor an empty string, or if the 00398 * <CODE>localName</CODE> is <CODE>null</CODE>. 00399 */ 00400 virtual void 00401 setPrefix(const XalanDOMString& prefix); 00402 00403 virtual bool 00404 isIndexed() const; 00405 00406 virtual IndexType 00407 getIndex() const; 00408 00409 //@} 00410 00411 // These interfaces are inherited from XalanEntity... 00412 00413 /** 00414 * Get the public identifier of this notation. 00415 * 00416 * If the public identifier was not 00417 * specified, this is <code>null</code>. 00418 * @return Returns the public identifier of the notation 00419 */ 00420 virtual const XalanDOMString& 00421 getPublicId() const; 00422 00423 /** 00424 * Get the system identifier of this notation. 00425 * 00426 * If the system identifier was not 00427 * specified, this is <code>null</code>. 00428 * @return Returns the system identifier of the notation 00429 */ 00430 virtual const XalanDOMString& 00431 getSystemId() const; 00432 00433 /** 00434 * For unparsed entities, the name of the notation for the entity. 00435 * 00436 * For parsed entities, this is <code>null</code>. 00437 */ 00438 virtual const XalanDOMString& 00439 getNotationName() const; 00440 00441 /** 00442 * Get the Xerces node this instance represent. 00443 * 00444 * @return The Xerces node 00445 */ 00446 DOM_EntityType 00447 getXercesNode() const 00448 { 00449 return m_xercesNode; 00450 } 00451 00452 private: 00453 00454 // Not implemented... 00455 XercesEntityBridge(const XercesEntityBridge& theSource); 00456 00457 XercesEntityBridge& 00458 operator=(const XercesEntityBridge& theSource); 00459 00460 bool 00461 operator==(const XercesEntityBridge& theRHS) const; 00462 00463 // Data members... 00464 // $$$ Note that there is an order dependency here, 00465 // due do a code generation bug with MSVC 6.0. The 00466 // call to construct the XercesNodeListBridge uses 00467 // the m_xercesNode data member instead of the 00468 // constructor parameter. I have no idea why MSVC 00469 // generate bogus code when using the parameter, but 00470 // it does... 00471 DOM_EntityType m_xercesNode; 00472 00473 const XercesBridgeNavigator& m_navigator; 00474 00475 XercesNodeListBridge m_children; 00476 }; 00477 00478 00479 00480 XALAN_CPP_NAMESPACE_END 00481 00482 00483 00484 #endif // !defined(XERCESENTITYBRIDGE_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 |
|