|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.almendra.commons.util.xml.JDOMUtility
public class JDOMUtility
JDOMUtility
provides several utility methods to deal
with Element
objects of the JDOM XML parser.
Method Summary | |
---|---|
static org.jdom.Element |
getChild(org.jdom.Element element,
java.lang.String tagName)
Answer the child element of an JDOM element with a given tag name. |
static org.jdom.Element |
getChild(org.jdom.Element element,
java.lang.String tagName,
boolean mustBeNonNull)
Answer the child element of an JDOM element with a given tag name. |
static java.util.List |
getChildren(org.jdom.Element element,
java.lang.String tagName)
Answer all children of an JDOM element with a given tag name. |
static java.util.List |
getChildren(org.jdom.Element element,
java.lang.String tagName,
boolean mustBeNonEmpty)
Answer all children of an JDOM element with a given tag name. |
static java.lang.String |
getChildText(org.jdom.Element element,
java.lang.String tagName)
Answer the child text of some JDOM element with a given tag name. |
static java.lang.String |
getSingleChildContent(org.jdom.Element element,
java.lang.String tagName)
Answer the child text of the single child of some JDOM element. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static org.jdom.Element getChild(org.jdom.Element element, java.lang.String tagName) throws XMLParseException
element
- JDOM element to ask for a specific sub-elementtagName
- tag name of the child element
XMLParseException
- thrown if no child found with the given tag namepublic static org.jdom.Element getChild(org.jdom.Element element, java.lang.String tagName, boolean mustBeNonNull) throws XMLParseException
element
- JDOM element to ask for a specific sub-elementtagName
- tag name of the child elementmustBeNonNull
- throw an XMLParseException in case child must exist
XMLParseException
- thrown if no child found with the given tag namepublic static java.util.List getChildren(org.jdom.Element element, java.lang.String tagName) throws XMLParseException
element
- JDOM element to ask for a specific child elementstagName
- tag name of the child elements
XMLParseException
- thrown if no child elements exists for the given tag namepublic static java.util.List getChildren(org.jdom.Element element, java.lang.String tagName, boolean mustBeNonEmpty) throws XMLParseException
element
- JDOM element to ask for a specific child elementstagName
- tag name of the child elementsmustBeNonEmpty
- specifiy whether element without children is allowed
XMLParseException
public static java.lang.String getChildText(org.jdom.Element element, java.lang.String tagName) throws XMLParseException
element
- JDOM element to ask for text of specific child elementtagName
- tag name of the child element
XMLParseException
- thrown if no child elements exists for the given tag namepublic static java.lang.String getSingleChildContent(org.jdom.Element element, java.lang.String tagName) throws XMLParseException
element
- JDOM element to ask for child texttagName
- tag name of the child element
XMLParseException
- thrown if less or more than a single chil exist
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |