/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
* Copyright 1999-2002,2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** This class implements the TreeWalker interface.
*
* @xerces.internal
*
*/
//
// Data
//
/** When TRUE, the children of entites references are returned in the iterator. */
private boolean fEntityReferenceExpansion = false;
/** The whatToShow mask. */
/** The NodeFilter reference. */
/** The current Node. */
/** The root Node. */
//
// Implementation Note: No state is kept except the data above
// (fWhatToShow, fNodeFilter, fCurrentNode, fRoot) such that
// setters could be created for these data values and the
// implementation will still work.
//
// Constructor
//
/** Public constructor */
int whatToShow,
boolean entityReferenceExpansion) {
fCurrentNode = root;
}
return fRoot;
}
/** Return the whatToShow value */
public int getWhatToShow() {
return fWhatToShow;
}
}
/** Return the NodeFilter */
return fNodeFilter;
}
/** Return whether children entity references are included in the iterator. */
public boolean getExpandEntityReferences() {
return fEntityReferenceExpansion;
}
/** Return the current Node. */
return fCurrentNode;
}
/** Return the current Node. */
String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_SUPPORTED_ERR", null);
}
fCurrentNode = node;
}
/** Return the parent Node from the current node,
* after applying filter, whatToshow.
* If result is not null, set the current Node.
*/
fCurrentNode = node;
}
return node;
}
/** Return the first child Node from the current node,
* after applying filter, whatToshow.
* If result is not null, set the current Node.
*/
fCurrentNode = node;
}
return node;
}
/** Return the last child Node from the current node,
* after applying filter, whatToshow.
* If result is not null, set the current Node.
*/
fCurrentNode = node;
}
return node;
}
/** Return the previous sibling Node from the current node,
* after applying filter, whatToshow.
* If result is not null, set the current Node.
*/
fCurrentNode = node;
}
return node;
}
/** Return the next sibling Node from the current node,
* after applying filter, whatToshow.
* If result is not null, set the current Node.
*/
fCurrentNode = node;
}
return node;
}
/** Return the previous Node from the current node,
* after applying filter, whatToshow.
* If result is not null, set the current Node.
*/
// get sibling
return fCurrentNode;
}
return null;
}
// get the lastChild of result.
}
// if there is a lastChild which passes filters return it.
return fCurrentNode;
}
// otherwise return the previous sibling.
return fCurrentNode;
}
// otherwise return null.
return null;
}
/** Return the next Node from the current node,
* after applying filter, whatToshow.
* If result is not null, set the current Node.
*/
return result;
}
return result;
}
// return parent's 1st sibling.
return result;
} else {
}
}
// end , return null
return null;
}
/** Internal function.
* Return the parent Node, from the input node
* after applying filter, whatToshow.
* The current node is not consulted or set.
*/
return newNode;
else
//if (accept == NodeFilter.SKIP_NODE) // and REJECT too.
{
return getParentNode(newNode);
}
}
/** Internal function.
* Return the nextSibling Node, from the input node
* after applying filter, whatToshow.
* The current node is not consulted or set.
*/
}
/** Internal function.
* Return the nextSibling Node, from the input node
* after applying filter, whatToshow.
* NEVER TRAVERSES ABOVE THE SPECIFIED ROOT NODE.
* The current node is not consulted or set.
*/
}
return null;
}
return newNode;
else
}
return fChild;
}
else
//if (accept == NodeFilter.REJECT_NODE)
{
}
} // getNextSibling(Node node) {
/** Internal function.
* Return the previous sibling Node, from the input node
* after applying filter, whatToshow.
* The current node is not consulted or set.
*/
}
/** Internal function.
* Return the previousSibling Node, from the input node
* after applying filter, whatToshow.
* NEVER TRAVERSES ABOVE THE SPECIFIED ROOT NODE.
* The current node is not consulted or set.
*/
}
return null;
}
return newNode;
else
}
return fChild;
}
else
//if (accept == NodeFilter.REJECT_NODE)
{
}
} // getPreviousSibling(Node node) {
/** Internal function.
* Return the first child Node, from the input node
* after applying filter, whatToshow.
* The current node is not consulted or set.
*/
return null;
return newNode;
else
&& newNode.hasChildNodes())
{
}
return fChild;
}
else
//if (accept == NodeFilter.REJECT_NODE)
{
}
}
/** Internal function.
* Return the last child Node, from the input node
* after applying filter, whatToshow.
* The current node is not consulted or set.
*/
return null;
return newNode;
else
&& newNode.hasChildNodes())
{
}
return lChild;
}
else
//if (accept == NodeFilter.REJECT_NODE)
{
}
}
/** Internal function.
* The node whatToShow and the filter are combined into one result. */
/***
7.1.2.4. Filters and whatToShow flags
Iterator and TreeWalker apply whatToShow flags before applying Filters. If a node is rejected by the
active whatToShow flags, a Filter will not be called to evaluate that node. When a node is rejected by
the active whatToShow flags, children of that node will still be considered, and Filters may be called to
evaluate them.
***/
if (fNodeFilter == null) {
return NodeFilter.FILTER_ACCEPT;
} else {
return NodeFilter.FILTER_SKIP;
}
} else {
} else {
// What to show has failed. See above excerpt from spec.
// Equivalent to FILTER_SKIP.
return NodeFilter.FILTER_SKIP;
}
}
}
}