Xalan-C++ API Reference
1.12.0
xalanc
XercesParserLiaison
XercesDOMWalker.hpp
Go to the documentation of this file.
1
/*
2
* Licensed to the Apache Software Foundation (ASF) under one
3
* or more contributor license agreements. See the NOTICE file
4
* distributed with this work for additional information
5
* regarding copyright ownership. The ASF licenses this file
6
* to you under the Apache License, Version 2.0 (the "License");
7
* you may not use this file except in compliance with the License.
8
* You may obtain a copy of the License at
9
*
10
* http://www.apache.org/licenses/LICENSE-2.0
11
*
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an "AS IS" BASIS,
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
17
*/
18
#if !defined(XERCESDOMWALKER_HEADER_GUARD_1357924680)
19
#define XERCESDOMWALKER_HEADER_GUARD_1357924680
20
21
22
23
#include <
xalanc/XercesParserLiaison/XercesParserLiaisonDefinitions.hpp
>
24
#include <
xalanc/XercesParserLiaison/XercesWrapperTypes.hpp
>
25
26
27
28
namespace
XALAN_CPP_NAMESPACE
{
29
30
31
32
class
XALAN_XERCESPARSERLIAISON_EXPORT
XercesDOMWalker
33
{
34
public
:
35
36
/**
37
* Constructor.
38
*/
39
XercesDOMWalker
();
40
41
virtual
42
~
XercesDOMWalker
();
43
44
/**
45
* Perform a document-order traversal.
46
*
47
* Derived classes and stop the traversal by returning
48
* true from startNode() or endNode(). If that happens,
49
* the function will return the next node in document
50
* order. If desired, the caller can start traversing
51
* the tree again from that point. Note that terminal
52
* nodes will always have startNode() and endNode()
53
* called before the traversal terminates.
54
*
55
* @param pos The node in the tree with which to start the walk
56
*
57
* @return 0 if the traversal completes, or the next node if the traversal doesn't complete.
58
*/
59
const
DOMNodeType
*
60
traverse(
const
DOMNodeType
* pos);
61
62
/**
63
* Perform a document-order traversal.
64
*
65
* Derived classes and stop the traversal by returning
66
* true from startNode() or endNode(). If that happens,
67
* the function will return the next node in document
68
* order. If desired, the caller can start traversing
69
* the tree again from that point. Note that terminal
70
* nodes will always have startNode() and endNode()
71
* called before the traversal terminates.
72
*
73
* @param pos The node in the tree with which to start the walk
74
*
75
* @return 0 if the traversal completes, or the next node if the traversal doesn't complete.
76
*/
77
DOMNodeType
*
78
traverse(
DOMNodeType
* pos);
79
80
/**
81
* Perform a document-order traversal stopping at the
82
* provided parent node.
83
*
84
* Derived classes and stop the traversal by returning
85
* true from startNode() or endNode(). If that happens,
86
* the function will return the next node in document
87
* order. If desired, the caller can start traversing
88
* the tree again from that point. Note that terminal
89
* nodes will always have startNode() and endNode()
90
* called before the traversal terminates.
91
*
92
* @param pos The node in the tree with which to start the walk
93
* @param parent The parent of pos. Note that for multiple calls that continue the traversal, this node must remain the same.
94
*
95
* @return parent if the traversal completes, or the next node if the traversal doesn't complete.
96
*/
97
const
DOMNodeType
*
98
traverse(
99
const
DOMNodeType
* pos,
100
const
DOMNodeType
* parent);
101
102
/**
103
* Perform a document-order traversal stopping at the
104
* provided parent node.
105
*
106
* Derived classes and stop the traversal by returning
107
* true from startNode() or endNode(). If that happens,
108
* the function will return the next node in document
109
* order. If desired, the caller can start traversing
110
* the tree again from that point. Note that terminal
111
* nodes will always have startNode() and endNode()
112
* called before the traversal terminates.
113
*
114
* @param pos The node in the tree with which to start the walk
115
* @param parent The parent of pos. Note that for multiple calls that continue the traversal, this node must remain the same.
116
*
117
* @return parent if the traversal completes, or the next node if the traversal doesn't complete.
118
*/
119
DOMNodeType
*
120
traverse(
121
DOMNodeType
* pos,
122
DOMNodeType
* parent);
123
124
/**
125
* Perform a pre-order traversal.
126
*
127
* @param pos starting node
128
*/
129
void
130
traverseSubtree(
const
DOMNodeType
* pos);
131
132
/**
133
* Perform a document-order traversal.
134
*
135
* @param pos starting node
136
*/
137
void
138
traverseSubtree(
DOMNodeType
* pos);
139
140
protected
:
141
142
/**
143
* Called when first walking a node
144
*
145
* @param node The node
146
*
147
* @return return false if traversal should continue, or true if it should not.
148
*/
149
virtual
bool
150
startNode(
const
DOMNodeType
* node) = 0;
151
152
/**
153
* Called when first walking a node
154
*
155
* @param node The node
156
*
157
* @return return false if traversal should continue, or true if it should not.
158
*/
159
virtual
bool
160
startNode(
DOMNodeType
* node);
161
162
/**
163
* Called when leaving a node
164
*
165
* @param node The node
166
*
167
* @return return false if traversal should continue, or true if it should not.
168
*/
169
virtual
bool
170
endNode(
const
DOMNodeType
* node) = 0;
171
172
/**
173
* Called when leaving a node
174
*
175
* @param node The node
176
*
177
* @return return false if traversal should continue, or true if it should not.
178
*/
179
virtual
bool
180
endNode(
DOMNodeType
* node);
181
};
182
183
184
185
}
186
187
188
189
#endif // XERCESDOMWALKER_HEADER_GUARD_1357924680
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition:
XalanVersion.hpp:76
xalanc::XercesDOMWalker
Definition:
XercesDOMWalker.hpp:32
XercesParserLiaisonDefinitions.hpp
xalanc::DOMNodeType
xercesc::DOMNode DOMNodeType
Definition:
XercesWrapperTypes.hpp:68
XALAN_XERCESPARSERLIAISON_EXPORT
#define XALAN_XERCESPARSERLIAISON_EXPORT
Definition:
XercesParserLiaisonDefinitions.hpp:39
XercesWrapperTypes.hpp
Copyright © 1999-2020 The Apache Software Foundation. All Rights Reserved.
Generated on Sun May 31 2020 10:37:19 for Xalan-C++ API Reference by
1.8.17