|
||||
File indexing completed on 2025-01-18 10:14:50
0001 /* 0002 * Licensed to the Apache Software Foundation (ASF) under one or more 0003 * contributor license agreements. See the NOTICE file distributed with 0004 * this work for additional information regarding copyright ownership. 0005 * The ASF licenses this file to You under the Apache License, Version 2.0 0006 * (the "License"); you may not use this file except in compliance with 0007 * the License. You may obtain a copy of the License at 0008 * 0009 * http://www.apache.org/licenses/LICENSE-2.0 0010 * 0011 * Unless required by applicable law or agreed to in writing, software 0012 * distributed under the License is distributed on an "AS IS" BASIS, 0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0014 * See the License for the specific language governing permissions and 0015 * limitations under the License. 0016 */ 0017 0018 /* 0019 * $Id$ 0020 */ 0021 0022 #if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTTRAVERSAL_HPP) 0023 #define XERCESC_INCLUDE_GUARD_DOMDOCUMENTTRAVERSAL_HPP 0024 0025 #include <xercesc/util/XercesDefs.hpp> 0026 #include <xercesc/dom/DOMNodeFilter.hpp> 0027 0028 XERCES_CPP_NAMESPACE_BEGIN 0029 0030 0031 class DOMNode; 0032 class DOMNodeIterator; 0033 class DOMTreeWalker; 0034 0035 0036 /** 0037 * <code>DOMDocumentTraversal</code> contains methods that create 0038 * <code>DOMNodeIterators</code> and <code>DOMTreeWalkers</code> to traverse a 0039 * node and its children in document order (depth first, pre-order 0040 * traversal, which is equivalent to the order in which the start tags occur 0041 * in the text representation of the document). In DOMs which support the 0042 * Traversal feature, <code>DOMDocumentTraversal</code> will be implemented by 0043 * the same objects that implement the DOMDocument interface. 0044 * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>. 0045 * @since DOM Level 2 0046 */ 0047 class CDOM_EXPORT DOMDocumentTraversal { 0048 0049 protected: 0050 // ----------------------------------------------------------------------- 0051 // Hidden constructors 0052 // ----------------------------------------------------------------------- 0053 /** @name Hidden constructors */ 0054 //@{ 0055 DOMDocumentTraversal() {}; 0056 //@} 0057 0058 private: 0059 // ----------------------------------------------------------------------- 0060 // Unimplemented constructors and operators 0061 // ----------------------------------------------------------------------- 0062 /** @name Unimplemented constructors and operators */ 0063 //@{ 0064 DOMDocumentTraversal(const DOMDocumentTraversal &); 0065 DOMDocumentTraversal & operator = (const DOMDocumentTraversal &); 0066 //@} 0067 0068 public: 0069 // ----------------------------------------------------------------------- 0070 // All constructors are hidden, just the destructor is available 0071 // ----------------------------------------------------------------------- 0072 /** @name Destructor */ 0073 //@{ 0074 /** 0075 * Destructor 0076 * 0077 */ 0078 virtual ~DOMDocumentTraversal() {}; 0079 //@} 0080 0081 // ----------------------------------------------------------------------- 0082 // Virtual DOMDocumentRange interface 0083 // ----------------------------------------------------------------------- 0084 /** @name Functions introduced in DOM Level 2 */ 0085 //@{ 0086 /** 0087 * Creates a NodeIterator object. (DOM2) 0088 * 0089 * NodeIterators are used to step through a set of nodes, e.g. the set of nodes in a NodeList, the 0090 * document subtree governed by a particular node, the results of a query, or any other set of nodes. 0091 * The set of nodes to be iterated is determined by the implementation of the NodeIterator. DOM Level 2 0092 * specifies a single NodeIterator implementation for document-order traversal of a document subtree. 0093 * Instances of these iterators are created by calling <code>DOMDocumentTraversal.createNodeIterator()</code>. 0094 * 0095 * To produce a view of the document that has entity references expanded and does not 0096 * expose the entity reference node itself, use the <code>whatToShow</code> flags to hide the entity 0097 * reference node and set expandEntityReferences to true when creating the iterator. To 0098 * produce a view of the document that has entity reference nodes but no entity expansion, 0099 * use the <code>whatToShow</code> flags to show the entity reference node and set 0100 * expandEntityReferences to false. 0101 * 0102 * @param root The root node of the DOM tree 0103 * @param whatToShow This attribute determines which node types are presented via the iterator. 0104 * @param filter The filter used to screen nodes 0105 * @param entityReferenceExpansion The value of this flag determines whether the children of entity reference nodes are 0106 * visible to the iterator. If false, they will be skipped over. 0107 * @since DOM Level 2 0108 */ 0109 0110 virtual DOMNodeIterator *createNodeIterator(DOMNode* root, 0111 DOMNodeFilter::ShowType whatToShow, 0112 DOMNodeFilter* filter, 0113 bool entityReferenceExpansion) = 0; 0114 /** 0115 * Creates a TreeWalker object. (DOM2) 0116 * 0117 * TreeWalker objects are used to navigate a document tree or subtree using the view of the document defined 0118 * by its whatToShow flags and any filters that are defined for the TreeWalker. Any function which performs 0119 * navigation using a TreeWalker will automatically support any view defined by a TreeWalker. 0120 * 0121 * Omitting nodes from the logical view of a subtree can result in a structure that is substantially different from 0122 * the same subtree in the complete, unfiltered document. Nodes that are siblings in the TreeWalker view may 0123 * be children of different, widely separated nodes in the original view. For instance, consider a Filter that skips 0124 * all nodes except for DOMText nodes and the root node of a document. In the logical view that results, all text 0125 * nodes will be siblings and appear as direct children of the root node, no matter how deeply nested the 0126 * structure of the original document. 0127 * 0128 * To produce a view of the document that has entity references expanded 0129 * and does not expose the entity reference node itself, use the whatToShow 0130 * flags to hide the entity reference node and set <code>expandEntityReferences</code> to 0131 * true when creating the TreeWalker. To produce a view of the document 0132 * that has entity reference nodes but no entity expansion, use the 0133 * <code>whatToShow</code> flags to show the entity reference node and set 0134 * <code>expandEntityReferences</code> to false 0135 * 0136 * @param root The root node of the DOM tree 0137 * @param whatToShow This attribute determines which node types are presented via the tree-walker. 0138 * @param filter The filter used to screen nodes 0139 * @param entityReferenceExpansion The value of this flag determines whether the children of entity reference nodes are 0140 * visible to the tree-walker. If false, they will be skipped over. 0141 * @since DOM Level 2 0142 */ 0143 0144 virtual DOMTreeWalker *createTreeWalker(DOMNode* root, 0145 DOMNodeFilter::ShowType whatToShow, 0146 DOMNodeFilter* filter, 0147 bool entityReferenceExpansion) = 0; 0148 0149 //@} 0150 }; 0151 0152 0153 XERCES_CPP_NAMESPACE_END 0154 0155 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |