Class DOMUtils
java.lang.Object
org.apache.lucene.queryparser.xml.DOMUtils
Helper methods for parsing XML
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 definedstatic String
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
static String
static String
static Element
insertChild
(Element parent, String tagName, String text) static Document
Helper method to parse an XML file into a DOM tree, given a reader.
-
Constructor Details
-
DOMUtils
public DOMUtils()
-
-
Method Details
-
getChildByTagOrFail
- Throws:
ParserException
-
getFirstChildOrFail
- Throws:
ParserException
-
getAttributeOrFail
- Throws:
ParserException
-
getAttributeWithInheritanceOrFail
public static String getAttributeWithInheritanceOrFail(Element e, String name) throws ParserException - Throws:
ParserException
-
getNonBlankTextOrFail
- Throws:
ParserException
-
getChildByTagName
-
getAttributeWithInheritance
Returns an attribute value from this node, or first parent node with this attribute defined- Returns:
- A non-zero-length value if defined, otherwise null
-
getChildTextByTagName
-
insertChild
-
getAttribute
-
getAttribute
-
getAttribute
-
getAttribute
-
getText
-
getFirstChildElement
-
loadXML
Helper method to parse an XML file into a DOM tree, given a reader.- Parameters:
is
- reader of the XML file to be parsed- Returns:
- an org.w3c.dom.Document object
-