00001 /* 00002 * The Apache Software License, Version 1.1 00003 * 00004 * 00005 * Copyright (c) 1999-2000 The Apache Software Foundation. All rights 00006 * reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 00012 * 1. Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * 00015 * 2. Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in 00017 * the documentation and/or other materials provided with the 00018 * distribution. 00019 * 00020 * 3. The end-user documentation included with the redistribution, 00021 * if any, must include the following acknowledgment: 00022 * "This product includes software developed by the 00023 * Apache Software Foundation (http://www.apache.org/)." 00024 * Alternately, this acknowledgment may appear in the software itself, 00025 * if and wherever such third-party acknowledgments normally appear. 00026 * 00027 * 4. The names "Xalan" and "Apache Software Foundation" must 00028 * not be used to endorse or promote products derived from this 00029 * software without prior written permission. For written 00030 * permission, please contact apache@apache.org. 00031 * 00032 * 5. Products derived from this software may not be called "Apache", 00033 * nor may "Apache" appear in their name, without prior written 00034 * permission of the Apache Software Foundation. 00035 * 00036 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00037 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00038 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00039 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 00040 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00041 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00042 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00043 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00044 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00045 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00046 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00047 * SUCH DAMAGE. 00048 * ==================================================================== 00049 * 00050 * This software consists of voluntary contributions made by many 00051 * individuals on behalf of the Apache Software Foundation and was 00052 * originally based on software copyright (c) 1999, International 00053 * Business Machines, Inc., http://www.ibm.com. For more 00054 * information on the Apache Software Foundation, please see 00055 * <http://www.apache.org/>. 00056 */ 00057 #if !defined(XALANSOURCETREEDOCUMENT_HEADER_GUARD_1357924680) 00058 #define XALANSOURCETREEDOCUMENT_HEADER_GUARD_1357924680 00059 00060 00061 00062 #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp> 00063 00064 00065 00066 #include <deque> 00067 #include <map> 00068 00069 00070 00071 #include <XalanDOM/XalanDocument.hpp> 00072 00073 00074 00075 #include <Include/STLHelper.hpp> 00076 00077 00078 00079 #include <PlatformSupport/XalanDOMStringPool.hpp> 00080 00081 00082 00083 #include <XalanSourceTree/XalanSourceTreeAttributeAllocator.hpp> 00084 #include <XalanSourceTree/XalanSourceTreeAttributeNSAllocator.hpp> 00085 #include <XalanSourceTree/XalanSourceTreeAttributesVector.hpp> 00086 #include <XalanSourceTree/XalanSourceTreeCommentAllocator.hpp> 00087 #include <XalanSourceTree/XalanSourceTreeElementAllocator.hpp> 00088 #include <XalanSourceTree/XalanSourceTreeElementNSAllocator.hpp> 00089 #include <XalanSourceTree/XalanSourceTreeProcessingInstructionAllocator.hpp> 00090 #include <XalanSourceTree/XalanSourceTreeTextAllocator.hpp> 00091 #include <XalanSourceTree/XalanSourceTreeTextIWSAllocator.hpp> 00092 00093 00094 00095 class AttributeList; 00096 class Attributes; 00097 class PrefixResolver; 00098 00099 00100 00101 class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeDocument : public XalanDocument 00102 { 00103 public: 00104 00105 typedef XalanSourceTreeElement::AttributesCountType AttributesCountType; 00106 00107 #if defined (XALAN_NO_NAMESPACES) 00108 typedef map< 00109 const XalanDOMChar*, 00110 XalanSourceTreeElement*, 00111 less_null_terminated_arrays<XalanDOMChar> > ElementByIDMapType; 00112 00113 typedef map< 00114 XalanDOMString, 00115 XalanDOMString, 00116 less<XalanDOMString> > UnparsedEntityURIMapType; 00117 00118 typedef deque<XalanDOMString> StringCollectionType; 00119 #else 00120 typedef std::map< 00121 const XalanDOMChar*, 00122 XalanSourceTreeElement*, 00123 less_null_terminated_arrays<XalanDOMChar> > ElementByIDMapType; 00124 00125 typedef std::map< 00126 XalanDOMString, 00127 XalanDOMString> UnparsedEntityURIMapType; 00128 00129 typedef std::deque<XalanDOMString> StringCollectionType; 00130 #endif 00131 00135 static void 00136 initialize(); 00137 00141 static void 00142 terminate(); 00143 00144 00145 enum { eDefaultNamesStringPoolBlockSize = XalanDOMStringPool::eDefaultBlockSize, 00146 eDefaultNamesStringPoolBucketCount = XalanDOMStringPool::eDefaultBucketCount, 00147 eDefaultNamesStringPoolBucketSize = XalanDOMStringPool::eDefaultBucketSize, 00148 eDefaultValuesStringPoolBlockSize = XalanDOMStringPool::eDefaultBlockSize, 00149 eDefaultValuesStringPoolBucketCount = 997, 00150 eDefaultValuesStringPoolBucketSize = XalanDOMStringPool::eDefaultBucketSize }; 00151 00152 00167 XalanSourceTreeDocument( 00168 unsigned long theNumber, 00169 bool fPoolAllText = true, 00170 unsigned int theNamesStringPoolBlockSize = eDefaultNamesStringPoolBlockSize, 00171 unsigned int theNamesStringPoolBucketCount = eDefaultNamesStringPoolBucketCount, 00172 unsigned int theNamesStringPoolBucketSize = eDefaultNamesStringPoolBucketSize, 00173 unsigned int theValuesStringPoolBlockSize = eDefaultValuesStringPoolBlockSize, 00174 unsigned int theValuesStringPoolBucketCount = eDefaultValuesStringPoolBucketCount, 00175 unsigned int theValuesStringPoolBucketSize = eDefaultValuesStringPoolBucketSize); 00176 00177 virtual 00178 ~XalanSourceTreeDocument(); 00179 00180 // These interfaces are inherited from XalanNode... 00181 00182 virtual const XalanDOMString& 00183 getNodeName() const; 00184 00185 virtual const XalanDOMString& 00186 getNodeValue() const; 00187 00188 virtual NodeType 00189 getNodeType() const; 00190 00191 virtual XalanNode* 00192 getParentNode() const; 00193 00194 virtual const XalanNodeList* 00195 getChildNodes() const; 00196 00197 virtual XalanNode* 00198 getFirstChild() const; 00199 00200 virtual XalanNode* 00201 getLastChild() const; 00202 00203 virtual XalanNode* 00204 getPreviousSibling() const; 00205 00206 virtual XalanNode* 00207 getNextSibling() const; 00208 00209 virtual const XalanNamedNodeMap* 00210 getAttributes() const; 00211 00212 virtual XalanDocument* 00213 getOwnerDocument() const; 00214 00215 #if defined(XALAN_NO_COVARIANT_RETURN_TYPE) 00216 virtual XalanNode* 00217 #else 00218 virtual XalanSourceTreeDocument* 00219 #endif 00220 cloneNode(bool deep) const; 00221 00222 virtual XalanNode* 00223 insertBefore( 00224 XalanNode* newChild, 00225 XalanNode* refChild); 00226 00227 virtual XalanNode* 00228 replaceChild( 00229 XalanNode* newChild, 00230 XalanNode* oldChild); 00231 00232 virtual XalanNode* 00233 removeChild(XalanNode* oldChild); 00234 00235 virtual XalanNode* 00236 appendChild(XalanNode* newChild); 00237 00238 virtual bool 00239 hasChildNodes() const; 00240 00241 virtual void 00242 setNodeValue(const XalanDOMString& nodeValue); 00243 00244 virtual void 00245 normalize(); 00246 00247 virtual bool 00248 supports( 00249 const XalanDOMString& feature, 00250 const XalanDOMString& version) const; 00251 00252 virtual const XalanDOMString& 00253 getNamespaceURI() const; 00254 00255 virtual const XalanDOMString& 00256 getPrefix() const; 00257 00258 virtual const XalanDOMString& 00259 getLocalName() const; 00260 00261 virtual void 00262 setPrefix(const XalanDOMString& prefix); 00263 00264 virtual bool 00265 isIndexed() const; 00266 00267 virtual unsigned long 00268 getIndex() const; 00269 00270 virtual XalanElement* 00271 createElement(const XalanDOMString& tagName); 00272 00273 virtual XalanDocumentFragment* 00274 createDocumentFragment(); 00275 00276 virtual XalanText* 00277 createTextNode(const XalanDOMString& data); 00278 00279 virtual XalanComment* 00280 createComment(const XalanDOMString& data); 00281 00282 virtual XalanCDATASection* 00283 createCDATASection(const XalanDOMString& data); 00284 00285 virtual XalanProcessingInstruction* 00286 createProcessingInstruction( 00287 const XalanDOMString& target, 00288 const XalanDOMString& data); 00289 00290 virtual XalanAttr* 00291 createAttribute(const XalanDOMString& name); 00292 00293 virtual XalanEntityReference* 00294 createEntityReference(const XalanDOMString& name); 00295 00296 virtual XalanDocumentType* 00297 getDoctype() const; 00298 00299 virtual XalanDOMImplementation* 00300 getImplementation() const; 00301 00302 virtual XalanElement* 00303 getDocumentElement() const; 00304 00305 virtual XalanNodeList* 00306 getElementsByTagName(const XalanDOMString& tagname) const; 00307 00308 virtual XalanNode* 00309 importNode( 00310 XalanNode* importedNode, 00311 bool deep); 00312 00313 virtual XalanElement* 00314 createElementNS( 00315 const XalanDOMString& namespaceURI, 00316 const XalanDOMString& qualifiedName); 00317 00318 virtual XalanAttr* 00319 createAttributeNS( 00320 const XalanDOMString& namespaceURI, 00321 const XalanDOMString& qualifiedName); 00322 00323 virtual XalanNodeList* 00324 getElementsByTagNameNS( 00325 const XalanDOMString& namespaceURI, 00326 const XalanDOMString& localName) const; 00327 00328 virtual XalanElement* 00329 getElementById(const XalanDOMString& elementId) const; 00330 00331 virtual unsigned long 00332 getNumber() const; 00333 00334 00335 // Interfaces not inherited from XalanDocument... 00336 00337 XalanSourceTreeElement* 00338 createElementNode( 00339 const XalanDOMChar* name, 00340 const AttributeList& attrs, 00341 XalanSourceTreeElement* theParentElement = 0, 00342 XalanNode* thePreviousSibling = 0, 00343 XalanNode* theNextSibling = 0); 00344 00345 XalanSourceTreeElement* 00346 createElementNode( 00347 const XalanDOMChar* uri, 00348 const XalanDOMChar* localname, 00349 const XalanDOMChar* qname, 00350 const Attributes& attrs, 00351 XalanSourceTreeElement* theParentElement = 0, 00352 XalanNode* thePreviousSibling = 0, 00353 XalanNode* theNextSibling = 0); 00354 00355 XalanSourceTreeElement* 00356 createElementNode( 00357 const XalanDOMChar* tagName, 00358 const AttributeList& attrs, 00359 const PrefixResolver& thePrefixResolver, 00360 XalanSourceTreeElement* theParentElement = 0, 00361 XalanNode* thePreviousSibling = 0, 00362 XalanNode* theNextSibling = 0); 00363 00364 XalanSourceTreeElement* 00365 createElementNode( 00366 const XalanDOMChar* name, 00367 const Attributes& attrs, 00368 XalanSourceTreeElement* theParentElement = 0, 00369 XalanNode* thePreviousSibling = 0, 00370 XalanNode* theNextSibling = 0); 00371 00372 XalanSourceTreeComment* 00373 createCommentNode( 00374 const XalanDOMChar* data, 00375 unsigned int length, 00376 XalanSourceTreeElement* theParentElement = 0, 00377 XalanNode* thePreviousSibling = 0, 00378 XalanNode* theNextSibling = 0); 00379 00380 XalanSourceTreeProcessingInstruction* 00381 createProcessingInstructionNode( 00382 const XalanDOMChar* target, 00383 const XalanDOMChar* data, 00384 XalanSourceTreeElement* theParentElement = 0, 00385 XalanNode* thePreviousSibling = 0, 00386 XalanNode* theNextSibling = 0); 00387 00388 XalanSourceTreeText* 00389 createTextNode( 00390 const XalanDOMChar* chars, 00391 unsigned int length, 00392 XalanSourceTreeElement* theParentElement = 0, 00393 XalanNode* thePreviousSibling = 0, 00394 XalanNode* theNextSibling = 0); 00395 00396 XalanSourceTreeText* 00397 createTextIWSNode( 00398 const XalanDOMChar* chars, 00399 unsigned int length, 00400 XalanSourceTreeElement* theParentElement = 0, 00401 XalanNode* thePreviousSibling = 0, 00402 XalanNode* theNextSibling = 0); 00403 00404 void 00405 unparsedEntityDeclaration( 00406 const XalanDOMChar* name, 00407 const XalanDOMChar* publicId, 00408 const XalanDOMChar* systemId, 00409 const XalanDOMChar* notationName); 00410 00411 const XalanDOMString& 00412 getUnparsedEntityURI(const XalanDOMString& theName) const; 00413 00414 // Child node setters... 00415 void 00416 appendChildNode(XalanSourceTreeComment* theChild); 00417 00418 void 00419 appendChildNode(XalanSourceTreeElement* theChild); 00420 00421 void 00422 appendChildNode(XalanSourceTreeProcessingInstruction* theChild); 00423 00424 private: 00425 00426 // Helper functions... 00427 XalanSourceTreeAttr* 00428 createAttribute( 00429 const XalanDOMChar* theName, 00430 const XalanDOMChar* theValue, 00431 XalanSourceTreeElement* theOwnerElement, 00432 const PrefixResolver& thePrefixResolver); 00433 00434 XalanSourceTreeAttr* 00435 createAttribute( 00436 const XalanDOMChar* theName, 00437 const XalanDOMChar* theValue, 00438 XalanSourceTreeElement* theOwnerElement); 00439 00440 XalanSourceTreeElement* 00441 createElement( 00442 const XalanDOMChar* theTagName, 00443 XalanSourceTreeAttr** theAttributeVector, 00444 AttributesCountType theAttributeCount, 00445 XalanSourceTreeElement* theParentElement, 00446 XalanNode* thePreviousSibling, 00447 XalanNode* theNextSibling); 00448 00449 XalanSourceTreeElement* 00450 createElement( 00451 const XalanDOMChar* theTagName, 00452 XalanSourceTreeAttr** theAttributeVector, 00453 AttributesCountType theAttributeCount, 00454 XalanSourceTreeElement* theParentElement, 00455 XalanNode* thePreviousSibling, 00456 XalanNode* theNextSibling, 00457 const PrefixResolver& thePrefixResolver); 00458 00459 void 00460 createAttributes( 00461 const Attributes& theAttributes, 00462 XalanSourceTreeAttr** theAttributeVector, 00463 AttributesCountType theAttributeCount, 00464 XalanSourceTreeElement* theOwnerElement); 00465 00466 const XalanDOMString& 00467 getTextNodeString( 00468 const XalanDOMChar* chars, 00469 unsigned int length); 00470 00471 const XalanDOMString* 00472 getNamespaceForPrefix( 00473 const XalanDOMChar* theName, 00474 const PrefixResolver& thePrefixResolver, 00475 XalanDOMString& thePrefix, 00476 bool fUseDefault); 00477 00478 // Not implemented... 00479 XalanSourceTreeDocument(const XalanSourceTreeDocument& theSource); 00480 00481 XalanSourceTreeDocument& 00482 operator=(const XalanSourceTreeDocument& theRHS); 00483 00484 bool 00485 operator==(const XalanSourceTreeDocument& theRHS) const; 00486 00487 00488 // Data members... 00489 const unsigned long m_number; 00490 00491 XalanNode* m_firstChild; 00492 00493 XalanSourceTreeElement* m_documentElement; 00494 00495 XalanSourceTreeAttributeAllocator m_attributeAllocator; 00496 00497 XalanSourceTreeAttributeNSAllocator m_attributeNSAllocator; 00498 00499 XalanSourceTreeCommentAllocator m_commentAllocator; 00500 00501 XalanSourceTreeElementAllocator m_elementAllocator; 00502 00503 XalanSourceTreeElementNSAllocator m_elementNSAllocator; 00504 00505 XalanSourceTreeProcessingInstructionAllocator m_piAllocator; 00506 00507 XalanSourceTreeTextAllocator m_textAllocator; 00508 00509 XalanSourceTreeTextIWSAllocator m_textIWSAllocator; 00510 00511 XalanDOMStringPool m_namesStringPool; 00512 00513 XalanDOMStringPool m_valuesStringPool; 00514 00515 XalanSourceTreeAttributesVector m_attributesVector; 00516 00517 unsigned int m_nextIndexValue; 00518 00519 const bool m_poolAllText; 00520 00521 ElementByIDMapType m_elementsByID; 00522 00523 UnparsedEntityURIMapType m_unparsedEntityURIs; 00524 00525 StringCollectionType m_nonPooledStrings; 00526 00527 XalanDOMString m_stringBuffer; 00528 00529 static const XalanDOMString& s_nameString; 00530 }; 00531 00532 00533 00534 #endif // !defined(XALANSOURCETREEDOCUMENT_HEADER_GUARD_1357924680)
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
![]() |
Xalan-C++ XSL Transformer Version 1.1 |
|