00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one 00003 * or more contributor license agreements. See the NOTICE file 00004 * distributed with this work for additional information 00005 * regarding copyright ownership. The ASF licenses this file 00006 * to you under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 #if !defined(XERCESDOMWALKER_HEADER_GUARD_1357924680) 00019 #define XERCESDOMWALKER_HEADER_GUARD_1357924680 00020 00021 00022 00023 #include <xalanc/XercesParserLiaison/XercesParserLiaisonDefinitions.hpp> 00024 #include <xalanc/XercesParserLiaison/XercesWrapperTypes.hpp> 00025 00026 00027 00028 XALAN_CPP_NAMESPACE_BEGIN 00029 00030 00031 00032 class XALAN_XERCESPARSERLIAISON_EXPORT XercesDOMWalker 00033 { 00034 public: 00035 00036 /** 00037 * Constructor. 00038 */ 00039 XercesDOMWalker(); 00040 00041 virtual 00042 ~XercesDOMWalker(); 00043 00044 /** 00045 * Perform a document-order traversal. 00046 * 00047 * Derived classes and stop the traversal by returning 00048 * true from startNode() or endNode(). If that happens, 00049 * the function will return the next node in document 00050 * order. If desired, the caller can start traversing 00051 * the tree again from that point. Note that terminal 00052 * nodes will always have startNode() and endNode() 00053 * called before the traversal terminates. 00054 * 00055 * @param pos The node in the tree with which to start the walk 00056 * 00057 * @return 0 if the traversal completes, or the next node if the traversal doesn't complete. 00058 */ 00059 const DOMNodeType* 00060 traverse(const DOMNodeType* pos); 00061 00062 /** 00063 * Perform a document-order traversal. 00064 * 00065 * Derived classes and stop the traversal by returning 00066 * true from startNode() or endNode(). If that happens, 00067 * the function will return the next node in document 00068 * order. If desired, the caller can start traversing 00069 * the tree again from that point. Note that terminal 00070 * nodes will always have startNode() and endNode() 00071 * called before the traversal terminates. 00072 * 00073 * @param pos The node in the tree with which to start the walk 00074 * 00075 * @return 0 if the traversal completes, or the next node if the traversal doesn't complete. 00076 */ 00077 DOMNodeType* 00078 traverse(DOMNodeType* pos); 00079 00080 /** 00081 * Perform a document-order traversal stopping at the 00082 * provided parent node. 00083 * 00084 * Derived classes and stop the traversal by returning 00085 * true from startNode() or endNode(). If that happens, 00086 * the function will return the next node in document 00087 * order. If desired, the caller can start traversing 00088 * the tree again from that point. Note that terminal 00089 * nodes will always have startNode() and endNode() 00090 * called before the traversal terminates. 00091 * 00092 * @param pos The node in the tree with which to start the walk 00093 * @param parent The parent of pos. Note that for multiple calls that continue the traversal, this node must remain the same. 00094 * 00095 * @return parent if the traversal completes, or the next node if the traversal doesn't complete. 00096 */ 00097 const DOMNodeType* 00098 traverse( 00099 const DOMNodeType* pos, 00100 const DOMNodeType* parent); 00101 00102 /** 00103 * Perform a document-order traversal stopping at the 00104 * provided parent node. 00105 * 00106 * Derived classes and stop the traversal by returning 00107 * true from startNode() or endNode(). If that happens, 00108 * the function will return the next node in document 00109 * order. If desired, the caller can start traversing 00110 * the tree again from that point. Note that terminal 00111 * nodes will always have startNode() and endNode() 00112 * called before the traversal terminates. 00113 * 00114 * @param pos The node in the tree with which to start the walk 00115 * @param parent The parent of pos. Note that for multiple calls that continue the traversal, this node must remain the same. 00116 * 00117 * @return parent if the traversal completes, or the next node if the traversal doesn't complete. 00118 */ 00119 DOMNodeType* 00120 traverse( 00121 DOMNodeType* pos, 00122 DOMNodeType* parent); 00123 00124 /** 00125 * Perform a pre-order traversal. 00126 * 00127 * @param pos starting node 00128 */ 00129 void 00130 traverseSubtree(const DOMNodeType* pos); 00131 00132 /** 00133 * Perform a document-order traversal. 00134 * 00135 * @param pos starting node 00136 */ 00137 void 00138 traverseSubtree(DOMNodeType* pos); 00139 00140 protected: 00141 00142 /** 00143 * Called when first walking a node 00144 * 00145 * @param node The node 00146 * 00147 * @return return false if traversal should continue, or true if it should not. 00148 */ 00149 virtual bool 00150 startNode(const DOMNodeType* node) = 0; 00151 00152 /** 00153 * Called when first walking a node 00154 * 00155 * @param node The node 00156 * 00157 * @return return false if traversal should continue, or true if it should not. 00158 */ 00159 virtual bool 00160 startNode(DOMNodeType* node); 00161 00162 /** 00163 * Called when leaving a node 00164 * 00165 * @param node The node 00166 * 00167 * @return return false if traversal should continue, or true if it should not. 00168 */ 00169 virtual bool 00170 endNode(const DOMNodeType* node) = 0; 00171 00172 /** 00173 * Called when leaving a node 00174 * 00175 * @param node The node 00176 * 00177 * @return return false if traversal should continue, or true if it should not. 00178 */ 00179 virtual bool 00180 endNode(DOMNodeType* node); 00181 }; 00182 00183 00184 00185 XALAN_CPP_NAMESPACE_END 00186 00187 00188 00189 #endif // XERCESDOMWALKER_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.11 |
|