|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.exorcist.midgard.DOMWalker
public final class DOMWalker
Document walker class. This class provides an intuitive interface for traversing a parsed DOM document.
Constructor Summary | |
---|---|
DOMWalker(java.io.InputStream xml,
java.lang.String namespace)
Creates a walker for traversing a DOM document read from the given input stream. |
Method Summary | |
---|---|
boolean |
enterElement(java.lang.String name)
Enters the named child element. |
java.lang.String |
getAttribute(java.lang.String name)
Returns the value of the named attribute of the current element. |
java.lang.String |
getContent()
Returns the text content of the current element. |
java.lang.String |
getContent(java.lang.String name)
|
java.lang.Object |
getCurrent()
|
java.lang.String |
getName()
Returns the name of the current element. |
java.util.Properties |
getNamespaces()
Returns the namespace mappings defined in the current element. |
boolean |
iterateElements(java.lang.String name,
java.lang.Object context)
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(java.io.InputStream xml, java.lang.String namespace) throws java.io.IOException
xml
- XML input stream
java.io.IOException
- if a document cannot be read from the streamMethod Detail |
---|
public java.lang.Object getCurrent()
public java.util.Properties getNamespaces()
xmlns
attributes of the
current element.
public java.lang.String getName()
public java.lang.String getAttribute(java.lang.String name)
name
- attribute name
null
if not foundpublic java.lang.String getContent()
public java.lang.String getContent(java.lang.String name)
public boolean enterElement(java.lang.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(java.lang.String name, java.lang.Object context)
DOMWalker walker = ...; while (walker.iterateElements("...")) { ...; }
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 |