Package ghidra.util.xml
Class XmlAttributes
- java.lang.Object
-
- ghidra.util.xml.XmlAttributes
-
public class XmlAttributes extends java.lang.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 Summary
Constructors Constructor Description XmlAttributes()
Constructs a new empty XML attributes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(java.lang.String name, boolean value)
Add a new boolean attribute.void
addAttribute(java.lang.String name, byte value)
Add a new byte attribute as decimal.void
addAttribute(java.lang.String name, byte value, boolean hex)
Add a new byte attribute.void
addAttribute(java.lang.String name, double value)
Add a new double attribute.void
addAttribute(java.lang.String name, float value)
Add a new float attribute.void
addAttribute(java.lang.String name, int value)
Add a new int attribute as decimal.void
addAttribute(java.lang.String name, int value, boolean hex)
Add a new int attribute.void
addAttribute(java.lang.String name, long value)
Add a new long attribute as decimal.void
addAttribute(java.lang.String name, long value, boolean hex)
Add a new long attribute.void
addAttribute(java.lang.String name, short value)
Add a new short attribute as decimal.void
addAttribute(java.lang.String name, short value, boolean hex)
Add a new short attribute.void
addAttribute(java.lang.String name, java.lang.String value)
Add a new string attribute.void
addAttribute(java.lang.String name, java.math.BigInteger value, boolean hex)
Add a new big integer attribute.boolean
isEmpty()
java.lang.String
toString()
-
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
addAttribute
public void addAttribute(java.lang.String name, java.lang.String value)
Add a new string attribute.- Parameters:
name
- the name of the new attributevalue
- the string value
-
addAttribute
public void addAttribute(java.lang.String name, boolean value)
Add a new boolean attribute.- Parameters:
name
- the name of the new attributevalue
- the boolean value
-
addAttribute
public void addAttribute(java.lang.String name, float value)
Add a new float attribute.- Parameters:
name
- the name of the new attributevalue
- the float value
-
addAttribute
public void addAttribute(java.lang.String name, double value)
Add a new double attribute.- Parameters:
name
- the name of the new attributevalue
- the double value
-
addAttribute
public void addAttribute(java.lang.String name, byte value)
Add a new byte attribute as decimal.- Parameters:
name
- the name of the new attributevalue
- the byte value
-
addAttribute
public void addAttribute(java.lang.String name, byte value, boolean hex)
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
public void addAttribute(java.lang.String name, short value)
Add a new short attribute as decimal.- Parameters:
name
- the name of the new attributevalue
- the short value
-
addAttribute
public void addAttribute(java.lang.String name, short value, boolean hex)
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
public void addAttribute(java.lang.String name, int value)
Add a new int attribute as decimal.- Parameters:
name
- the name of the new attributevalue
- the int value
-
addAttribute
public void addAttribute(java.lang.String name, int value, boolean hex)
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
public void addAttribute(java.lang.String name, long value)
Add a new long attribute as decimal.- Parameters:
name
- the name of the new attributevalue
- the long value
-
addAttribute
public void addAttribute(java.lang.String name, long value, boolean hex)
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
public void addAttribute(java.lang.String name, java.math.BigInteger value, boolean hex)
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
-
-