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

## org.apache.cayenne.xml
Class XMLDecoder

    java.lang.Object
      org.apache.cayenne.xml.XMLDecoder

    public class XMLDecoder

extends java.lang.Object

XMLDecoder is used to decode XML into objects.

Since:
  1.2
Author:
  Kevin J. Menard, Jr.

Constructor Summary
`XMLDecoder()` Default constructor.
`XMLDecoder(DataContext dc)` Creates an XMLDecoder that will register decoded DataObjects with the specified DataContext.

Method Summary
`java.lang.Object` | `decode(java.io.Reader xml)` Decodes XML wrapped by a Reader into an object.
`java.lang.Object` | `decode(java.io.Reader xml, java.lang.String mappingUrl)` Decodes XML wrapped by a Reader into an object, using the supplied mapping file to guide the decoding process.
`java.lang.Boolean` | `decodeBoolean(java.lang.String xmlTag)` Decodes an XML element to a Boolean.
`java.lang.Double` | `decodeDouble(java.lang.String xmlTag)` Decodes an XML element to a Double.
`java.lang.Float` | `decodeFloat(java.lang.String xmlTag)` Decodes an XML element to a Float.
`java.lang.Integer` | `decodeInteger(java.lang.String xmlTag)` Decodes an XML element to an Integer.
`static java.util.List` | `decodeList(java.io.Reader xml)` Decodes a list of DataObjects.
`static java.util.List` | `decodeList(java.io.Reader xml, DataContext dc)` Decodes a list of DataObjects, registering them the supplied DataContext.
`static java.util.List` | `decodeList(java.io.Reader xml, java.lang.String mappingUrl)` Decodes a list of DataObjects using the supplied mapping file to guide the decoding process.
`static java.util.List` | `decodeList(java.io.Reader xml, java.lang.String mappingUrl, DataContext dataContext)` Decodes a list of DataObjects using the supplied mapping file to guide the decoding process, registering them the supplied DataContext.
`java.lang.Object` | `decodeObject(java.lang.String xmlTag)` Decodes an object from XML.
`java.lang.String` | `decodeString(java.lang.String xmlTag)` Decodes an XML element to a String.

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

Constructor Detail

### XMLDecoder

    public XMLDecoder()

  Default constructor. This will create an XMLDecoder instance that will decode objects from XML, but will not register them with any DataContext.

  See Also:
    `XMLDecoder(DataContext)`

### XMLDecoder

    public XMLDecoder(DataContext dc)

  Creates an XMLDecoder that will register decoded DataObjects with the specified DataContext.

  Parameters:
    `dc` - The DataContext to register decoded DataObjects with.

Method Detail

### decodeBoolean

    public java.lang.Boolean decodeBoolean(java.lang.String xmlTag)

  Decodes an XML element to a Boolean.

  Parameters:
    `xmlTag` - The tag identifying the element.
  Returns:
    The tag's value.

### decodeDouble

    public java.lang.Double decodeDouble(java.lang.String xmlTag)

  Decodes an XML element to a Double.

  Parameters:
    `xmlTag` - The tag identifying the element.
  Returns:
    The tag's value.

### decodeFloat

    public java.lang.Float decodeFloat(java.lang.String xmlTag)

  Decodes an XML element to a Float.

  Parameters:
    `xmlTag` - The tag identifying the element.
  Returns:
    The tag's value.

### decodeInteger

    public java.lang.Integer decodeInteger(java.lang.String xmlTag)

  Decodes an XML element to an Integer.

  Parameters:
    `xmlTag` - The tag identifying the element.
  Returns:
    The tag's value.

### decodeObject

    public java.lang.Object decodeObject(java.lang.String xmlTag)

  Decodes an object from XML.

  Parameters:
    `xmlTag` - The XML tag corresponding to the root of the encoded object.
  Returns:
    The decoded object.

### decodeString

    public java.lang.String decodeString(java.lang.String xmlTag)

  Decodes an XML element to a String.

  Parameters:
    `xmlTag` - The tag identifying the element.
  Returns:
    The tag's value.

### decode

    public java.lang.Object decode(java.io.Reader xml)
                            throws CayenneRuntimeException

  Decodes XML wrapped by a Reader into an object.

  Parameters:
    `xml` - Wrapped XML.
  Returns:
    A new instance of the object represented by the XML.
  Throws:
    `CayenneRuntimeException`

### decode

    public java.lang.Object decode(java.io.Reader xml,
                                   java.lang.String mappingUrl)
                            throws CayenneRuntimeException

  Decodes XML wrapped by a Reader into an object, using the supplied mapping file to guide the decoding process.

  Parameters:
    `xml` - Wrapped XML.
    `mappingUrl` - Mapping file describing how the XML elements and object properties correlate.
  Returns:
    A new instance of the object represented by the XML.
  Throws:
    `CayenneRuntimeException`

### decodeList

    public static java.util.List decodeList(java.io.Reader xml)
                                     throws CayenneRuntimeException

  Decodes a list of DataObjects.

  Parameters:
    `xml` - The wrapped XML encoding of the list of DataObjects.
  Returns:
    The list of decoded DataObjects.
  Throws:
    `CayenneRuntimeException`

### decodeList

    public static java.util.List decodeList(java.io.Reader xml,
                                            DataContext dc)
                                     throws CayenneRuntimeException

  Decodes a list of DataObjects, registering them the supplied DataContext.

  Parameters:
    `xml` - The wrapped XML encoding of the list of DataObjects.
    `dc` - The DataContext to register the decode DataObjects with.
  Returns:
    The list of decoded DataObjects.
  Throws:
    `CayenneRuntimeException`

### decodeList

    public static java.util.List decodeList(java.io.Reader xml,
                                            java.lang.String mappingUrl)
                                     throws CayenneRuntimeException

  Decodes a list of DataObjects using the supplied mapping file to guide the decoding process.

  Parameters:
    `xml` - The wrapped XML encoding of the list of DataObjects.
    `mappingUrl` - Mapping file describing how the XML elements and object properties correlate.
  Returns:
    The list of decoded DataObjects.
  Throws:
    `CayenneRuntimeException`

### decodeList

    public static java.util.List decodeList(java.io.Reader xml,
                                            java.lang.String mappingUrl,
                                            DataContext dataContext)
                                     throws CayenneRuntimeException

  Decodes a list of DataObjects using the supplied mapping file to guide the decoding process, registering them the supplied DataContext.

  Parameters:
    `xml` - The wrapped XML encoding of the list of objects.
    `mappingUrl` - Mapping file describing how the XML elements and object properties correlate.
    `dataContext` - The DataContext to register the decode DataObjects with.
  Returns:
    The list of decoded DataObjects.
  Throws:
    `CayenneRuntimeException`

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

Copyright © 2001-2006 Apache.org All Rights Reserved.