|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openspml.util.XmlElement
A wrapper around the standard DOM Element that provides a more convenient set of methods.
Constructor Summary | |
XmlElement(org.openspml.util.Element e)
|
Method Summary | |
java.lang.String |
getAttribute(java.lang.String name)
Return the value of an attribute. |
boolean |
getBooleanAttribute(java.lang.String name)
Return a boolean attribute value. |
XmlElement |
getChildElement()
Return the first child element. |
XmlElement |
getChildElement(java.lang.String localName)
Return the first child element with the given local name. |
java.lang.String |
getContent()
Return the content of the given element. |
java.lang.String |
getLocalName()
Return the element tag name without the namespace qualifier. |
java.lang.String |
getNamespaceURI()
Given an element with a namespace prefix and a namespace declaration for that prefix, return the namespace URI. |
XmlElement |
getNextElement()
Get the next right sibling that is an element. |
java.lang.String |
getPrefix()
Return the namespace prefix. |
java.lang.String |
getTagName()
|
XmlElement |
next()
Assimilate the next right sibling within this element wrapper. |
static java.lang.String |
stripPrefix(java.lang.String value)
Remove an identifier prefix from an attribute value. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public XmlElement(org.openspml.util.Element e)
Method Detail |
public java.lang.String getTagName()
public java.lang.String getLocalName()
public java.lang.String getPrefix()
public java.lang.String getNamespaceURI()
public static java.lang.String stripPrefix(java.lang.String value)
public java.lang.String getAttribute(java.lang.String name)
The DOM getAttribute method returns an empty string if the attribute doesn't exist. Here, we detect this and return null.
public boolean getBooleanAttribute(java.lang.String name)
The value must be equal to the string "true" or "1" to be considered true.
public XmlElement getChildElement()
public XmlElement getChildElement(java.lang.String localName)
public XmlElement getNextElement()
public XmlElement next()
public java.lang.String getContent()
We will descend to an arbitrary depth looking for the first non-empty text node.
Note that the parser may break what was originally a single string of pcdata into multiple adjacent text nodes. Xerces appears to do this when it encounters a '$' in the text, not sure if there is specified behavior, or if its parser specific.
Here, we will congeal adjacent text nodes.
We will NOT ignore text nodes that have only whitespace.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |