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 00153 typedef XalanDOMStringPool::block_size_type block_size_type; 00154 typedef XalanDOMStringPool::bucket_count_type bucket_count_type; 00155 typedef XalanDOMStringPool::bucket_size_type bucket_size_type; 00156 00171 XalanSourceTreeDocument( 00172 unsigned long theNumber, 00173 bool fPoolAllText = true, 00174 block_size_type theNamesStringPoolBlockSize = eDefaultNamesStringPoolBlockSize, 00175 bucket_count_type theNamesStringPoolBucketCount = eDefaultNamesStringPoolBucketCount, 00176 bucket_size_type theNamesStringPoolBucketSize = eDefaultNamesStringPoolBucketSize, 00177 block_size_type theValuesStringPoolBlockSize = eDefaultValuesStringPoolBlockSize, 00178 bucket_count_type theValuesStringPoolBucketCount = eDefaultValuesStringPoolBucketCount, 00179 bucket_size_type theValuesStringPoolBucketSize = eDefaultValuesStringPoolBucketSize); 00180 00181 virtual 00182 ~XalanSourceTreeDocument(); 00183 00184 // These interfaces are inherited from XalanNode... 00185 00186 virtual const XalanDOMString& 00187 getNodeName() const; 00188 00189 virtual const XalanDOMString& 00190 getNodeValue() const; 00191 00192 virtual NodeType 00193 getNodeType() const; 00194 00195 virtual XalanNode* 00196 getParentNode() const; 00197 00198 virtual const XalanNodeList* 00199 getChildNodes() const; 00200 00201 virtual XalanNode* 00202 getFirstChild() const; 00203 00204 virtual XalanNode* 00205 getLastChild() const; 00206 00207 virtual XalanNode* 00208 getPreviousSibling() const; 00209 00210 virtual XalanNode* 00211 getNextSibling() const; 00212 00213 virtual const XalanNamedNodeMap* 00214 getAttributes() const; 00215 00216 virtual XalanDocument* 00217 getOwnerDocument() const; 00218 00219 #if defined(XALAN_NO_COVARIANT_RETURN_TYPE) 00220 virtual XalanNode* 00221 #else 00222 virtual XalanSourceTreeDocument* 00223 #endif 00224 cloneNode(bool deep) const; 00225 00226 virtual XalanNode* 00227 insertBefore( 00228 XalanNode* newChild, 00229 XalanNode* refChild); 00230 00231 virtual XalanNode* 00232 replaceChild( 00233 XalanNode* newChild, 00234 XalanNode* oldChild); 00235 00236 virtual XalanNode* 00237 removeChild(XalanNode* oldChild); 00238 00239 virtual XalanNode* 00240 appendChild(XalanNode* newChild); 00241 00242 virtual bool 00243 hasChildNodes() const; 00244 00245 virtual void 00246 setNodeValue(const XalanDOMString& nodeValue); 00247 00248 virtual void 00249 normalize(); 00250 00251 virtual bool 00252 supports( 00253 const XalanDOMString& feature, 00254 const XalanDOMString& version) const; 00255 00256 virtual const XalanDOMString& 00257 getNamespaceURI() const; 00258 00259 virtual const XalanDOMString& 00260 getPrefix() const; 00261 00262 virtual const XalanDOMString& 00263 getLocalName() const; 00264 00265 virtual void 00266 setPrefix(const XalanDOMString& prefix); 00267 00268 virtual bool 00269 isIndexed() const; 00270 00271 virtual unsigned long 00272 getIndex() const; 00273 00274 virtual XalanElement* 00275 createElement(const XalanDOMString& tagName); 00276 00277 virtual XalanDocumentFragment* 00278 createDocumentFragment(); 00279 00280 virtual XalanText* 00281 createTextNode(const XalanDOMString& data); 00282 00283 virtual XalanComment* 00284 createComment(const XalanDOMString& data); 00285 00286 virtual XalanCDATASection* 00287 createCDATASection(const XalanDOMString& data); 00288 00289 virtual XalanProcessingInstruction* 00290 createProcessingInstruction( 00291 const XalanDOMString& target, 00292 const XalanDOMString& data); 00293 00294 virtual XalanAttr* 00295 createAttribute(const XalanDOMString& name); 00296 00297 virtual XalanEntityReference* 00298 createEntityReference(const XalanDOMString& name); 00299 00300 virtual XalanDocumentType* 00301 getDoctype() const; 00302 00303 virtual XalanDOMImplementation* 00304 getImplementation() const; 00305 00306 virtual XalanElement* 00307 getDocumentElement() const; 00308 00309 virtual XalanNodeList* 00310 getElementsByTagName(const XalanDOMString& tagname) const; 00311 00312 virtual XalanNode* 00313 importNode( 00314 XalanNode* importedNode, 00315 bool deep); 00316 00317 virtual XalanElement* 00318 createElementNS( 00319 const XalanDOMString& namespaceURI, 00320 const XalanDOMString& qualifiedName); 00321 00322 virtual XalanAttr* 00323 createAttributeNS( 00324 const XalanDOMString& namespaceURI, 00325 const XalanDOMString& qualifiedName); 00326 00327 virtual XalanNodeList* 00328 getElementsByTagNameNS( 00329 const XalanDOMString& namespaceURI, 00330 const XalanDOMString& localName) const; 00331 00332 virtual XalanElement* 00333 getElementById(const XalanDOMString& elementId) const; 00334 00335 virtual unsigned long 00336 getNumber() const; 00337 00338 00339 // Interfaces not inherited from XalanDocument... 00340 00341 XalanSourceTreeElement* 00342 createElementNode( 00343 const XalanDOMChar* name, 00344 const AttributeList& attrs, 00345 XalanNode* theParentNode = 0, 00346 XalanNode* thePreviousSibling = 0, 00347 XalanNode* theNextSibling = 0, 00348 bool fAddXMLNamespaceAttribute = false); 00349 00350 XalanSourceTreeElement* 00351 createElementNode( 00352 const XalanDOMChar* uri, 00353 const XalanDOMChar* localname, 00354 const XalanDOMChar* qname, 00355 const Attributes& attrs, 00356 XalanNode* theParentNode = 0, 00357 XalanNode* thePreviousSibling = 0, 00358 XalanNode* theNextSibling = 0, 00359 bool fAddXMLNamespaceAttribute = false); 00360 00361 XalanSourceTreeElement* 00362 createElementNode( 00363 const XalanDOMChar* tagName, 00364 const AttributeList& attrs, 00365 const PrefixResolver& thePrefixResolver, 00366 XalanNode* theParentNode = 0, 00367 XalanNode* thePreviousSibling = 0, 00368 XalanNode* theNextSibling = 0, 00369 bool fAddXMLNamespaceAttribute = false); 00370 00371 XalanSourceTreeElement* 00372 createElementNode( 00373 const XalanDOMChar* name, 00374 const Attributes& attrs, 00375 XalanNode* theParentNode = 0, 00376 XalanNode* thePreviousSibling = 0, 00377 XalanNode* theNextSibling = 0, 00378 bool fAddXMLNamespaceAttribute = false); 00379 00380 XalanSourceTreeComment* 00381 createCommentNode( 00382 const XalanDOMChar* data, 00383 XalanDOMString::size_type length, 00384 XalanNode* theParentNode = 0, 00385 XalanNode* thePreviousSibling = 0, 00386 XalanNode* theNextSibling = 0); 00387 00388 XalanSourceTreeProcessingInstruction* 00389 createProcessingInstructionNode( 00390 const XalanDOMChar* target, 00391 const XalanDOMChar* data, 00392 XalanNode* theParentNode = 0, 00393 XalanNode* thePreviousSibling = 0, 00394 XalanNode* theNextSibling = 0); 00395 00396 XalanSourceTreeText* 00397 createTextNode( 00398 const XalanDOMChar* chars, 00399 XalanDOMString::size_type length, 00400 XalanNode* theParentNode = 0, 00401 XalanNode* thePreviousSibling = 0, 00402 XalanNode* theNextSibling = 0); 00403 00404 XalanSourceTreeText* 00405 createTextIWSNode( 00406 const XalanDOMChar* chars, 00407 XalanDOMString::size_type length, 00408 XalanNode* theParentNode = 0, 00409 XalanNode* thePreviousSibling = 0, 00410 XalanNode* theNextSibling = 0); 00411 00412 void 00413 unparsedEntityDeclaration( 00414 const XalanDOMChar* name, 00415 const XalanDOMChar* publicId, 00416 const XalanDOMChar* systemId, 00417 const XalanDOMChar* notationName); 00418 00419 const XalanDOMString& 00420 getUnparsedEntityURI(const XalanDOMString& theName) const; 00421 00422 // Child node setters... 00423 void 00424 appendChildNode(XalanSourceTreeComment* theChild); 00425 00426 void 00427 appendChildNode(XalanSourceTreeElement* theChild); 00428 00429 void 00430 appendChildNode(XalanSourceTreeProcessingInstruction* theChild); 00431 00432 private: 00433 00434 // Helper functions... 00435 XalanSourceTreeAttr* 00436 createAttribute( 00437 const XalanDOMChar* theName, 00438 const XalanDOMChar* theValue, 00439 XalanSourceTreeElement* theOwnerElement, 00440 const PrefixResolver& thePrefixResolver); 00441 00442 XalanSourceTreeAttr* 00443 createAttribute( 00444 const XalanDOMChar* theName, 00445 const XalanDOMChar* theValue, 00446 XalanSourceTreeElement* theOwnerElement); 00447 00448 XalanSourceTreeElement* 00449 createElementNode( 00450 const XalanDOMChar* theTagName, 00451 XalanSourceTreeAttr** theAttributeVector, 00452 AttributesCountType theAttributeCount, 00453 XalanNode* theParentNode, 00454 XalanNode* thePreviousSibling, 00455 XalanNode* theNextSibling, 00456 const PrefixResolver& thePrefixResolver); 00457 00458 void 00459 createAttributes( 00460 const Attributes& theAttributes, 00461 XalanSourceTreeAttr** theAttributeVector, 00462 XalanSourceTreeElement* theOwnerElement, 00463 bool fAddXMLNamespaceAttribute); 00464 00465 const XalanDOMString& 00466 getTextNodeString( 00467 const XalanDOMChar* chars, 00468 XalanDOMString::size_type length); 00469 00470 const XalanDOMString* 00471 getNamespaceForPrefix( 00472 const XalanDOMChar* theName, 00473 const PrefixResolver& thePrefixResolver, 00474 XalanDOMString& thePrefix, 00475 bool fUseDefault); 00476 00477 // Not implemented... 00478 XalanSourceTreeDocument(const XalanSourceTreeDocument& theSource); 00479 00480 XalanSourceTreeDocument& 00481 operator=(const XalanSourceTreeDocument& theRHS); 00482 00483 bool 00484 operator==(const XalanSourceTreeDocument& theRHS) const; 00485 00486 00487 // Data members... 00488 const unsigned long m_number; 00489 00490 XalanNode* m_firstChild; 00491 00492 XalanSourceTreeElement* m_documentElement; 00493 00494 XalanSourceTreeAttributeAllocator m_attributeAllocator; 00495 00496 XalanSourceTreeAttributeNSAllocator m_attributeNSAllocator; 00497 00498 XalanSourceTreeCommentAllocator m_commentAllocator; 00499 00500 XalanSourceTreeElementAllocator m_elementAllocator; 00501 00502 XalanSourceTreeElementNSAllocator m_elementNSAllocator; 00503 00504 XalanSourceTreeProcessingInstructionAllocator m_piAllocator; 00505 00506 XalanSourceTreeTextAllocator m_textAllocator; 00507 00508 XalanSourceTreeTextIWSAllocator m_textIWSAllocator; 00509 00510 XalanDOMStringPool m_namesStringPool; 00511 00512 XalanDOMStringPool m_valuesStringPool; 00513 00514 XalanSourceTreeAttributesVector m_attributesVector; 00515 00516 unsigned int m_nextIndexValue; 00517 00518 const bool m_poolAllText; 00519 00520 ElementByIDMapType m_elementsByID; 00521 00522 UnparsedEntityURIMapType m_unparsedEntityURIs; 00523 00524 StringCollectionType m_nonPooledStrings; 00525 00526 XalanDOMString m_stringBuffer; 00527 00528 static const XalanDOMString& s_nameString; 00529 }; 00530 00531 00532 00533 #endif // !defined(XALANSOURCETREEDOCUMENT_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.3 |
|