public class Xml extends XmlReader
Note: Special case for the string stored as null
which is in fact stored as XmlReader.NULL
. When
read, the XmlReader.NULL
string is return if the stored string was null
.
Example:
final XmlNode node = XmlFactory.createXmlNode("node"); node.writeBoolean("value", true);
Constructor and Description |
---|
Xml(Media media)
Create node from media.
|
Xml(String name)
Create node.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Xml node)
Add a child node.
|
Xml |
createChild(String child)
Create a child node.
|
Xml |
getChild(String name)
Get a child node from its name.
|
Collection<Xml> |
getChildren()
Get list of all children.
|
Collection<Xml> |
getChildren(String name)
Get the list of all children with this name.
|
void |
removeAttribute(String attribute)
Remove attribute.
|
void |
removeChild(String child)
Remove child.
|
void |
removeChild(Xml child)
Remove child.
|
void |
removeChildren(String children)
Remove all children.
|
void |
save(Media media)
Save an XML tree to a file.
|
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.
|
getAttributes, getNodeName, getText, hasAttribute, hasChild, readBoolean, readBoolean, readByte, readByte, readDouble, readDouble, readFloat, readFloat, readInteger, readInteger, readLong, readLong, readShort, readShort, readString, readString
public Xml(Media media)
media
- The XML media path.LionEngineException
- If error when loading media.public Xml(String name)
name
- The node name.LionEngineException
- If error when creating the node.public void save(Media media)
media
- The output media path.LionEngineException
- If error when saving media.public Xml createChild(String child)
child
- The child name.public void add(Xml node)
node
- The child node.LionEngineException
- If error when adding the node.public void setText(String text)
text
- The text content.LionEngineException
- If error when setting the node text.public void writeBoolean(String attribute, boolean content)
attribute
- The attribute name.content
- The boolean value.LionEngineException
- If error when writing.public void writeByte(String attribute, byte content)
attribute
- The attribute name.content
- The byte value.LionEngineException
- If error when writing.public void writeShort(String attribute, short content)
attribute
- The attribute name.content
- The short value.LionEngineException
- If error when writing.public void writeInteger(String attribute, int content)
attribute
- The attribute name.content
- The integer value.LionEngineException
- If error when writing.public void writeLong(String attribute, long content)
attribute
- The attribute name.content
- The long value.LionEngineException
- If error when writing.public void writeFloat(String attribute, float content)
attribute
- The float name.content
- The float value.LionEngineException
- If error when writing.public void writeDouble(String attribute, double content)
attribute
- The attribute name.content
- The double value.LionEngineException
- If error when writing.public void writeString(String attribute, String content)
null
, XmlReader.NULL
is wrote instead.attribute
- The attribute name.content
- The string value.LionEngineException
- If error when writing.public void removeAttribute(String attribute)
attribute
- The attribute to remove.public void removeChild(String child)
child
- The child to remove.LionEngineException
- If no node is found at this child name.public void removeChild(Xml child)
child
- The child to remove.public void removeChildren(String children)
children
- The children to remove.public Xml getChild(String name)
name
- The child name.LionEngineException
- If no node is found at this child name.public Collection<Xml> getChildren(String name)
name
- The children name.public Collection<Xml> getChildren()
Copyright © 2017 Byron 3D Games Studio. All rights reserved.