1 | #ifndef DOMDocumentTraversal_HEADER_GUARD_
|
---|
2 | #define DOMDocumentTraversal_HEADER_GUARD_
|
---|
3 |
|
---|
4 | /*
|
---|
5 | * The Apache Software License, Version 1.1
|
---|
6 | *
|
---|
7 | * Copyright (c) 2002 The Apache Software Foundation. All rights
|
---|
8 | * reserved.
|
---|
9 | *
|
---|
10 | * Redistribution and use in source and binary forms, with or without
|
---|
11 | * modification, are permitted provided that the following conditions
|
---|
12 | * are met:
|
---|
13 | *
|
---|
14 | * 1. Redistributions of source code must retain the above copyright
|
---|
15 | * notice, this list of conditions and the following disclaimer.
|
---|
16 | *
|
---|
17 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
18 | * notice, this list of conditions and the following disclaimer in
|
---|
19 | * the documentation and/or other materials provided with the
|
---|
20 | * distribution.
|
---|
21 | *
|
---|
22 | * 3. The end-user documentation included with the redistribution,
|
---|
23 | * if any, must include the following acknowledgment:
|
---|
24 | * "This product includes software developed by the
|
---|
25 | * Apache Software Foundation (http://www.apache.org/)."
|
---|
26 | * Alternately, this acknowledgment may appear in the software itself,
|
---|
27 | * if and wherever such third-party acknowledgments normally appear.
|
---|
28 | *
|
---|
29 | * 4. The names "Xerces" and "Apache Software Foundation" must
|
---|
30 | * not be used to endorse or promote products derived from this
|
---|
31 | * software without prior written permission. For written
|
---|
32 | * permission, please contact apache\@apache.org.
|
---|
33 | *
|
---|
34 | * 5. Products derived from this software may not be called "Apache",
|
---|
35 | * nor may "Apache" appear in their name, without prior written
|
---|
36 | * permission of the Apache Software Foundation.
|
---|
37 | *
|
---|
38 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
---|
39 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
40 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
41 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
---|
42 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
43 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
44 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
---|
45 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
46 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
47 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
---|
48 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
49 | * SUCH DAMAGE.
|
---|
50 | * ====================================================================
|
---|
51 | *
|
---|
52 | * This software consists of voluntary contributions made by many
|
---|
53 | * individuals on behalf of the Apache Software Foundation, and was
|
---|
54 | * originally based on software copyright (c) 2002, International
|
---|
55 | * Business Machines, Inc., http://www.ibm.com . For more information
|
---|
56 | * on the Apache Software Foundation, please see
|
---|
57 | * <http://www.apache.org/>.
|
---|
58 | */
|
---|
59 |
|
---|
60 | /*
|
---|
61 | * $Id: DOMDocumentTraversal.hpp,v 1.6 2003/03/07 19:59:02 tng Exp $
|
---|
62 | */
|
---|
63 |
|
---|
64 | #include <xercesc/util/XercesDefs.hpp>
|
---|
65 |
|
---|
66 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
67 |
|
---|
68 |
|
---|
69 | class DOMNode;
|
---|
70 | class DOMNodeFilter;
|
---|
71 | class DOMNodeIterator;
|
---|
72 | class DOMTreeWalker;
|
---|
73 |
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * <code>DOMDocumentTraversal</code> contains methods that create
|
---|
77 | * <code>DOMNodeIterators</code> and <code>DOMTreeWalkers</code> to traverse a
|
---|
78 | * node and its children in document order (depth first, pre-order
|
---|
79 | * traversal, which is equivalent to the order in which the start tags occur
|
---|
80 | * in the text representation of the document). In DOMs which support the
|
---|
81 | * Traversal feature, <code>DOMDocumentTraversal</code> will be implemented by
|
---|
82 | * the same objects that implement the DOMDocument interface.
|
---|
83 | * <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>.
|
---|
84 | * @since DOM Level 2
|
---|
85 | */
|
---|
86 | class CDOM_EXPORT DOMDocumentTraversal {
|
---|
87 |
|
---|
88 | protected:
|
---|
89 | // -----------------------------------------------------------------------
|
---|
90 | // Hidden constructors
|
---|
91 | // -----------------------------------------------------------------------
|
---|
92 | /** @name Hidden constructors */
|
---|
93 | //@{
|
---|
94 | DOMDocumentTraversal() {};
|
---|
95 | //@}
|
---|
96 |
|
---|
97 | private:
|
---|
98 | // -----------------------------------------------------------------------
|
---|
99 | // Unimplemented constructors and operators
|
---|
100 | // -----------------------------------------------------------------------
|
---|
101 | /** @name Unimplemented constructors and operators */
|
---|
102 | //@{
|
---|
103 | DOMDocumentTraversal(const DOMDocumentTraversal &);
|
---|
104 | DOMDocumentTraversal & operator = (const DOMDocumentTraversal &);
|
---|
105 | //@}
|
---|
106 |
|
---|
107 | public:
|
---|
108 | // -----------------------------------------------------------------------
|
---|
109 | // All constructors are hidden, just the destructor is available
|
---|
110 | // -----------------------------------------------------------------------
|
---|
111 | /** @name Destructor */
|
---|
112 | //@{
|
---|
113 | /**
|
---|
114 | * Destructor
|
---|
115 | *
|
---|
116 | */
|
---|
117 | virtual ~DOMDocumentTraversal() {};
|
---|
118 | //@}
|
---|
119 |
|
---|
120 | // -----------------------------------------------------------------------
|
---|
121 | // Virtual DOMDocumentRange interface
|
---|
122 | // -----------------------------------------------------------------------
|
---|
123 | /** @name Functions introduced in DOM Level 2 */
|
---|
124 | //@{
|
---|
125 | /**
|
---|
126 | * Creates a NodeIterator object. (DOM2)
|
---|
127 | *
|
---|
128 | * NodeIterators are used to step through a set of nodes, e.g. the set of nodes in a NodeList, the
|
---|
129 | * document subtree governed by a particular node, the results of a query, or any other set of nodes.
|
---|
130 | * The set of nodes to be iterated is determined by the implementation of the NodeIterator. DOM Level 2
|
---|
131 | * specifies a single NodeIterator implementation for document-order traversal of a document subtree.
|
---|
132 | * Instances of these iterators are created by calling <code>DOMDocumentTraversal.createNodeIterator()</code>.
|
---|
133 | *
|
---|
134 | * To produce a view of the document that has entity references expanded and does not
|
---|
135 | * expose the entity reference node itself, use the <code>whatToShow</code> flags to hide the entity
|
---|
136 | * reference node and set expandEntityReferences to true when creating the iterator. To
|
---|
137 | * produce a view of the document that has entity reference nodes but no entity expansion,
|
---|
138 | * use the <code>whatToShow</code> flags to show the entity reference node and set
|
---|
139 | * expandEntityReferences to false.
|
---|
140 | *
|
---|
141 | * @param root The root node of the DOM tree
|
---|
142 | * @param whatToShow This attribute determines which node types are presented via the iterator.
|
---|
143 | * @param filter The filter used to screen nodes
|
---|
144 | * @param entityReferenceExpansion The value of this flag determines whether the children of entity reference nodes are
|
---|
145 | * visible to the iterator. If false, they will be skipped over.
|
---|
146 | * @since DOM Level 2
|
---|
147 | */
|
---|
148 |
|
---|
149 | virtual DOMNodeIterator *createNodeIterator(DOMNode *root,
|
---|
150 | unsigned long whatToShow,
|
---|
151 | DOMNodeFilter* filter,
|
---|
152 | bool entityReferenceExpansion) = 0;
|
---|
153 | /**
|
---|
154 | * Creates a TreeWalker object. (DOM2)
|
---|
155 | *
|
---|
156 | * TreeWalker objects are used to navigate a document tree or subtree using the view of the document defined
|
---|
157 | * by its whatToShow flags and any filters that are defined for the TreeWalker. Any function which performs
|
---|
158 | * navigation using a TreeWalker will automatically support any view defined by a TreeWalker.
|
---|
159 | *
|
---|
160 | * Omitting nodes from the logical view of a subtree can result in a structure that is substantially different from
|
---|
161 | * the same subtree in the complete, unfiltered document. Nodes that are siblings in the TreeWalker view may
|
---|
162 | * be children of different, widely separated nodes in the original view. For instance, consider a Filter that skips
|
---|
163 | * all nodes except for DOMText nodes and the root node of a document. In the logical view that results, all text
|
---|
164 | * nodes will be siblings and appear as direct children of the root node, no matter how deeply nested the
|
---|
165 | * structure of the original document.
|
---|
166 | *
|
---|
167 | * To produce a view of the document that has entity references expanded
|
---|
168 | * and does not expose the entity reference node itself, use the whatToShow
|
---|
169 | * flags to hide the entity reference node and set <code>expandEntityReferences</code> to
|
---|
170 | * true when creating the TreeWalker. To produce a view of the document
|
---|
171 | * that has entity reference nodes but no entity expansion, use the
|
---|
172 | * <code>whatToShow</code> flags to show the entity reference node and set
|
---|
173 | * <code>expandEntityReferences</code> to false
|
---|
174 | *
|
---|
175 | * @param root The root node of the DOM tree
|
---|
176 | * @param whatToShow This attribute determines which node types are presented via the tree-walker.
|
---|
177 | * @param filter The filter used to screen nodes
|
---|
178 | * @param entityReferenceExpansion The value of this flag determines whether the children of entity reference nodes are
|
---|
179 | * visible to the tree-walker. If false, they will be skipped over.
|
---|
180 | * @since DOM Level 2
|
---|
181 | */
|
---|
182 |
|
---|
183 | virtual DOMTreeWalker *createTreeWalker(DOMNode *root,
|
---|
184 | unsigned long whatToShow,
|
---|
185 | DOMNodeFilter *filter,
|
---|
186 | bool entityReferenceExpansion) = 0;
|
---|
187 |
|
---|
188 | //@}
|
---|
189 | };
|
---|
190 |
|
---|
191 |
|
---|
192 | XERCES_CPP_NAMESPACE_END
|
---|
193 |
|
---|
194 | #endif
|
---|