com.badlogic.gdx.utils
Class XmlReader.Element

java.lang.Object
  extended by com.badlogic.gdx.utils.XmlReader.Element
Enclosing class:
XmlReader

public static class XmlReader.Element
extends Object


Constructor Summary
XmlReader.Element(String name, XmlReader.Element parent)
           
 
Method Summary
 void addChild(XmlReader.Element element)
           
 String get(String name)
          Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.
 String get(String name, String defaultValue)
          Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name.
 String getAttribute(String name)
           
 String getAttribute(String name, String defaultValue)
           
 ObjectMap<String,String> getAttributes()
           
 boolean getBoolean(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(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(String name)
           
 boolean getBooleanAttribute(String name, boolean defaultValue)
           
 XmlReader.Element getChild(int i)
           
 XmlReader.Element getChildByName(String name)
           
 XmlReader.Element getChildByNameRecursive(String name)
           
 int getChildCount()
           
 Array<XmlReader.Element> getChildrenByName(String name)
           
 Array<XmlReader.Element> getChildrenByNameRecursively(String name)
           
 float getFloat(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(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(String name)
           
 float getFloatAttribute(String name, float defaultValue)
           
 int getInt(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(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(String name)
           
 int getIntAttribute(String name, int defaultValue)
           
 String getName()
           
 XmlReader.Element getParent()
           
 String getText()
           
 void remove()
           
 void removeChild(int index)
           
 void removeChild(XmlReader.Element child)
           
 void setAttribute(String name, String value)
           
 void setText(String text)
           
 String toString()
           
 String toString(String indent)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XmlReader.Element

public XmlReader.Element(String name,
                         XmlReader.Element parent)
Method Detail

getName

public String getName()

getAttributes

public ObjectMap<String,String> getAttributes()

getAttribute

public String getAttribute(String name)
Throws:
GdxRuntimeException - if the attribute was not found.

getAttribute

public String getAttribute(String name,
                           String defaultValue)

setAttribute

public void setAttribute(String name,
                         String value)

getChildCount

public int getChildCount()

getChild

public XmlReader.Element getChild(int i)
Throws:
GdxRuntimeException - if the element has no children.

addChild

public void addChild(XmlReader.Element element)

getText

public String getText()

setText

public void setText(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 String toString()
Overrides:
toString in class Object

toString

public String toString(String indent)

getChildByName

public XmlReader.Element getChildByName(String name)
Parameters:
name - the name of the child XmlReader.Element
Returns:
the first child having the given name or null, does not recurse

getChildByNameRecursive

public XmlReader.Element getChildByNameRecursive(String name)
Parameters:
name - the name of the child XmlReader.Element
Returns:
the first child having the given name or null, recurses

getChildrenByName

public Array<XmlReader.Element> getChildrenByName(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(String name)
Parameters:
name - the name of the children
Returns:
the children with the given name or an empty Array

getFloatAttribute

public float getFloatAttribute(String name)
Throws:
GdxRuntimeException - if the attribute was not found.

getFloatAttribute

public float getFloatAttribute(String name,
                               float defaultValue)

getIntAttribute

public int getIntAttribute(String name)
Throws:
GdxRuntimeException - if the attribute was not found.

getIntAttribute

public int getIntAttribute(String name,
                           int defaultValue)

getBooleanAttribute

public boolean getBooleanAttribute(String name)
Throws:
GdxRuntimeException - if the attribute was not found.

getBooleanAttribute

public boolean getBooleanAttribute(String name,
                                   boolean defaultValue)

get

public String get(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 String get(String name,
                  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(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(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(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(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(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(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.


Copyright © 2013. All Rights Reserved.