Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.newdawn.slick.util.xml
Class XMLElement

    java.lang.Object
      org.newdawn.slick.util.xml.XMLElement

    public class XMLElement

extends java.lang.Object

A utility wrapper round the standard DOM XML element. This provides a more simple API for accessing attributes, children and providing defaults when schemas arn't used - which is generally a little simpler for most of us.

Author:
  kevin

Method Summary
`java.lang.String` | `getAttribute(java.lang.String name)` Get the value specified for a given attribute on this element
`java.lang.String` | `getAttribute(java.lang.String name, java.lang.String def)` Get the value specified for a given attribute on this element
`java.lang.String[]` | `getAttributeNames()` Get the names of the attributes specified on this element
`boolean` | `getBooleanAttribute(java.lang.String name)` Get the value specified for a given attribute on this element as a boolean.
`boolean` | `getBooleanAttribute(java.lang.String name, boolean def)` Get the value specified for a given attribute on this element as a boolean.
`XMLElementList` | `getChildren()` Get the complete list of children for this node
`XMLElementList` | `getChildrenByName(java.lang.String name)` Get a list of children with a given element name
`java.lang.String` | `getContent()` Get the text content of the element, i.e.
`double` | `getDoubleAttribute(java.lang.String name)` Get the value specified for a given attribute on this element as an double.
`double` | `getDoubleAttribute(java.lang.String name, double def)` Get the value specified for a given attribute on this element as an double.
`int` | `getIntAttribute(java.lang.String name)` Get the value specified for a given attribute on this element as an integer.
`int` | `getIntAttribute(java.lang.String name, int def)` Get the value specified for a given attribute on this element as an integer.
`java.lang.String` | `getName()` Get the name of this element
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Method Detail

### getAttributeNames

    public java.lang.String[] getAttributeNames()

  Get the names of the attributes specified on this element

  Returns:
    The names of the elements specified

### getName

    public java.lang.String getName()

  Get the name of this element

  Returns:
    The name of this element

### getAttribute

    public java.lang.String getAttribute(java.lang.String name)

  Get the value specified for a given attribute on this element

  Parameters:
    `name` - The name of the attribute whose value should be retrieved
  Returns:
    The value given for the attribute

### getAttribute

    public java.lang.String getAttribute(java.lang.String name,
                                         java.lang.String def)

  Get the value specified for a given attribute on this element

  Parameters:
    `name` - The name of the attribute whose value should be retrieved
    `def` - The default value to return if the attribute is specified
  Returns:
    The value given for the attribute

### getIntAttribute

    public int getIntAttribute(java.lang.String name)
                        throws SlickXMLException

  Get the value specified for a given attribute on this element as an integer.

  Parameters:
    `name` - The name of the attribute whose value should be retrieved
  Returns:
    The value given for the attribute
  Throws:
    `SlickXMLException` - Indicates a failure to convert the value into an integer

### getIntAttribute

    public int getIntAttribute(java.lang.String name,
                               int def)
                        throws SlickXMLException

  Get the value specified for a given attribute on this element as an integer.

  Parameters:
    `name` - The name of the attribute whose value should be retrieved
    `def` - The default value to return if the attribute is specified
  Returns:
    The value given for the attribute
  Throws:
    `SlickXMLException` - Indicates a failure to convert the value into an integer

### getDoubleAttribute

    public double getDoubleAttribute(java.lang.String name)
                              throws SlickXMLException

  Get the value specified for a given attribute on this element as an double.

  Parameters:
    `name` - The name of the attribute whose value should be retrieved
  Returns:
    The value given for the attribute
  Throws:
    `SlickXMLException` - Indicates a failure to convert the value into an double

### getDoubleAttribute

    public double getDoubleAttribute(java.lang.String name,
                                     double def)
                              throws SlickXMLException

  Get the value specified for a given attribute on this element as an double.

  Parameters:
    `name` - The name of the attribute whose value should be retrieved
    `def` - The default value to return if the attribute is specified
  Returns:
    The value given for the attribute
  Throws:
    `SlickXMLException` - Indicates a failure to convert the value into an double

### getBooleanAttribute

    public boolean getBooleanAttribute(java.lang.String name)
                                throws SlickXMLException

  Get the value specified for a given attribute on this element as a boolean.

  Parameters:
    `name` - The name of the attribute whose value should be retrieved
  Returns:
    The value given for the attribute
  Throws:
    `SlickXMLException` - Indicates a failure to convert the value into an boolean

### getBooleanAttribute

    public boolean getBooleanAttribute(java.lang.String name,
                                       boolean def)
                                throws SlickXMLException

  Get the value specified for a given attribute on this element as a boolean.

  Parameters:
    `name` - The name of the attribute whose value should be retrieved
    `def` - The default value to return if the attribute is specified
  Returns:
    The value given for the attribute
  Throws:
    `SlickXMLException` - Indicates a failure to convert the value into an boolean

### getContent

    public java.lang.String getContent()

  Get the text content of the element, i.e. the bit between the tags

  Returns:
    The text content of the node

### getChildren

    public XMLElementList getChildren()

  Get the complete list of children for this node

  Returns:
    The list of children for this node

### getChildrenByName

    public XMLElementList getChildrenByName(java.lang.String name)

  Get a list of children with a given element name

  Parameters:
    `name` - The name of the element type that should be retrieved
  Returns:
    A list of elements

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`
  See Also:
    `Object.toString()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 New Dawn Software. All Rights Reserved.