|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.jackrabbit.core.util.DOMWalker
Document walker class. This class provides an intuitive interface for traversing a parsed DOM document.
Constructor Summary | |
DOMWalker(InputStream xml)
Creates a walker for traversing a DOM document read from the given input stream. |
Method Summary | |
boolean |
enterElement(String name)
Enters the named child element. |
String |
getAttribute(String name)
Returns the value of the named attribute of the current element. |
String |
getContent()
Returns the text content of the current element. |
String |
getName()
Returns the name of the current element. |
Properties |
getNamespaces()
Returns the namespace mappings defined in the current element. |
boolean |
iterateElements(String name)
Iterates through the named child elements over multiple calls. |
void |
leaveElement()
Leaves the current element. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DOMWalker(InputStream xml) throws IOException
xml
- XML input stream
IOException
- if a document cannot be read from the streamMethod Detail |
public Properties getNamespaces()
xmlns
attributes of the
current element.
public String getName()
public String getAttribute(String name)
name
- attribute name
null
if not foundpublic String getContent()
public boolean enterElement(String name)
true
is returned. Otherwise the current element is not changed and
false
is returned.
The standard call sequence for this method is show below.
DOMWalker walker = ...; if (walker.enterElement("...")) { ...; walker.leaveElement(); }
name
- child element name
true
if the element was entered,
false
otherwisepublic void leaveElement()
enterElement(String)
public boolean iterateElements(String name)
DOMWalker walker = ...; while (walker.iterateElements("...")) { ...; }
WARNING: This method should only be used when
walker.getName()
does not equal name
when
the while loop is started. Otherwise the walker will not be positioned
at the same node when the while loop ends.
name
- name of the iterated elements
true
if another iterated element was entered, or
false
if no more iterated elements were found
and the original element is restored as the current element
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |