Package ghidra.util.xml
Class XmlAttributes
java.lang.Object
ghidra.util.xml.XmlAttributes
A container class for creating XML attribute strings.
For example, given the following code:
The output would be:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String name, boolean value) Add a new boolean attribute.voidaddAttribute(String name, byte value) Add a new byte attribute as decimal.voidaddAttribute(String name, byte value, boolean hex) Add a new byte attribute.voidaddAttribute(String name, double value) Add a new double attribute.voidaddAttribute(String name, float value) Add a new float attribute.voidaddAttribute(String name, int value) Add a new int attribute as decimal.voidaddAttribute(String name, int value, boolean hex) Add a new int attribute.voidaddAttribute(String name, long value) Add a new long attribute as decimal.voidaddAttribute(String name, long value, boolean hex) Add a new long attribute.voidaddAttribute(String name, short value) Add a new short attribute as decimal.voidaddAttribute(String name, short value, boolean hex) Add a new short attribute.voidaddAttribute(String name, String value) Add a new string attribute.voidaddAttribute(String name, BigInteger value, boolean hex) Add a new big integer attribute.booleanisEmpty()toString()
-
Constructor Details
-
XmlAttributes
public XmlAttributes()Constructs a new empty XML attributes.
-
-
Method Details
-
toString
-
addAttribute
Add a new string attribute.- Parameters:
name- the name of the new attributevalue- the string value
-
addAttribute
Add a new boolean attribute.- Parameters:
name- the name of the new attributevalue- the boolean value
-
addAttribute
Add a new float attribute.- Parameters:
name- the name of the new attributevalue- the float value
-
addAttribute
Add a new double attribute.- Parameters:
name- the name of the new attributevalue- the double value
-
addAttribute
Add a new byte attribute as decimal.- Parameters:
name- the name of the new attributevalue- the byte value
-
addAttribute
Add a new byte attribute.- Parameters:
name- the name of the new attributevalue- the byte valuehex- true if value should be written in hex
-
addAttribute
Add a new short attribute as decimal.- Parameters:
name- the name of the new attributevalue- the short value
-
addAttribute
Add a new short attribute.- Parameters:
name- the name of the new attributevalue- the short valuehex- true if value should be written in hex
-
addAttribute
Add a new int attribute as decimal.- Parameters:
name- the name of the new attributevalue- the int value
-
addAttribute
Add a new int attribute.- Parameters:
name- the name of the new attributevalue- the int valuehex- true if value should be written in hex
-
addAttribute
Add a new long attribute as decimal.- Parameters:
name- the name of the new attributevalue- the long value
-
addAttribute
Add a new long attribute.- Parameters:
name- the name of the new attributevalue- the long valuehex- true if value should be written in hex
-
addAttribute
Add a new big integer attribute.- Parameters:
name- the name of the new attributevalue- the big integer value
-
isEmpty
public boolean isEmpty()- Returns:
- the number of attributes in this
-