source: NonGTP/Xerces/xerces/include/xercesc/dom/DOMDocumentTraversal.hpp @ 358

Revision 358, 7.3 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1#ifndef DOMDocumentTraversal_HEADER_GUARD_
2#define DOMDocumentTraversal_HEADER_GUARD_
3
4/*
5 * Copyright 2002,2004 The Apache Software Foundation.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *      http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20/*
21 * $Id: DOMDocumentTraversal.hpp,v 1.7 2004/09/08 13:55:39 peiyongz Exp $
22*/
23
24#include <xercesc/util/XercesDefs.hpp>
25
26XERCES_CPP_NAMESPACE_BEGIN
27
28
29class DOMNode;
30class DOMNodeFilter;
31class DOMNodeIterator;
32class DOMTreeWalker;
33
34
35/**
36 * <code>DOMDocumentTraversal</code> contains methods that create
37 * <code>DOMNodeIterators</code> and <code>DOMTreeWalkers</code> to traverse a
38 * node and its children in document order (depth first, pre-order
39 * traversal, which is equivalent to the order in which the start tags occur
40 * in the text representation of the document). In DOMs which support the
41 * Traversal feature, <code>DOMDocumentTraversal</code> will be implemented by
42 * the same objects that implement the DOMDocument interface.
43 * <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>.
44 * @since DOM Level 2
45 */
46class CDOM_EXPORT DOMDocumentTraversal {
47
48protected:
49    // -----------------------------------------------------------------------
50    //  Hidden constructors
51    // -----------------------------------------------------------------------
52    /** @name Hidden constructors */
53    //@{   
54    DOMDocumentTraversal() {};
55    //@}
56
57private:
58    // -----------------------------------------------------------------------
59    // Unimplemented constructors and operators
60    // -----------------------------------------------------------------------
61    /** @name Unimplemented constructors and operators */
62    //@{
63    DOMDocumentTraversal(const DOMDocumentTraversal &);
64    DOMDocumentTraversal & operator = (const DOMDocumentTraversal &);
65    //@}
66
67public:
68    // -----------------------------------------------------------------------
69    //  All constructors are hidden, just the destructor is available
70    // -----------------------------------------------------------------------
71    /** @name Destructor */
72    //@{
73    /**
74     * Destructor
75     *
76     */
77    virtual ~DOMDocumentTraversal() {};
78    //@}
79
80    // -----------------------------------------------------------------------
81    //  Virtual DOMDocumentRange interface
82    // -----------------------------------------------------------------------
83    /** @name Functions introduced in DOM Level 2 */
84    //@{
85    /**
86     * Creates a NodeIterator object.   (DOM2)
87     *
88     * NodeIterators are used to step through a set of nodes, e.g. the set of nodes in a NodeList, the
89     * document subtree governed by a particular node, the results of a query, or any other set of nodes.
90     * The set of nodes to be iterated is determined by the implementation of the NodeIterator. DOM Level 2
91     * specifies a single NodeIterator implementation for document-order traversal of a document subtree.
92     * Instances of these iterators are created by calling <code>DOMDocumentTraversal.createNodeIterator()</code>.
93     *
94     * To produce a view of the document that has entity references expanded and does not
95     * expose the entity reference node itself, use the <code>whatToShow</code> flags to hide the entity
96     * reference node and set expandEntityReferences to true when creating the iterator. To
97     * produce a view of the document that has entity reference nodes but no entity expansion,
98     * use the <code>whatToShow</code> flags to show the entity reference node and set
99     * expandEntityReferences to false.
100     *
101     * @param root The root node of the DOM tree
102     * @param whatToShow This attribute determines which node types are presented via the iterator.
103     * @param filter The filter used to screen nodes
104     * @param entityReferenceExpansion The value of this flag determines whether the children of entity reference nodes are
105     *                   visible to the iterator. If false, they will be skipped over.
106     * @since DOM Level 2
107     */
108
109    virtual DOMNodeIterator *createNodeIterator(DOMNode         *root,
110                                                   unsigned long    whatToShow,
111                                                   DOMNodeFilter* filter,
112                                                   bool             entityReferenceExpansion) = 0;
113    /**
114     * Creates a TreeWalker object.   (DOM2)
115     *
116     * TreeWalker objects are used to navigate a document tree or subtree using the view of the document defined
117     * by its whatToShow flags and any filters that are defined for the TreeWalker. Any function which performs
118     * navigation using a TreeWalker will automatically support any view defined by a TreeWalker.
119     *
120     * Omitting nodes from the logical view of a subtree can result in a structure that is substantially different from
121     * the same subtree in the complete, unfiltered document. Nodes that are siblings in the TreeWalker view may
122     * be children of different, widely separated nodes in the original view. For instance, consider a Filter that skips
123     * all nodes except for DOMText nodes and the root node of a document. In the logical view that results, all text
124     * nodes will be siblings and appear as direct children of the root node, no matter how deeply nested the
125     * structure of the original document.
126     *
127     * To produce a view of the document that has entity references expanded
128     * and does not expose the entity reference node itself, use the whatToShow
129     * flags to hide the entity reference node and set <code>expandEntityReferences</code> to
130     * true when creating the TreeWalker. To produce a view of the document
131     * that has entity reference nodes but no entity expansion, use the
132     * <code>whatToShow</code> flags to show the entity reference node and set
133     * <code>expandEntityReferences</code> to false
134     *
135     * @param root The root node of the DOM tree
136     * @param whatToShow This attribute determines which node types are presented via the tree-walker.
137     * @param filter The filter used to screen nodes
138     * @param entityReferenceExpansion The value of this flag determines whether the children of entity reference nodes are
139     *                   visible to the tree-walker. If false, they will be skipped over.
140     * @since DOM Level 2
141     */
142
143    virtual DOMTreeWalker  *createTreeWalker(DOMNode        *root,
144                                               unsigned long     whatToShow,
145                                               DOMNodeFilter  *filter,
146                                               bool              entityReferenceExpansion) = 0;
147
148    //@}
149};
150
151
152XERCES_CPP_NAMESPACE_END
153
154#endif
Note: See TracBrowser for help on using the repository browser.