Class PruningElementStack
java.lang.Object
org.dom4j.io.ElementStack
org.dom4j.io.PruningElementStack
- All Implemented Interfaces:
ElementPath
PruningElementStack
is a stack of Element
instances
which will prune the tree when a path expression is reached. This is useful
for parsing very large documents where children of the root element can be
processed individually rather than keeping them all in memory at the same
time.
- Version:
- $Revision: 1.11 $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ElementHandler
ElementHandler to call when pruning occursprivate int
The level at which a path match can occur.private String[]
the element name path which denotes the node to remove from its parent when it is complete (i.e.Fields inherited from class ElementStack
lastElementIndex, stack
-
Constructor Summary
ConstructorsConstructorDescriptionPruningElementStack
(String[] path, ElementHandler elementHandler) PruningElementStack
(String[] path, ElementHandler elementHandler, int defaultCapacity) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
protected void
pathMatches
(Element parent, Element selectedNode) Pops the element off the stackprotected boolean
validElement
(Element element, int index) Methods inherited from class ElementStack
addHandler, clear, containsHandler, getCurrent, getDispatchHandler, getElement, getPath, peekElement, pushElement, reallocate, removeHandler, setDispatchHandler, size
-
Field Details
-
elementHandler
ElementHandler to call when pruning occurs -
path
the element name path which denotes the node to remove from its parent when it is complete (i.e. when it is popped from the stack). The first entry in the path will be a child of the root node -
matchingElementIndex
private int matchingElementIndexThe level at which a path match can occur. We match when we have popped the selected node so the and the lastElementIndex points to its parent so this value should be path.length - 2
-
-
Constructor Details
-
PruningElementStack
-
PruningElementStack
-
-
Method Details
-
popElement
Description copied from class:ElementStack
Pops the element off the stack- Overrides:
popElement
in classElementStack
- Returns:
- the element that has just been popped off the stack
-
pathMatches
-
validElement
-
checkPath
private void checkPath()
-