Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.2 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javolution.xml
Class XMLFormat.InputElement

    java.lang.Object
      javolution.xml.XMLFormat.InputElement

Enclosing class:
  XMLFormat<T>

    public static final class XMLFormat.InputElement

extends java.lang.Object

This class represents an input XML element (unmarshalling).

Method Summary
`
`<T> T`
` | `get(java.lang.String name)` Returns the object whose type is identified by a XML class attribute only if the XML element has the specified local name.
`
`<T> T`
` | `get(java.lang.String name, java.lang.Class<T> cls)` Returns the object of specified type only if the XML element has the specified local name.
`
`<T> T`
` | `get(java.lang.String localName, java.lang.String uri)` Returns the object whose type is identified by a XML class attribute only if the XML element has the specified local name and URI.
`
`<T> T`
` | `get(java.lang.String localName, java.lang.String uri, java.lang.Class<T> cls)` Returns the object of specified type only if the XML element has the specified local name and namespace URI.
`CharArray` | `getAttribute(java.lang.String name)` Searches for the attribute having the specified name.
`boolean` | `getAttribute(java.lang.String name, boolean defaultValue)` Returns the specified `boolean` attribute.
`char` | `getAttribute(java.lang.String name, char defaultValue)` Returns the specified `char` attribute.
`double` | `getAttribute(java.lang.String name, double defaultValue)` Returns the specified `double` attribute.
`float` | `getAttribute(java.lang.String name, float defaultValue)` Returns the specified `float` attribute.
`int` | `getAttribute(java.lang.String name, int defaultValue)` Returns the specified `int` attribute.
`long` | `getAttribute(java.lang.String name, long defaultValue)` Returns the specified `long` attribute.
`java.lang.String` | `getAttribute(java.lang.String name, java.lang.String defaultValue)` Returns the specified `String` attribute.
`
`<T> T`
` | `getAttribute(java.lang.String name, T defaultValue)` Returns the attribute of same type as the specified default value.
`Attributes` | `getAttributes()` Returns the attributes for this XML input element.
`
`<T> T`
` | `getNext()` Returns the next object whose type is identified by the local name and URI of the current XML element (see `XMLBinding`).
`XMLStreamReader` | `getStreamReader()` Returns the StAX-like stream reader (provides complete control over the unmarshalling process).
`CharArray` | `getText()` Returns the content of a text-only element (equivalent to `getStreamReader().getElementText()`).
`boolean` | `hasNext()` Indicates if more nested XML element can be read.

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

Method Detail

### getStreamReader

    public XMLStreamReader getStreamReader()

  Returns the StAX-like stream reader (provides complete control over the unmarshalling process).

  Returns:
    the stream reader.

### hasNext

    public boolean hasNext()
                    throws XMLStreamException

  Indicates if more nested XML element can be read. This method positions the `reader` at the start of the next XML element to be read (if any).

  Returns:
    `true` if there is more XML element to be read; `false` otherwise.
  Throws:
    `XMLStreamException`

### getNext

    public <T> T getNext()
              throws XMLStreamException

  Returns the next object whose type is identified by the local name and URI of the current XML element (see `XMLBinding`).

  Returns:
    the next nested object which can be `null`.
  Throws:
    `XMLStreamException` - if `hasNext() == false`.

### get

    public <T> T get(java.lang.String name)
          throws XMLStreamException

  Returns the object whose type is identified by a XML class attribute only if the XML element has the specified local name.

  Parameters:
    `name` - the local name of the next element.
  Returns:
    the next nested object or `null`.
  Throws:
    `XMLStreamException`

### get

    public <T> T get(java.lang.String localName,
                     java.lang.String uri)
          throws XMLStreamException

  Returns the object whose type is identified by a XML class attribute only if the XML element has the specified local name and URI.

  Parameters:
    `localName` - the local name.
    `uri` - the namespace URI or `null`.
  Returns:
    the next nested object or `null`.
  Throws:
    `XMLStreamException`

### get

    public <T> T get(java.lang.String name,
                     java.lang.Class<T> cls)
          throws XMLStreamException

  Returns the object of specified type only if the XML element has the specified local name.

  Parameters:
    `name` - the local name of the element to match.
    `cls` - the class identifying the format of the object to return.
  Returns:
    the next nested object or `null`.
  Throws:
    `XMLStreamException`

### get

    public <T> T get(java.lang.String localName,
                     java.lang.String uri,
                     java.lang.Class<T> cls)
          throws XMLStreamException

  Returns the object of specified type only if the XML element has the specified local name and namespace URI.

  Parameters:
    `localName` - the local name.
    `uri` - the namespace URI or `null`.
    `cls` - the class identifying the format of the object to return.
  Returns:
    the next nested object or `null`.
  Throws:
    `XMLStreamException`

### getText

    public CharArray getText()
                      throws XMLStreamException

  Returns the content of a text-only element (equivalent to `getStreamReader().getElementText()`).

  Returns:
    the element text content or an empty sequence if none.
  Throws:
    `XMLStreamException`

### getAttributes

    public Attributes getAttributes()
                             throws XMLStreamException

  Returns the attributes for this XML input element.

  Returns:
    the attributes mapping.
  Throws:
    `XMLStreamException`

### getAttribute

    public CharArray getAttribute(java.lang.String name)
                           throws XMLStreamException

  Searches for the attribute having the specified name.

  Parameters:
    `name` - the name of the attribute.
  Returns:
    the value for the specified attribute or `null` if the attribute is not found.
  Throws:
    `XMLStreamException`

### getAttribute

    public java.lang.String getAttribute(java.lang.String name,
                                         java.lang.String defaultValue)
                                  throws XMLStreamException

  Returns the specified `String` attribute.

  Parameters:
    `name` - the name of the attribute.
    `defaultValue` - a default value.
  Returns:
    the value for the specified attribute or the `defaultValue` if the attribute is not found.
  Throws:
    `XMLStreamException`

### getAttribute

    public boolean getAttribute(java.lang.String name,
                                boolean defaultValue)
                         throws XMLStreamException

  Returns the specified `boolean` attribute.

  Parameters:
    `name` - the name of the attribute searched for.
    `defaultValue` - the value returned if the attribute is not found.
  Returns:
    the `boolean` value for the specified attribute or the default value if the attribute is not found.
  Throws:
    `XMLStreamException`

### getAttribute

    public char getAttribute(java.lang.String name,
                             char defaultValue)
                      throws XMLStreamException

  Returns the specified `char` attribute.

  Parameters:
    `name` - the name of the attribute searched for.
    `defaultValue` - the value returned if the attribute is not found.
  Returns:
    the `char` value for the specified attribute or the default value if the attribute is not found.
  Throws:
    `XMLStreamException`

### getAttribute

    public int getAttribute(java.lang.String name,
                            int defaultValue)
                     throws XMLStreamException

  Returns the specified `int` attribute. This method handles string formats that are used to represent octal and hexadecimal numbers.

  Parameters:
    `name` - the name of the attribute searched for.
    `defaultValue` - the value returned if the attribute is not found.
  Returns:
    the `int` value for the specified attribute or the default value if the attribute is not found.
  Throws:
    `XMLStreamException`

### getAttribute

    public long getAttribute(java.lang.String name,
                             long defaultValue)
                      throws XMLStreamException

  Returns the specified `long` attribute. This method handles string formats that are used to represent octal and hexadecimal numbers.

  Parameters:
    `name` - the name of the attribute searched for.
    `defaultValue` - the value returned if the attribute is not found.
  Returns:
    the `long` value for the specified attribute or the default value if the attribute is not found.
  Throws:
    `XMLStreamException`

### getAttribute

    public float getAttribute(java.lang.String name,
                              float defaultValue)
                       throws XMLStreamException

  Returns the specified `float` attribute.

  Parameters:
    `name` - the name of the attribute searched for.
    `defaultValue` - the value returned if the attribute is not found.
  Returns:
    the `float` value for the specified attribute or the default value if the attribute is not found. /
  Throws:
    `XMLStreamException`

### getAttribute

    public double getAttribute(java.lang.String name,
                               double defaultValue)
                        throws XMLStreamException

  Returns the specified `double` attribute.

  Parameters:
    `name` - the name of the attribute searched for.
    `defaultValue` - the value returned if the attribute is not found.
  Returns:
    the `double` value for the specified attribute or the default value if the attribute is not found. /
  Throws:
    `XMLStreamException`

### getAttribute

    public <T> T getAttribute(java.lang.String name,
                              T defaultValue)
                   throws XMLStreamException

  Returns the attribute of same type as the specified default value. The default value `TextFormat` is used to parse the attribute value.

  Parameters:
    `name` - the name of the attribute.
    `defaultValue` - the value returned if the attribute is not found.
  Returns:
    the parse value for the specified attribute or the default value if the attribute is not found.
  Throws:
    `XMLStreamException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.2 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005 - 2007 Javolution.