public class XmlNode
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
log
Used for logging.
|
Constructor and Description |
---|
XmlNode(org.w3c.dom.NodeList nodeList)
Constructs a new one based on a
NodeList . |
XmlNode(java.lang.String value)
Constructs a new node with the given value.
|
XmlNode(java.lang.String name,
org.w3c.dom.NamedNodeMap attributes)
Constructs a new node with the given name and attributes.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addAttribute(java.lang.String key,
java.lang.String value)
Adds a new attribute.
|
protected void |
addChildNode(XmlNode childNode)
Adds a child node.
|
void |
dumpToLog()
Dumps the contents of the node and all of its child nodes
to the internal logger.
|
java.util.ArrayList<KeyValue> |
getAttributes()
Gets a list of all attributes for the node.
|
java.util.ArrayList<XmlNode> |
getChildNodes()
Gets a list of child nodes.
|
java.lang.String |
getName()
Gets the name of the node.
|
java.lang.String |
getValue()
Gets the value of the node.
|
protected void |
setName(java.lang.String name)
Sets the name of the node.
|
protected void |
setValue(java.lang.String value)
Sets the value of the node.
|
java.lang.String |
toXmlString()
Converts the node to an XML string
|
public XmlNode(@Nullable org.w3c.dom.NodeList nodeList)
NodeList
.public XmlNode(java.lang.String name, @Nullable org.w3c.dom.NamedNodeMap attributes)
name
- The name of the node.attributes
- The attributes of the node.public XmlNode(java.lang.String value)
value
- The value of the node.@Nullable public java.lang.String getName()
protected void setName(java.lang.String name)
name
- The name of the node (e.g., for a @Nullable public java.lang.String getValue()
protected void setValue(java.lang.String value)
value
- The value of the node.@Nullable public java.util.ArrayList<XmlNode> getChildNodes()
ArrayList
of XmlNode
objects.protected void addChildNode(XmlNode childNode)
childNode
- An XmlNode
.@Nullable public java.util.ArrayList<KeyValue> getAttributes()
ArrayList
of KeyValue
objects.protected void addAttribute(java.lang.String key, java.lang.String value)
key
- The key portion.value
- The value portion.public void dumpToLog()
@NotNull public java.lang.String toXmlString()