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 = XmlFactory.createXmlNode("node"); node.writeBoolean("value", true);
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.
|
XmlNode |
createChild(String child)
Create a child node.
|
Map<String,String> |
getAttributes()
Get all attributes.
|
XmlNode |
getChild(String name)
Get a child node from its name.
|
Collection<XmlNode> |
getChildren()
Get list of all children.
|
Collection<XmlNode> |
getChildren(String name)
Get the list of all children with this name.
|
String |
getNodeName()
Get the name of the current node.
|
String |
getText()
Return the text inside the node.
|
boolean |
hasAttribute(String attribute)
Check if node has the following attribute.
|
boolean |
hasChild(String child)
Check if node has the following child.
|
void |
removeAttribute(String attribute)
Remove attribute.
|
void |
removeChild(String child)
Remove child.
|
void |
removeChild(XmlNode child)
Remove child.
|
void |
removeChildren(String children)
Remove all children.
|
void |
setText(String text)
Set 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
).XmlNode createChild(String child)
child
- The child name.void add(XmlNode node)
node
- The child node.LionEngineException
- If error when adding the node.void setText(String text)
text
- The text content.LionEngineException
- If error when setting the node text.void writeByte(String attribute, byte content)
attribute
- The attribute name.content
- The byte value.LionEngineException
- If error when writing.void writeShort(String attribute, short content)
attribute
- The attribute name.content
- The short value.LionEngineException
- If error when writing.void writeInteger(String attribute, int content)
attribute
- The attribute name.content
- The integer value.LionEngineException
- If error when writing.void writeLong(String attribute, long content)
attribute
- The attribute name.content
- The long value.LionEngineException
- If error when writing.void writeFloat(String attribute, float content)
attribute
- The float name.content
- The float value.LionEngineException
- If error when writing.void writeDouble(String attribute, double content)
attribute
- The attribute name.content
- The double value.LionEngineException
- If error when writing.void writeString(String attribute, String content)
null
, NULL
is wrote instead.attribute
- The attribute name.content
- The string value.LionEngineException
- If error when writing.void writeBoolean(String attribute, boolean content)
attribute
- The attribute name.content
- The boolean value.LionEngineException
- If error when writing.void removeAttribute(String attribute)
attribute
- The attribute to remove.void removeChild(String child)
child
- The child to remove.LionEngineException
- If no node is found at this child name.void removeChild(XmlNode child)
child
- The child to remove.void removeChildren(String children)
children
- The children to remove.String getNodeName()
String getText()
XmlNode getChild(String name)
name
- The child name.LionEngineException
- If no node is found at this child name.Collection<XmlNode> getChildren(String name)
name
- The children name.Collection<XmlNode> getChildren()
Map<String,String> getAttributes()
boolean hasAttribute(String attribute)
attribute
- The attribute name.true
if attribute exists, false
else.boolean hasChild(String child)
child
- The child name.true
if child exists, false
else.Copyright © 2016 Byron 3D Games Studio. All rights reserved.