|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.metagloss.xml.DOMUtils
public class DOMUtils
Utility class for dealing with XML DOM data.
Method Summary | |
---|---|
static java.lang.String |
getAttribute(org.w3c.dom.Element parent,
java.lang.String child,
java.lang.String attribute)
Gets the attribute value of an element or its child element. |
static java.util.List<org.w3c.dom.Element> |
getChildren(org.w3c.dom.Element parent,
java.lang.String tag)
Gets all requested child elements, one level deep. |
static java.lang.String |
getData(org.w3c.dom.Element element,
XMLBind bind)
Gets the data associated with the XMLBind er in relation to the element. |
static java.lang.String |
getText(org.w3c.dom.Element parent,
java.lang.String child)
Gets the text of an element or its child element. |
static java.lang.String |
getTextOrNull(org.w3c.dom.Element parent,
java.lang.String child)
Gets the text of an element or its child element. |
static boolean |
hasChild(org.w3c.dom.Element parent,
java.lang.String child)
Shorthand for checking if an element has any matching child elements. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.lang.String getData(org.w3c.dom.Element element, XMLBind bind) throws XMLBindException
XMLBind
er in relation to the element.
element
- Root element.bind
- Extraction binder.
XMLBindException
- If both bind's element and attribute data are empty.public static java.lang.String getAttribute(org.w3c.dom.Element parent, java.lang.String child, java.lang.String attribute) throws XMLBindException
parent
- Source element.child
- Child element, or null.attribute
- Attribute key.
XMLBindException
- If child element doesn't exist.public static java.lang.String getText(org.w3c.dom.Element parent, java.lang.String child) throws XMLBindException
parent
- Source element.child
- Child element, or null.
XMLBindException
- If requested child element doesn't exist.public static java.lang.String getTextOrNull(org.w3c.dom.Element parent, java.lang.String child)
parent
- Source element.child
- Child element, or null.
public static boolean hasChild(org.w3c.dom.Element parent, java.lang.String child)
parent
- Source element.child
- Search string.
public static java.util.List<org.w3c.dom.Element> getChildren(org.w3c.dom.Element parent, java.lang.String tag)
parent
- Source.tag
- Child elements.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |