DOMUtils (Lucene 10.5.0 queryparser API)
Description: declaration: package: org.apache.lucene.queryparser.xml, class: DOMUtils

Package org.apache.lucene.queryparser.xml

# Class DOMUtils

java.lang.Object
org.apache.lucene.queryparser.xml.DOMUtils

public class DOMUtils extends Object
Helper methods for parsing XML.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- ## Method Summary

  Modifier and Type
  Method
  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)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### getChildByTagOrFail

    public static Element getChildByTagOrFail(Element e, String name) throws ParserException
    Throws:
      `ParserException`

  - ### getFirstChildOrFail

    public static Element getFirstChildOrFail(Element e) throws ParserException
    Throws:
      `ParserException`

  - ### getAttributeOrFail

    public static String getAttributeOrFail(Element e, String name) throws ParserException
    Throws:
      `ParserException`

  - ### getAttributeWithInheritanceOrFail

    public static String getAttributeWithInheritanceOrFail(Element e, String name) throws ParserException
    Throws:
      `ParserException`

  - ### getNonBlankTextOrFail

    public static String getNonBlankTextOrFail(Element e) throws ParserException
    Throws:
      `ParserException`

  - ### getChildByTagName

    public static Element getChildByTagName(Element e, String name)

  - ### getAttributeWithInheritance

    public static String getAttributeWithInheritance(Element element, String attributeName)
    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

    public static String getChildTextByTagName(Element e, String tagName)

  - ### insertChild

    public static Element insertChild(Element parent, String tagName, String text)

  - ### getAttribute

    public static String getAttribute(Element element, String attributeName, String deflt)

  - ### getAttribute

    public static float getAttribute(Element element, String attributeName, float deflt)

  - ### getAttribute

    public static int getAttribute(Element element, String attributeName, int deflt)

  - ### getAttribute

    public static boolean getAttribute(Element element, String attributeName, boolean deflt)

  - ### getText

    public static String getText(Node e)

  - ### getFirstChildElement

    public static Element getFirstChildElement(Element element)