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 String |
NULL
Null string (represents a string stored as
null ). |
Modifier and Type | Method and Description |
---|---|
void |
add(XmlNode node)
Add a child node.
|
Map<String,String> |
getAttributes()
Get all attributes.
|
XmlNode |
getChild(String name)
Get a child node from its name.
|
List<XmlNode> |
getChildren()
Get list of all children.
|
List<XmlNode> |
getChildren(String name)
Get the list of all children with this name.
|
String |
getText()
Return the text inside the node.
|
void |
writeBoolean(String attribute,
boolean content)
Write a boolean.
|
void |
writeByte(String attribute,
byte content)
Write a byte.
|
void |
writeDouble(String attribute,
double content)
Write a double.
|
void |
writeFloat(String attribute,
float content)
Write a float.
|
void |
writeInteger(String attribute,
int content)
Write an integer.
|
void |
writeLong(String attribute,
long content)
Write a long.
|
void |
writeShort(String attribute,
short content)
Write a short.
|
void |
writeString(String attribute,
String content)
Write a string.
|
readBoolean, readByte, readDouble, readFloat, readInteger, readLong, readShort, readString
static final String NULL
null
).void add(XmlNode node)
node
- The child node.void writeByte(String attribute, byte content)
attribute
- The attribute name.content
- The byte value.void writeShort(String attribute, short content)
attribute
- The attribute name.content
- The short value.void writeInteger(String attribute, int content)
attribute
- The attribute name.content
- The integer value.void writeLong(String attribute, long content)
attribute
- The attribute name.content
- The long value.void writeFloat(String attribute, float content)
attribute
- The float name.content
- The float value.void writeDouble(String attribute, double content)
attribute
- The attribute name.content
- The double value.void writeString(String attribute, String content)
null
, NULL
is wrote instead.attribute
- The attribute name.content
- The string value.void writeBoolean(String attribute, boolean content)
attribute
- The attribute name.content
- The boolean value.String getText()
XmlNode getChild(String name) throws XmlNodeNotFoundException
name
- The child name.XmlNodeNotFoundException
- If no node if found at this child name.List<XmlNode> getChildren(String name)
name
- The children name.Copyright © 2014 Byron 3D Games Studio. All rights reserved.