Class XmlAttributes

java.lang.Object
ghidra.util.xml.XmlAttributes

public class XmlAttributes extends Object
A container class for creating XML attribute strings. For example, given the following code:
 XmlAttributes attrs = new XmlAttributes();
 attrs.add("FIVE", 32, true);
 attrs.add("BAR", "foo");
 attrs.add("PI", 3.14159);
 

The output would be: FIVE="0x20" BAR="foo" PI="3.14159".
  • Constructor Details

    • XmlAttributes

      public XmlAttributes()
      Constructs a new empty XML attributes.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • addAttribute

      public void addAttribute(String name, String value)
      Add a new string attribute.
      Parameters:
      name - the name of the new attribute
      value - the string value
    • addAttribute

      public void addAttribute(String name, boolean value)
      Add a new boolean attribute.
      Parameters:
      name - the name of the new attribute
      value - the boolean value
    • addAttribute

      public void addAttribute(String name, float value)
      Add a new float attribute.
      Parameters:
      name - the name of the new attribute
      value - the float value
    • addAttribute

      public void addAttribute(String name, double value)
      Add a new double attribute.
      Parameters:
      name - the name of the new attribute
      value - the double value
    • addAttribute

      public void addAttribute(String name, byte value)
      Add a new byte attribute as decimal.
      Parameters:
      name - the name of the new attribute
      value - the byte value
    • addAttribute

      public void addAttribute(String name, byte value, boolean hex)
      Add a new byte attribute.
      Parameters:
      name - the name of the new attribute
      value - the byte value
      hex - true if value should be written in hex
    • addAttribute

      public void addAttribute(String name, short value)
      Add a new short attribute as decimal.
      Parameters:
      name - the name of the new attribute
      value - the short value
    • addAttribute

      public void addAttribute(String name, short value, boolean hex)
      Add a new short attribute.
      Parameters:
      name - the name of the new attribute
      value - the short value
      hex - true if value should be written in hex
    • addAttribute

      public void addAttribute(String name, int value)
      Add a new int attribute as decimal.
      Parameters:
      name - the name of the new attribute
      value - the int value
    • addAttribute

      public void addAttribute(String name, int value, boolean hex)
      Add a new int attribute.
      Parameters:
      name - the name of the new attribute
      value - the int value
      hex - true if value should be written in hex
    • addAttribute

      public void addAttribute(String name, long value)
      Add a new long attribute as decimal.
      Parameters:
      name - the name of the new attribute
      value - the long value
    • addAttribute

      public void addAttribute(String name, long value, boolean hex)
      Add a new long attribute.
      Parameters:
      name - the name of the new attribute
      value - the long value
      hex - true if value should be written in hex
    • addAttribute

      public void addAttribute(String name, BigInteger value, boolean hex)
      Add a new big integer attribute.
      Parameters:
      name - the name of the new attribute
      value - the big integer value
    • isEmpty

      public boolean isEmpty()
      Returns:
      the number of attributes in this