public interface XmlNode extends XmlNodeReader
Note: Special case for the string stored as null
which is in fact stored as NULL
. When
read, the NULL
string is return if the stored string was null
.
Example:
final XmlNode node = File.createXmlNode("node"); node.writeBoolean("value", true);
XmlParser
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NULL
Null string (represents a string stored as
null ). |
Modifier and Type | Method and Description |
---|---|
void |
add(XmlNode node)
Add a child node.
|
java.util.Map<java.lang.String,java.lang.String> |
getAttributes()
Get all attributes.
|
XmlNode |
getChild(java.lang.String name)
Get a child node from its name.
|
java.util.List<XmlNode> |
getChildren()
Get list of all children.
|
java.util.List<XmlNode> |
getChildren(java.lang.String name)
Get the list of all children with this name.
|
java.lang.String |
getText()
Return the text inside the node.
|
void |
writeBoolean(java.lang.String attribute,
boolean content)
Write a boolean.
|
void |
writeByte(java.lang.String attribute,
byte content)
Write a byte.
|
void |
writeDouble(java.lang.String attribute,
double content)
Write a double.
|
void |
writeFloat(java.lang.String attribute,
float content)
Write a float.
|
void |
writeInteger(java.lang.String attribute,
int content)
Write an integer.
|
void |
writeLong(java.lang.String attribute,
long content)
Write a long.
|
void |
writeShort(java.lang.String attribute,
short content)
Write a short.
|
void |
writeString(java.lang.String attribute,
java.lang.String content)
Write a string.
|
readBoolean, readByte, readDouble, readFloat, readInteger, readLong, readShort, readString
static final java.lang.String NULL
null
).void add(XmlNode node)
node
- The child node.void writeByte(java.lang.String attribute, byte content)
attribute
- The attribute name.content
- The byte value.void writeShort(java.lang.String attribute, short content)
attribute
- The attribute name.content
- The short value.void writeInteger(java.lang.String attribute, int content)
attribute
- The attribute name.content
- The integer value.void writeLong(java.lang.String attribute, long content)
attribute
- The attribute name.content
- The long value.void writeFloat(java.lang.String attribute, float content)
attribute
- The float name.content
- The float value.void writeDouble(java.lang.String attribute, double content)
attribute
- The attribute name.content
- The double value.void writeString(java.lang.String attribute, java.lang.String content)
null
, NULL
is wrote instead.attribute
- The attribute name.content
- The string value.void writeBoolean(java.lang.String attribute, boolean content)
attribute
- The attribute name.content
- The boolean value.java.lang.String getText()
XmlNode getChild(java.lang.String name) throws XmlNodeNotFoundException
name
- The child name.XmlNodeNotFoundException
- If no node if found at this child name.java.util.List<XmlNode> getChildren(java.lang.String name)
name
- The children name.java.util.List<XmlNode> getChildren()
java.util.Map<java.lang.String,java.lang.String> getAttributes()