Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.8

Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

XalanSourceTreeDocument.hpp

Go to the documentation of this file.
00001 /* 00002 * Copyright 1999-2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #if !defined(XALANSOURCETREEDOCUMENT_HEADER_GUARD_1357924680) 00017 #define XALANSOURCETREEDOCUMENT_HEADER_GUARD_1357924680 00018 00019 00020 00021 #include <xalanc/XalanSourceTree/XalanSourceTreeDefinitions.hpp> 00022 00023 00024 00025 #include <deque> 00026 #include <map> 00027 00028 00029 00030 #include <xalanc/XalanDOM/XalanDocument.hpp> 00031 00032 00033 00034 #include <xalanc/Include/STLHelper.hpp> 00035 00036 00037 00038 #include <xalanc/PlatformSupport/XalanArrayAllocator.hpp> 00039 #include <xalanc/PlatformSupport/XalanDOMStringPool.hpp> 00040 00041 00042 00043 #include <xalanc/XalanSourceTree/XalanSourceTreeAttributeAllocator.hpp> 00044 #include <xalanc/XalanSourceTree/XalanSourceTreeAttributeNSAllocator.hpp> 00045 #include <xalanc/XalanSourceTree/XalanSourceTreeCommentAllocator.hpp> 00046 #include <xalanc/XalanSourceTree/XalanSourceTreeElementAAllocator.hpp> 00047 #include <xalanc/XalanSourceTree/XalanSourceTreeElementANSAllocator.hpp> 00048 #include <xalanc/XalanSourceTree/XalanSourceTreeElementNAAllocator.hpp> 00049 #include <xalanc/XalanSourceTree/XalanSourceTreeElementNANSAllocator.hpp> 00050 #include <xalanc/XalanSourceTree/XalanSourceTreeProcessingInstructionAllocator.hpp> 00051 #include <xalanc/XalanSourceTree/XalanSourceTreeTextAllocator.hpp> 00052 #include <xalanc/XalanSourceTree/XalanSourceTreeTextIWSAllocator.hpp> 00053 00054 00055 00056 XALAN_DECLARE_XERCES_CLASS(Attributes) 00057 XALAN_DECLARE_XERCES_CLASS(AttributeList) 00058 00059 00060 00061 XALAN_CPP_NAMESPACE_BEGIN 00062 00063 00064 00065 typedef XERCES_CPP_NAMESPACE_QUALIFIER Attributes AttributesType; 00066 typedef XERCES_CPP_NAMESPACE_QUALIFIER AttributeList AttributeListType; 00067 00068 00069 00070 class PrefixResolver; 00071 class XalanSourceTreeAttr; 00072 00073 00074 00075 class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeDocument : public XalanDocument 00076 { 00077 public: 00078 00079 typedef XalanSourceTreeElementA::AttributesCountType AttributesCountType; 00080 typedef XalanArrayAllocator<XalanSourceTreeAttr*> AttributesArrayAllocatorType; 00081 00082 #if defined(XALAN_NO_STD_NAMESPACE) 00083 typedef map< 00084 const XalanDOMChar*, 00085 XalanSourceTreeElement*, 00086 less_null_terminated_arrays<XalanDOMChar> > ElementByIDMapType; 00087 00088 typedef map< 00089 XalanDOMString, 00090 XalanDOMString, 00091 less<XalanDOMString> > UnparsedEntityURIMapType; 00092 00093 typedef deque<XalanDOMString> StringCollectionType; 00094 #else 00095 typedef std::map< 00096 const XalanDOMChar*, 00097 XalanSourceTreeElement*, 00098 less_null_terminated_arrays<XalanDOMChar> > ElementByIDMapType; 00099 00100 typedef std::map< 00101 XalanDOMString, 00102 XalanDOMString> UnparsedEntityURIMapType; 00103 00104 typedef std::deque<XalanDOMString> StringCollectionType; 00105 #endif 00106 00110 static void 00111 initialize(); 00112 00116 static void 00117 terminate(); 00118 00119 00120 enum { eDefaultAttributeAllocatorBlockSize = 100, 00121 eDefaultAttributeNSAllocatorBlockSize = 50, 00122 eDefaultCommentAllocatorBlockSize = 10, 00123 eDefaultElementAllocatorBlockSize = 100, 00124 eDefaultElementNSAllocatorBlockSize = 100, 00125 eDefaultPIAllocatorBlockSize = 10, 00126 eDefaultTextAllocatorBlockSize = 100, 00127 eDefaultTextIWSAllocatorBlockSize = 100, 00128 eDefaultNamesStringPoolBlockSize = XalanDOMStringPool::eDefaultBlockSize, 00129 eDefaultNamesStringPoolBucketCount = XalanDOMStringPool::eDefaultBucketCount, 00130 eDefaultNamesStringPoolBucketSize = XalanDOMStringPool::eDefaultBucketSize, 00131 eDefaultValuesStringPoolBlockSize = XalanDOMStringPool::eDefaultBlockSize, 00132 eDefaultValuesStringPoolBucketCount = 997, 00133 eDefaultValuesStringPoolBucketSize = XalanDOMStringPool::eDefaultBucketSize }; 00134 00135 00136 typedef XalanSourceTreeAttributeAllocator::size_type allocator_size_type; 00137 typedef XalanDOMStringPool::block_size_type block_size_type; 00138 typedef XalanDOMStringPool::bucket_count_type bucket_count_type; 00139 typedef XalanDOMStringPool::bucket_size_type bucket_size_type; 00140 00154 XalanSourceTreeDocument( 00155 bool fPoolAllText = true, 00156 block_size_type theNamesStringPoolBlockSize = eDefaultNamesStringPoolBlockSize, 00157 bucket_count_type theNamesStringPoolBucketCount = eDefaultNamesStringPoolBucketCount, 00158 bucket_size_type theNamesStringPoolBucketSize = eDefaultNamesStringPoolBucketSize, 00159 block_size_type theValuesStringPoolBlockSize = eDefaultValuesStringPoolBlockSize, 00160 bucket_count_type theValuesStringPoolBucketCount = eDefaultValuesStringPoolBucketCount, 00161 bucket_size_type theValuesStringPoolBucketSize = eDefaultValuesStringPoolBucketSize); 00162 00177 XalanSourceTreeDocument( 00178 allocator_size_type theAttributeBlockSize, 00179 allocator_size_type theAttributeNSBlockSize, 00180 allocator_size_type theCommentBlockSize, 00181 allocator_size_type theElementBlockSize, 00182 allocator_size_type theElementNSBlockSize, 00183 allocator_size_type thePIBlockSize, 00184 allocator_size_type theTextBlockSize, 00185 allocator_size_type theTextIWSBlockSize, 00186 bool fPoolAllText = true); 00187 00188 virtual 00189 ~XalanSourceTreeDocument(); 00190 00191 // These interfaces are inherited from XalanNode... 00192 00193 virtual const XalanDOMString& 00194 getNodeName() const; 00195 00196 virtual const XalanDOMString& 00197 getNodeValue() const; 00198 00199 virtual NodeType 00200 getNodeType() const; 00201 00202 virtual XalanNode* 00203 getParentNode() const; 00204 00205 virtual const XalanNodeList* 00206 getChildNodes() const; 00207 00208 virtual XalanNode* 00209 getFirstChild() const; 00210 00211 virtual XalanNode* 00212 getLastChild() const; 00213 00214 virtual XalanNode* 00215 getPreviousSibling() const; 00216 00217 virtual XalanNode* 00218 getNextSibling() const; 00219 00220 virtual const XalanNamedNodeMap* 00221 getAttributes() const; 00222 00223 virtual XalanDocument* 00224 getOwnerDocument() const; 00225 00226 #if defined(XALAN_NO_COVARIANT_RETURN_TYPE) 00227 virtual XalanNode* 00228 #else 00229 virtual XalanSourceTreeDocument* 00230 #endif 00231 cloneNode(bool deep) const; 00232 00233 virtual XalanNode* 00234 insertBefore( 00235 XalanNode* newChild, 00236 XalanNode* refChild); 00237 00238 virtual XalanNode* 00239 replaceChild( 00240 XalanNode* newChild, 00241 XalanNode* oldChild); 00242 00243 virtual XalanNode* 00244 removeChild(XalanNode* oldChild); 00245 00246 virtual XalanNode* 00247 appendChild(XalanNode* newChild); 00248 00249 virtual bool 00250 hasChildNodes() const; 00251 00252 virtual void 00253 setNodeValue(const XalanDOMString& nodeValue); 00254 00255 virtual void 00256 normalize(); 00257 00258 virtual bool 00259 isSupported( 00260 const XalanDOMString& feature, 00261 const XalanDOMString& version) const; 00262 00263 virtual const XalanDOMString& 00264 getNamespaceURI() const; 00265 00266 virtual const XalanDOMString& 00267 getPrefix() const; 00268 00269 virtual const XalanDOMString& 00270 getLocalName() const; 00271 00272 virtual void 00273 setPrefix(const XalanDOMString& prefix); 00274 00275 virtual bool 00276 isIndexed() const; 00277 00278 virtual IndexType 00279 getIndex() const; 00280 00281 virtual XalanElement* 00282 createElement(const XalanDOMString& tagName); 00283 00284 virtual XalanDocumentFragment* 00285 createDocumentFragment(); 00286 00287 virtual XalanText* 00288 createTextNode(const XalanDOMString& data); 00289 00290 virtual XalanComment* 00291 createComment(const XalanDOMString& data); 00292 00293 virtual XalanCDATASection* 00294 createCDATASection(const XalanDOMString& data); 00295 00296 virtual XalanProcessingInstruction* 00297 createProcessingInstruction( 00298 const XalanDOMString& target, 00299 const XalanDOMString& data); 00300 00301 virtual XalanAttr* 00302 createAttribute(const XalanDOMString& name); 00303 00304 virtual XalanEntityReference* 00305 createEntityReference(const XalanDOMString& name); 00306 00307 virtual XalanDocumentType* 00308 getDoctype() const; 00309 00310 virtual XalanDOMImplementation* 00311 getImplementation() const; 00312 00313 virtual XalanElement* 00314 getDocumentElement() const; 00315 00316 virtual XalanNodeList* 00317 getElementsByTagName(const XalanDOMString& tagname) const; 00318 00319 virtual XalanNode* 00320 importNode( 00321 XalanNode* importedNode, 00322 bool deep); 00323 00324 virtual XalanElement* 00325 createElementNS( 00326 const XalanDOMString& namespaceURI, 00327 const XalanDOMString& qualifiedName); 00328 00329 virtual XalanAttr* 00330 createAttributeNS( 00331 const XalanDOMString& namespaceURI, 00332 const XalanDOMString& qualifiedName); 00333 00334 virtual XalanNodeList* 00335 getElementsByTagNameNS( 00336 const XalanDOMString& namespaceURI, 00337 const XalanDOMString& localName) const; 00338 00339 virtual XalanElement* 00340 getElementById(const XalanDOMString& elementId) const; 00341 00342 00343 // Interfaces not inherited from XalanDocument... 00344 00345 XalanSourceTreeElement* 00346 createElementNode( 00347 const XalanDOMChar* name, 00348 const AttributeListType& attrs, 00349 XalanNode* theParentNode = 0, 00350 XalanNode* thePreviousSibling = 0, 00351 XalanNode* theNextSibling = 0, 00352 bool fAddXMLNamespaceAttribute = false); 00353 00354 XalanSourceTreeElement* 00355 createElementNode( 00356 const XalanDOMChar* uri, 00357 const XalanDOMChar* localname, 00358 const XalanDOMChar* qname, 00359 const AttributesType& attrs, 00360 XalanNode* theParentNode = 0, 00361 XalanNode* thePreviousSibling = 0, 00362 XalanNode* theNextSibling = 0, 00363 bool fAddXMLNamespaceAttribute = false); 00364 00365 XalanSourceTreeElement* 00366 createElementNode( 00367 const XalanDOMChar* tagName, 00368 const AttributeListType& attrs, 00369 const PrefixResolver& thePrefixResolver, 00370 XalanNode* theParentNode = 0, 00371 XalanNode* thePreviousSibling = 0, 00372 XalanNode* theNextSibling = 0, 00373 bool fAddXMLNamespaceAttribute = false); 00374 00375 XalanSourceTreeElement* 00376 createElementNode( 00377 const XalanDOMChar* name, 00378 const AttributesType& attrs, 00379 XalanNode* theParentNode = 0, 00380 XalanNode* thePreviousSibling = 0, 00381 XalanNode* theNextSibling = 0, 00382 bool fAddXMLNamespaceAttribute = false); 00383 00384 XalanSourceTreeComment* 00385 createCommentNode( 00386 const XalanDOMChar* data, 00387 XalanDOMString::size_type length, 00388 XalanNode* theParentNode = 0, 00389 XalanNode* thePreviousSibling = 0, 00390 XalanNode* theNextSibling = 0); 00391 00392 XalanSourceTreeProcessingInstruction* 00393 createProcessingInstructionNode( 00394 const XalanDOMChar* target, 00395 const XalanDOMChar* data, 00396 XalanNode* theParentNode = 0, 00397 XalanNode* thePreviousSibling = 0, 00398 XalanNode* theNextSibling = 0); 00399 00400 XalanSourceTreeText* 00401 createTextNode( 00402 const XalanDOMChar* chars, 00403 XalanDOMString::size_type length, 00404 XalanNode* theParentNode = 0, 00405 XalanNode* thePreviousSibling = 0, 00406 XalanNode* theNextSibling = 0); 00407 00408 XalanSourceTreeText* 00409 createTextIWSNode( 00410 const XalanDOMChar* chars, 00411 XalanDOMString::size_type length, 00412 XalanNode* theParentNode = 0, 00413 XalanNode* thePreviousSibling = 0, 00414 XalanNode* theNextSibling = 0); 00415 00416 void 00417 unparsedEntityDeclaration( 00418 const XalanDOMChar* name, 00419 const XalanDOMChar* publicId, 00420 const XalanDOMChar* systemId, 00421 const XalanDOMChar* notationName); 00422 00423 const XalanDOMString& 00424 getUnparsedEntityURI(const XalanDOMString& theName) const; 00425 00426 // Child node setters... 00427 void 00428 appendChildNode(XalanSourceTreeComment* theChild); 00429 00430 void 00431 appendChildNode(XalanSourceTreeElement* theChild); 00432 00433 void 00434 appendChildNode(XalanSourceTreeProcessingInstruction* theChild); 00435 00436 private: 00437 00438 // Helper functions... 00439 XalanSourceTreeAttr* 00440 createAttribute( 00441 const XalanDOMChar* theName, 00442 const XalanDOMChar* theValue, 00443 XalanSourceTreeElement* theOwnerElement, 00444 const PrefixResolver& thePrefixResolver); 00445 00446 XalanSourceTreeAttr* 00447 createAttribute( 00448 const XalanDOMChar* theName, 00449 const XalanDOMChar* theValue, 00450 XalanSourceTreeElement* theOwnerElement); 00451 00452 size_t 00453 createAttributes( 00454 XalanSourceTreeAttr** theAttributeVector, 00455 const AttributeListType& attrs, 00456 size_t theStartIndex, 00457 XalanSourceTreeElement* theOwnerElement, 00458 bool fCreateNamespaces, 00459 const PrefixResolver* thePrefixResolver = 0); 00460 00461 XalanSourceTreeElement* 00462 createElementNode( 00463 const XalanDOMChar* theTagName, 00464 XalanSourceTreeAttr** theAttributeVector, 00465 AttributesCountType theAttributeCount, 00466 XalanNode* theParentNode, 00467 XalanNode* thePreviousSibling, 00468 XalanNode* theNextSibling, 00469 const PrefixResolver& thePrefixResolver); 00470 00471 size_t 00472 createAttributes( 00473 XalanSourceTreeAttr** theAttributeVector, 00474 const AttributesType& theAttributes, 00475 size_t theStartIndex, 00476 XalanSourceTreeElement* theOwnerElement, 00477 bool fCreateNamespaces); 00478 00479 void 00480 createAttributes( 00481 const AttributesType& theAttributes, 00482 XalanSourceTreeAttr** theAttributeVector, 00483 XalanSourceTreeElement* theOwnerElement, 00484 bool fAddXMLNamespaceAttribute); 00485 00486 const XalanDOMString& 00487 getTextNodeString( 00488 const XalanDOMChar* chars, 00489 XalanDOMString::size_type length); 00490 00491 const XalanDOMString* 00492 getNamespaceForPrefix( 00493 const XalanDOMChar* theName, 00494 const PrefixResolver& thePrefixResolver, 00495 XalanDOMString& thePrefix, 00496 bool fUseDefault, 00497 const XalanDOMChar** theLocalName = 0); 00498 00499 // Not implemented... 00500 XalanSourceTreeDocument(const XalanSourceTreeDocument& theSource); 00501 00502 XalanSourceTreeDocument& 00503 operator=(const XalanSourceTreeDocument& theRHS); 00504 00505 bool 00506 operator==(const XalanSourceTreeDocument& theRHS) const; 00507 00508 00509 // Data members... 00510 XalanNode* m_firstChild; 00511 00512 XalanSourceTreeElement* m_documentElement; 00513 00514 XalanSourceTreeAttributeAllocator m_attributeAllocator; 00515 00516 XalanSourceTreeAttributeNSAllocator m_attributeNSAllocator; 00517 00518 XalanSourceTreeCommentAllocator m_commentAllocator; 00519 00520 XalanSourceTreeElementAAllocator m_elementAAllocator; 00521 00522 XalanSourceTreeElementANSAllocator m_elementANSAllocator; 00523 00524 XalanSourceTreeElementNAAllocator m_elementNAAllocator; 00525 00526 XalanSourceTreeElementNANSAllocator m_elementNANSAllocator; 00527 00528 XalanSourceTreeProcessingInstructionAllocator m_piAllocator; 00529 00530 XalanSourceTreeTextAllocator m_textAllocator; 00531 00532 XalanSourceTreeTextIWSAllocator m_textIWSAllocator; 00533 00534 XalanDOMStringPool m_namesStringPool; 00535 00536 XalanDOMStringPool m_valuesStringPool; 00537 00538 AttributesArrayAllocatorType m_attributesVector; 00539 00540 IndexType m_nextIndexValue; 00541 00542 const bool m_poolAllText; 00543 00544 ElementByIDMapType m_elementsByID; 00545 00546 UnparsedEntityURIMapType m_unparsedEntityURIs; 00547 00548 StringCollectionType m_nonPooledStrings; 00549 00550 XalanDOMString m_stringBuffer; 00551 00552 static const XalanDOMString& s_nameString; 00553 }; 00554 00555 00556 00557 XALAN_CPP_NAMESPACE_END 00558 00559 00560 00561 #endif // !defined(XALANSOURCETREEDOCUMENT_HEADER_GUARD_1357924680)

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSLT Processor Version 1.8
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.