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 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