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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttribute
(String name, boolean value) Add a new boolean attribute.void
addAttribute
(String name, byte value) Add a new byte attribute as decimal.void
addAttribute
(String name, byte value, boolean hex) Add a new byte attribute.void
addAttribute
(String name, double value) Add a new double attribute.void
addAttribute
(String name, float value) Add a new float attribute.void
addAttribute
(String name, int value) Add a new int attribute as decimal.void
addAttribute
(String name, int value, boolean hex) Add a new int attribute.void
addAttribute
(String name, long value) Add a new long attribute as decimal.void
addAttribute
(String name, long value, boolean hex) Add a new long attribute.void
addAttribute
(String name, short value) Add a new short attribute as decimal.void
addAttribute
(String name, short value, boolean hex) Add a new short attribute.void
addAttribute
(String name, String value) Add a new string attribute.void
addAttribute
(String name, BigInteger value, boolean hex) Add a new big integer attribute.boolean
isEmpty()
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
-