org.exolab.castor.xml
public class Unmarshaller extends Object
Version: $Revision: 6392 $ $Date: 2006-02-23 14:16:51 -0700 (Thu, 23 Feb 2006) $
Field Summary | |
---|---|
EntityResolver | entityResolver
The EntityResolver used for resolving entities |
Constructor Summary | |
---|---|
Unmarshaller()
Creates a new basic Unmarshaller
When using this constructor it will most likely be
necessary to use a mapping file or ClassDescriptorResolver
So that the Unmarshaller can find the classes during the
unmarshalling process. | |
Unmarshaller(Class c)
Creates a new Unmarshaller with the given Class
| |
Unmarshaller(Class c, ClassLoader loader)
Creates a new Unmarshaller with the given Class
| |
Unmarshaller(Mapping mapping)
Creates a new Unmarshaller with the given Mapping
| |
Unmarshaller(Object root)
Creates a new Unmarshaller with the given Object
|
Method Summary | |
---|---|
void | addNamespaceToPackageMapping(String nsURI, String packageName)
Adds a mapping from the given namespace URI to the given
package name
|
UnmarshalHandler | createHandler()
Creates and initalizes an UnmarshalHandler |
static ContentHandler | getContentHandler(UnmarshalHandler handler)
Returns a ContentHandler for the given UnmarshalHandler
|
void | setClassLoader(ClassLoader loader)
Sets the ClassLoader to use when loading new classes.
|
void | setClearCollections(boolean clear)
Sets whether or not to clear collections (including arrays)
upon first use to remove default values. |
void | setDebug(boolean debug)
Turns debuging on or off. |
void | setEntityResolver(EntityResolver entityResolver)
Sets the EntityResolver to use when resolving system and
public ids with respect to entites and Document Type. |
void | setIDResolver(IDResolver idResolver)
Sets the IDResolver to use when resolving IDREFs for
which no associated element may exist in XML document.
|
void | setIgnoreExtraAttributes(boolean ignoreExtraAtts)
Sets whether or not attributes that do not match
a specific field should simply be ignored or
reported as an error. |
void | setIgnoreExtraElements(boolean ignoreExtraElements)
Sets whether or not elements that do not match
a specific field should simply be ignored or
reported as an error. |
void | setLogWriter(PrintWriter printWriter)
Sets the PrintWriter used for logging |
void | setMapping(Mapping mapping)
Sets the Mapping to use during unmarshalling. |
void | setObjectFactory(ObjectFactory objectFactory)
Set an object factory for the unmarshaller. |
void | setResolver(XMLClassDescriptorResolver cdr)
Sets the ClassDescriptorResolver to use during unmarshalling |
void | setReuseObjects(boolean reuse)
Sets a boolean that when true indicates that objects
contained within the object model should be re-used
where appropriate. |
void | setUnmarshalListener(UnmarshalListener listener)
Sets an optional UnmarshalListener to receive pre and
post unmarshal notification for each Object in the tree.
|
void | setValidation(boolean validate)
Sets the flag for validation.
|
void | setWhitespacePreserve(boolean preserve)
Sets the top-level whitespace (xml:space) to either
preserving or non preserving. |
Object | unmarshal(Reader reader)
Unmarshals Objects of this Unmarshaller's Class type.
|
Object | unmarshal(EventProducer eventProducer)
Unmarshals Objects of this Unmarshaller's Class type.
|
Object | unmarshal(SAX2EventProducer eventProducer)
Unmarshals Objects of this Unmarshaller's Class type.
|
Object | unmarshal(InputSource source)
Unmarshals Objects of this Unmarshaller's Class type.
|
Object | unmarshal(Node node)
Unmarshals Objects of this Unmarshaller's Class type.
|
static Object | unmarshal(Class c, Reader reader)
Unmarshals Objects of the given Class type. |
static Object | unmarshal(Class c, InputSource source)
Unmarshals Objects of the given Class type. |
static Object | unmarshal(Class c, Node node)
Unmarshals Objects of the given Class type. |
Parameters: c the Class to create the Unmarshaller for, this may be null, if the Unmarshaller#setMapping is called to load a mapping for the root element of xml document.
Parameters: c the Class to create the Unmarshaller for, this may be null, if the Unmarshaller#setMapping is called to load a mapping for the root element of xml document. loader The ClassLoader to use.
Parameters: mapping The Mapping to use.
Parameters: root the instance to unmarshal into. This may be null, if the Unmarshaller#setMapping is called to load a mapping for the root element of xml document.
Parameters: nsURI the namespace URI to map from packageName the package name to map to
Returns: the new UnmarshalHandler
Returns: the ContentHandler
Parameters: loader the ClassLoader to use
Parameters: clear the boolean value that when true indicates collections should be cleared upon first use.
Parameters: debug the flag indicating whether to generate debug information. A value of true, will turn debuggin on.
See Also: Unmarshaller
Parameters: entityResolver the EntityResolver to use when resolving System and Public ids.
Parameters: idResolver the IDResolver to use when resolving IDREFs for which no associated element may exist in the XML document.
Parameters: ignoreExtraAtts a boolean that when true will allow non-matched attributes to simply be ignored.
Parameters: ignoreExtraElements a boolean that when true will allow non-matched elements to simply be ignored.
Parameters: printWriter the PrintWriter to use for logging
Parameters: mapping Mapping to use during unmarshalling.
See Also: Unmarshaller
Parameters: objectFactory Factory used for constructing objects during unmarshalling.
Parameters: cdr the ClassDescriptorResolver to use
See Also:
Note: This method will nullify any Mapping
currently being used by this Unmarshaller
Parameters: reuse the boolean indicating whether or not to re-use existing objects in the object model.
Parameters: listener the UnmarshalListener to set.
Parameters: validate A boolean to indicate whether or not validation should be done
during umarshalling.
By default validation will be performed.
Parameters: preserve a boolean that when true enables whitespace preserving by default.
Parameters: reader the Reader to read the XML from
Throws: MarshalException when there is an error during the unmarshalling process ValidationException when there is a validation error
Deprecated: please use @see #unmarshal(SAX2EventProducer) instead.
Unmarshals Objects of this Unmarshaller's Class type. The Class must specify the proper access methods (setters/getters) in order for instances of the Class to be properly unmarshalled.Parameters: eventProducer the EventProducer which produces the SAX events
Throws: MarshalException when there is an error during the unmarshalling process ValidationException when there is a validation error
Parameters: eventProducer the SAX2EventProducer instance which produces the SAX 2 events
Throws: MarshalException when there is an error during the unmarshalling process ValidationException when there is a validation error
Since: 1.0M3
Parameters: source the InputSource to read the XML from
Throws: MarshalException when there is an error during the unmarshalling process ValidationException when there is a validation error
Parameters: node the DOM node to read the XML from
Throws: MarshalException when there is an error during the unmarshalling process ValidationException when there is a validation error
Note:This is a *static* method, any mapping files set on a particular Unmarshaller instance, and any changes made via setters will be unavailable to this method.
Parameters: c the Class to create a new instance of reader the Reader to read the XML from
Throws: MarshalException when there is an error during the unmarshalling process ValidationException when there is a validation error
Note:This is a *static* method, any mapping files set on a particular Unmarshaller instance, and any changes made via setters will be unavailable to this method.
Parameters: c the Class to create a new instance of source the InputSource to read the XML from
Throws: MarshalException when there is an error during the unmarshalling process ValidationException when there is a validation error
Note:This is a *static* method, any mapping files set on a particular Unmarshaller instance, and any changes made via setters will be unavailable to this method.
Parameters: c The Class to create a new instance of. node The DOM Node to read the XML from.
Throws: MarshalException When there is an error during the unmarshalling process. ValidationException When there is a validation error.