Package com.badlogic.gdx.utils
Class XmlReader.Element
- java.lang.Object
-
- com.badlogic.gdx.utils.XmlReader.Element
-
- Enclosing class:
- XmlReader
public static class XmlReader.Element extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Element(java.lang.String name, XmlReader.Element parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(XmlReader.Element element)
java.lang.String
get(java.lang.String name)
Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.java.lang.String
get(java.lang.String name, java.lang.String defaultValue)
Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.java.lang.String
getAttribute(java.lang.String name)
java.lang.String
getAttribute(java.lang.String name, java.lang.String defaultValue)
ObjectMap<java.lang.String,java.lang.String>
getAttributes()
boolean
getBoolean(java.lang.String name)
Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.boolean
getBoolean(java.lang.String name, boolean defaultValue)
Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.boolean
getBooleanAttribute(java.lang.String name)
boolean
getBooleanAttribute(java.lang.String name, boolean defaultValue)
XmlReader.Element
getChild(int index)
XmlReader.Element
getChildByName(java.lang.String name)
XmlReader.Element
getChildByNameRecursive(java.lang.String name)
int
getChildCount()
Array<XmlReader.Element>
getChildrenByName(java.lang.String name)
Array<XmlReader.Element>
getChildrenByNameRecursively(java.lang.String name)
float
getFloat(java.lang.String name)
Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.float
getFloat(java.lang.String name, float defaultValue)
Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.float
getFloatAttribute(java.lang.String name)
float
getFloatAttribute(java.lang.String name, float defaultValue)
int
getInt(java.lang.String name)
Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.int
getInt(java.lang.String name, int defaultValue)
Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.int
getIntAttribute(java.lang.String name)
int
getIntAttribute(java.lang.String name, int defaultValue)
java.lang.String
getName()
XmlReader.Element
getParent()
java.lang.String
getText()
boolean
hasAttribute(java.lang.String name)
boolean
hasChild(java.lang.String name)
boolean
hasChildRecursive(java.lang.String name)
void
remove()
void
removeChild(int index)
void
removeChild(XmlReader.Element child)
void
setAttribute(java.lang.String name, java.lang.String value)
void
setText(java.lang.String text)
java.lang.String
toString()
java.lang.String
toString(java.lang.String indent)
-
-
-
Constructor Detail
-
Element
public Element(java.lang.String name, XmlReader.Element parent)
-
-
Method Detail
-
getName
public java.lang.String getName()
-
getAttributes
public ObjectMap<java.lang.String,java.lang.String> getAttributes()
-
getAttribute
public java.lang.String getAttribute(java.lang.String name)
- Throws:
GdxRuntimeException
- if the attribute was not found.
-
getAttribute
public java.lang.String getAttribute(java.lang.String name, java.lang.String defaultValue)
-
hasAttribute
public boolean hasAttribute(java.lang.String name)
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.String value)
-
getChildCount
public int getChildCount()
-
getChild
public XmlReader.Element getChild(int index)
- Throws:
GdxRuntimeException
- if the element has no children.
-
addChild
public void addChild(XmlReader.Element element)
-
getText
public java.lang.String getText()
-
setText
public void setText(java.lang.String text)
-
removeChild
public void removeChild(int index)
-
removeChild
public void removeChild(XmlReader.Element child)
-
remove
public void remove()
-
getParent
public XmlReader.Element getParent()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toString
public java.lang.String toString(java.lang.String indent)
-
getChildByName
@Null public XmlReader.Element getChildByName(java.lang.String name)
- Parameters:
name
- the name of the childXmlReader.Element
- Returns:
- the first child having the given name or null, does not recurse
-
hasChild
public boolean hasChild(java.lang.String name)
-
getChildByNameRecursive
@Null public XmlReader.Element getChildByNameRecursive(java.lang.String name)
- Parameters:
name
- the name of the childXmlReader.Element
- Returns:
- the first child having the given name or null, recurses
-
hasChildRecursive
public boolean hasChildRecursive(java.lang.String name)
-
getChildrenByName
public Array<XmlReader.Element> getChildrenByName(java.lang.String name)
- Parameters:
name
- the name of the children- Returns:
- the children with the given name or an empty
Array
-
getChildrenByNameRecursively
public Array<XmlReader.Element> getChildrenByNameRecursively(java.lang.String name)
- Parameters:
name
- the name of the children- Returns:
- the children with the given name or an empty
Array
-
getFloatAttribute
public float getFloatAttribute(java.lang.String name)
- Throws:
GdxRuntimeException
- if the attribute was not found.
-
getFloatAttribute
public float getFloatAttribute(java.lang.String name, float defaultValue)
-
getIntAttribute
public int getIntAttribute(java.lang.String name)
- Throws:
GdxRuntimeException
- if the attribute was not found.
-
getIntAttribute
public int getIntAttribute(java.lang.String name, int defaultValue)
-
getBooleanAttribute
public boolean getBooleanAttribute(java.lang.String name)
- Throws:
GdxRuntimeException
- if the attribute was not found.
-
getBooleanAttribute
public boolean getBooleanAttribute(java.lang.String name, boolean defaultValue)
-
get
public java.lang.String get(java.lang.String name)
Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.- Throws:
GdxRuntimeException
- if no attribute or child was not found.
-
get
public java.lang.String get(java.lang.String name, java.lang.String defaultValue)
Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.- Throws:
GdxRuntimeException
- if no attribute or child was not found.
-
getInt
public int getInt(java.lang.String name)
Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.- Throws:
GdxRuntimeException
- if no attribute or child was not found.
-
getInt
public int getInt(java.lang.String name, int defaultValue)
Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.- Throws:
GdxRuntimeException
- if no attribute or child was not found.
-
getFloat
public float getFloat(java.lang.String name)
Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.- Throws:
GdxRuntimeException
- if no attribute or child was not found.
-
getFloat
public float getFloat(java.lang.String name, float defaultValue)
Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.- Throws:
GdxRuntimeException
- if no attribute or child was not found.
-
getBoolean
public boolean getBoolean(java.lang.String name)
Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.- Throws:
GdxRuntimeException
- if no attribute or child was not found.
-
getBoolean
public boolean getBoolean(java.lang.String name, boolean defaultValue)
Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.- Throws:
GdxRuntimeException
- if no attribute or child was not found.
-
-