Package ghidra.util.xml

# Class XmlParserElement

java.lang.Object
ghidra.util.xml.XmlParserElement

public class XmlParserElement extends Object
A class to represent the start or end tag from an XML file.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object obj)`
  `String[]`
  `getAttrNames()`
  Returns an array containing the names of all attributes defined in this element.
  `String`
  `getAttrValue(String attrName)`
  Returns the value of the specified attribute.
  `boolean`
  `getAttrValueAsBool(String attrName)`
  Returns the boolean value of the specified attribute.
  `double`
  `getAttrValueAsDouble(String attrName)`
  Returns the double value of the specified attribute.
  `int`
  `getAttrValueAsInt(String attrName)`
  Returns the integer value of the specified attribute.
  `long`
  `getAttrValueAsLong(String attrName)`
  Returns the long value of the specified attribute.
  `int`
  `getLineNum()`
  Returns the line number where this element was defined.
  `String`
  `getName()`
  Returns the name of this element/tag.
  `String`
  `getText()`
  Returns the text of this element.
  `boolean`
  `hasAttr(String attrName)`
  Returns true if this element contains an attribute with the specified name.
  `boolean`
  `isEnd()`
  Returns true if this element represents an end tag.
  `boolean`
  `isStart()`
  Returns true if this element represents a start tag.
  `void`
  `setAttribute(String name, String value)`
  Sets the value of the specified attribute.
  `String`
  `toString()`

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

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

- ## Method Details

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### isStart

    public boolean isStart()
    Returns true if this element represents a start tag.
    Returns:
      true if this element represents a start tag

  - ### isEnd

    public boolean isEnd()
    Returns true if this element represents an end tag.
    Returns:
      true if this element represents an end tag

  - ### getName

    public String getName()
    Returns the name of this element/tag.
    Returns:
      the name of this element/tag

  - ### getLineNum

    public int getLineNum()
    Returns the line number where this element was defined.
    Returns:
      the line number where this element was defined

  - ### getText

    public String getText()
    Returns the text of this element. Or, null if no text existed in the XML.
    Returns:
      the text of this element

  - ### getAttrValue

    public String getAttrValue(String attrName)
    Returns the value of the specified attribute. Or, null if no attribute exists with the specified name.
    Parameters:
      `attrName` - the name of the attribute
    Returns:
      the value of the specified attribute

  - ### getAttrValueAsBool

    public boolean getAttrValueAsBool(String attrName) throws XmlAttributeException
    Returns the boolean value of the specified attribute.
    Parameters:
      `attrName` - the name of the attribute
    Returns:
      the boolean value of the specified attribute
    Throws:
      `XmlAttributeException` - if no attribute exists with the specified name

  - ### getAttrValueAsInt

    public int getAttrValueAsInt(String attrName) throws XmlAttributeException
    Returns the integer value of the specified attribute.
    Parameters:
      `attrName` - the name of the attribute
    Returns:
      the integer value of the specified attribute
    Throws:
      `XmlAttributeException` - if no attribute exists with the specified name

  - ### getAttrValueAsLong

    public long getAttrValueAsLong(String attrName) throws XmlAttributeException
    Returns the long value of the specified attribute.
    Parameters:
      `attrName` - the name of the attribute
    Returns:
      the long value of the specified attribute
    Throws:
      `XmlAttributeException` - if no attribute exists with the specified name

  - ### getAttrValueAsDouble

    public double getAttrValueAsDouble(String attrName) throws XmlAttributeException
    Returns the double value of the specified attribute.
    Parameters:
      `attrName` - the name of the attribute
    Returns:
      the double value of the specified attribute
    Throws:
      `XmlAttributeException` - if no attribute exists with the specified name

  - ### getAttrNames

    public String[] getAttrNames()
    Returns an array containing the names of all attributes defined in this element.
    Returns:
      an array containing the names of all attributes defined in this element

  - ### hasAttr

    public boolean hasAttr(String attrName)
    Returns true if this element contains an attribute with the specified name.
    Parameters:
      `attrName` - the name of the attribute
    Returns:
      true if this element contains an attribute with the specified name

  - ### setAttribute

    public void setAttribute(String name, String value)
    Sets the value of the specified attribute.
    Parameters:
      `name` - the name of the attribute
      `value` - the value of the attribute