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 voidaddChild(XmlReader.Element element)java.lang.Stringget(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.Stringget(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.StringgetAttribute(java.lang.String name)java.lang.StringgetAttribute(java.lang.String name, java.lang.String defaultValue)ObjectMap<java.lang.String,java.lang.String>getAttributes()booleangetBoolean(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.booleangetBoolean(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.booleangetBooleanAttribute(java.lang.String name)booleangetBooleanAttribute(java.lang.String name, boolean defaultValue)XmlReader.ElementgetChild(int index)XmlReader.ElementgetChildByName(java.lang.String name)XmlReader.ElementgetChildByNameRecursive(java.lang.String name)intgetChildCount()Array<XmlReader.Element>getChildrenByName(java.lang.String name)Array<XmlReader.Element>getChildrenByNameRecursively(java.lang.String name)floatgetFloat(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.floatgetFloat(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.floatgetFloatAttribute(java.lang.String name)floatgetFloatAttribute(java.lang.String name, float defaultValue)intgetInt(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.intgetInt(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.intgetIntAttribute(java.lang.String name)intgetIntAttribute(java.lang.String name, int defaultValue)java.lang.StringgetName()XmlReader.ElementgetParent()java.lang.StringgetText()booleanhasAttribute(java.lang.String name)booleanhasChild(java.lang.String name)booleanhasChildRecursive(java.lang.String name)voidremove()voidremoveChild(int index)voidremoveChild(XmlReader.Element child)voidsetAttribute(java.lang.String name, java.lang.String value)voidsetText(java.lang.String text)java.lang.StringtoString()java.lang.StringtoString(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:
toStringin 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.
-
-