public class DOMUtils extends Object
Constructor and Description |
---|
DOMUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
getAttribute(Element element,
String attributeName,
boolean deflt) |
static float |
getAttribute(Element element,
String attributeName,
float deflt) |
static int |
getAttribute(Element element,
String attributeName,
int deflt) |
static String |
getAttribute(Element element,
String attributeName,
String deflt) |
static String |
getAttributeOrFail(Element e,
String name) |
static String |
getAttributeWithInheritance(Element element,
String attributeName)
Returns an attribute value from this node, or first parent node with this attribute defined
|
static String |
getAttributeWithInheritanceOrFail(Element e,
String name) |
static Element |
getChildByTagName(Element e,
String name) |
static Element |
getChildByTagOrFail(Element e,
String name) |
static String |
getChildTextByTagName(Element e,
String tagName) |
static Element |
getFirstChildElement(Element element) |
static Element |
getFirstChildOrFail(Element e) |
static String |
getNonBlankTextOrFail(Element e) |
static String |
getText(Node e) |
static Element |
insertChild(Element parent,
String tagName,
String text) |
static Document |
loadXML(Reader is)
Helper method to parse an XML file into a DOM tree, given a reader.
|
public static Element getChildByTagOrFail(Element e, String name) throws ParserException
ParserException
public static Element getFirstChildOrFail(Element e) throws ParserException
ParserException
public static String getAttributeOrFail(Element e, String name) throws ParserException
ParserException
public static String getAttributeWithInheritanceOrFail(Element e, String name) throws ParserException
ParserException
public static String getNonBlankTextOrFail(Element e) throws ParserException
ParserException
public static String getAttributeWithInheritance(Element element, String attributeName)
element
- attributeName
- public static boolean getAttribute(Element element, String attributeName, boolean deflt)