public class Unmarshaller
extends java.lang.Object
| Modifier and Type | Field | Description | 
|---|---|---|
| (package private) org.xml.sax.EntityResolver | entityResolver | The EntityResolver used for resolving entities | 
| Constructor | Description | 
|---|---|
| Unmarshaller() | An empty default constructor which:
 - sets the internal context to the backward compatibility context
 - all other flags to defaults
 Internally the Unmarshaller(Class) constructor is called. | 
| Unmarshaller(java.lang.Class clazz) | A constructor which sets the root class. | 
| Unmarshaller(java.lang.Object root) | Creates a new Unmarshaller with the given Object. | 
| Unmarshaller(InternalContext internalContext) | Creates a new basic Unmarshaller. | 
| Unmarshaller(InternalContext internalContext,
            java.lang.Class c) | Creates a new Unmarshaller with the given Class. | 
| Unmarshaller(InternalContext internalContext,
            java.lang.Class c,
            java.lang.ClassLoader loader) | Creates a new  Unmarshallerwith the given Class. | 
| Unmarshaller(InternalContext internalContext,
            java.lang.Object root) | Creates a new Unmarshaller with the given Object. | 
| Unmarshaller(InternalContext internalContext,
            Mapping mapping) | Creates a new Unmarshaller with the given Mapping. | 
| Unmarshaller(Mapping mapping) | Creates a new Unmarshaller with the given Mapping. | 
| Modifier and Type | Method | Description | 
|---|---|---|
| void | addNamespaceToPackageMapping(java.lang.String nsURI,
                            java.lang.String packageName) | Adds a mapping from the given namespace URI to the given
 package name. | 
| UnmarshalHandler | createHandler() | Creates and initalizes an UnmarshalHandler | 
| static org.xml.sax.ContentHandler | getContentHandler(UnmarshalHandler handler) | Returns a ContentHandler for the given UnmarshalHandler | 
| InternalContext | getInternalContext() | To get the internal XML Context that is in use. | 
| java.lang.String | getProperty(java.lang.String name) | Returns the value of the given Castor XML-specific property. | 
| boolean | isValidating() | Indicates whether or not validation should be performed during umarshalling. | 
| void | setClass(java.lang.Class clazz) | Sets the 'expected'  Classinstance on the Unmarshaller. | 
| void | setClassLoader(java.lang.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) | Deprecated.  | 
| void | setEntityResolver(org.xml.sax.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 | setInternalContext(InternalContext internalContext) | To set the internal XML Context to be used. | 
| void | setLogWriter(java.io.PrintWriter printWriter) | Deprecated.  | 
| void | setMapping(Mapping mapping) | Sets the Mapping to use during unmarshalling. | 
| void | setObject(java.lang.Object root) | Sets the 'expected'  Objectinstance on the Unmarshaller, into
 which will be unmarshalled. | 
| void | setObjectFactory(ObjectFactory objectFactory) | Set an object factory for the unmarshaller. | 
| void | setProperty(java.lang.String name,
           java.lang.String value) | Sets a custom value of a given Castor XML-specific property. | 
| void | setResolver(XMLClassDescriptorResolver xmlClassDescriptorResolver) | Sets the XMLClassDescriptorResolver 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  UnmarshalListenerto receive pre and
 post unmarshal notification for each Object in the tree. | 
| void | setUnmarshalListener(UnmarshalListener listener) | Deprecated.
 replaced by  UnmarshalListener | 
| 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. | 
| java.lang.Object | unmarshal(java.io.Reader reader) | Unmarshals Objects of this Unmarshaller's Class type. | 
| static java.lang.Object | unmarshal(java.lang.Class c,
         java.io.Reader reader) | Unmarshals Objects of the given Class type. | 
| static java.lang.Object | unmarshal(java.lang.Class c,
         org.w3c.dom.Node node) | Unmarshals Objects of the given Class type. | 
| static java.lang.Object | unmarshal(java.lang.Class c,
         org.xml.sax.InputSource source) | Unmarshals Objects of the given Class type. | 
| java.lang.Object | unmarshal(javax.xml.stream.XMLEventReader eventReader) | Unmarshals objects of this  Unmarshaller's class type. | 
| java.lang.Object | unmarshal(javax.xml.stream.XMLStreamReader streamReader) | Unmarshals objects of this  Unmarshaller's class type. | 
| java.lang.Object | unmarshal(AnyNode anyNode) | Unmarshals objects of this  Unmarshaller's Class type
 from anAnyNodeinstance. | 
| java.lang.Object | unmarshal(EventProducer eventProducer) | Deprecated.
 please use @see #unmarshal(SAX2EventProducer) instead. | 
| java.lang.Object | unmarshal(SAX2EventAndErrorProducer eventProducer) | Unmarshals objects of this  Unmarshaller's class type. | 
| java.lang.Object | unmarshal(SAX2EventProducer eventProducer) | Unmarshals Objects of this Unmarshaller's Class type. | 
| java.lang.Object | unmarshal(org.w3c.dom.Node node) | Unmarshals Objects of this Unmarshaller's Class type. | 
| java.lang.Object | unmarshal(org.xml.sax.InputSource source) | Unmarshals Objects of this Unmarshaller's Class type. | 
org.xml.sax.EntityResolver entityResolver
public Unmarshaller()
public Unmarshaller(java.lang.Class clazz)
clazz - root class for unmarshallingpublic Unmarshaller(InternalContext internalContext)
internalContext - the InternalContext to usepublic Unmarshaller(InternalContext internalContext, java.lang.Class c)
internalContext - the InternalContext to usec - 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.public Unmarshaller(InternalContext internalContext, java.lang.Class c, java.lang.ClassLoader loader)
Unmarshaller with the given Class.internalContext - the InternalContext to be used, for config, and such...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.public Unmarshaller(Mapping mapping) throws MappingException
mapping - The Mapping to use.MappingException - in case that Unmarshaller fails to be instantiatedpublic Unmarshaller(InternalContext internalContext, Mapping mapping) throws MappingException
internalContext - the internal context to usemapping - The Mapping to use.MappingException - in case that Unmarshaller fails to be instantiatedpublic Unmarshaller(java.lang.Object root)
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.public Unmarshaller(InternalContext internalContext, java.lang.Object root)
internalContext - the internal context to useroot - 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.public void addNamespaceToPackageMapping(java.lang.String nsURI,
                                         java.lang.String packageName)
nsURI - the namespace URI to map frompackageName - the package name to map topublic UnmarshalHandler createHandler()
public boolean isValidating()
public void setClass(java.lang.Class clazz)
Class instance on the Unmarshaller.clazz - 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.public void setObject(java.lang.Object root)
Object instance on the Unmarshaller, into
 which will be unmarshalled.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.public void setClassLoader(java.lang.ClassLoader loader)
loader - the ClassLoader to usepublic void setClearCollections(boolean clear)
clear - the boolean value that when true indicates
 collections should be cleared upon first use.public void setDebug(boolean debug)
public void setEntityResolver(org.xml.sax.EntityResolver entityResolver)
entityResolver - the EntityResolver to use when
 resolving System and Public ids.public void setIDResolver(IDResolver idResolver)
idResolver - the IDResolver to use when resolving
 IDREFs for which no associated element may exist in the
 XML document.public void setIgnoreExtraAttributes(boolean ignoreExtraAtts)
ignoreExtraAtts - a boolean that when true will
 allow non-matched attributes to simply be ignored.public void setIgnoreExtraElements(boolean ignoreExtraElements)
ignoreExtraElements - a boolean that when true will
 allow non-matched elements to simply be ignored.public void setLogWriter(java.io.PrintWriter printWriter)
printWriter - the PrintWriter to use for loggingpublic void setMapping(Mapping mapping) throws MappingException
mapping - Mapping to use during unmarshalling.MappingExceptionsetResolver(org.exolab.castor.xml.XMLClassDescriptorResolver)public void setReuseObjects(boolean reuse)
reuse - the boolean indicating whether or not
 to re-use existing objects in the object model.public void setUnmarshalListener(UnmarshalListener listener)
UnmarshalListenerUnmarshalListener to receive pre and
 post unmarshal notification for each Object in the tree.
 An UnmarshalListener is often used to allow objects to
 appropriately initialize themselves by taking application
 specific behavior as they are unloaded.
 Current only one (1) listener is allowed. If you need
 register multiple listeners, you will have to create
 your own master listener that will forward the
 event notifications and manage the multiple
 listeners.listener - the UnmarshalListener to set.public void setUnmarshalListener(UnmarshalListener listener)
UnmarshalListener to receive pre and
 post unmarshal notification for each Object in the tree.
 An UnmarshalListener is often used to allow objects to
 appropriately initialize themselves by taking application
 specific behavior as they are unloaded.
 Current only one (1) listener is allowed. If you need
 register multiple listeners, you will have to create
 your own master listener that will forward the
 event notifications and manage the multiple
 listeners.listener - the UnmarshalListener to set.public void setValidation(boolean validate)
validate - A boolean to indicate whether or not validation should be done
        during umarshalling.
        public void setWhitespacePreserve(boolean preserve)
preserve - a boolean that when true enables
 whitespace preserving by default.public java.lang.Object unmarshal(java.io.Reader reader)
                           throws MarshalException,
                                  ValidationException
reader - the Reader to read the XML fromMarshalException - when there is an error during
 the unmarshalling processValidationException - when there is a validation errorpublic java.lang.Object unmarshal(EventProducer eventProducer) throws MarshalException, ValidationException
eventProducer - the EventProducer which produces
 the SAX eventsMarshalException - when there is an error during
 the unmarshalling processValidationException - when there is a validation errorpublic java.lang.Object unmarshal(SAX2EventProducer eventProducer) throws MarshalException, ValidationException
eventProducer - the SAX2EventProducer instance which produces
 the SAX 2 eventsMarshalException - when there is an error during
 the unmarshalling processValidationException - when there is a validation errorpublic java.lang.Object unmarshal(AnyNode anyNode) throws MarshalException
Unmarshaller's Class type
 from an AnyNode instance.
 
 The Class must specify the proper access methods
 (setters/getters) in order for instances of the Class
 to be properly unmarshalled.anyNode - AnyNode instance to be unmarshalled fromObject instance that is a result of unmarshalling.MarshalException - when there is an error during
 the unmarshalling processpublic java.lang.Object unmarshal(org.xml.sax.InputSource source)
                           throws MarshalException,
                                  ValidationException
source - the InputSource to read the XML fromMarshalException - when there is an error during
 the unmarshalling processValidationException - when there is a validation errorpublic java.lang.Object unmarshal(org.w3c.dom.Node node)
                           throws MarshalException,
                                  ValidationException
node - the DOM node to read the XML fromMarshalException - when there is an error during
 the unmarshalling processValidationException - when there is a validation errorpublic java.lang.Object unmarshal(javax.xml.stream.XMLEventReader eventReader)
                           throws MarshalException,
                                  ValidationException
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.eventReader - the StaX XMLEventReader to read XML from.MarshalException - indicates a general problem during the unmarshalling process.ValidationException - indicates a problem related to validation.public java.lang.Object unmarshal(javax.xml.stream.XMLStreamReader streamReader)
                           throws MarshalException,
                                  ValidationException
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.streamReader - the STaX XMLStreamReader to read XML from.MarshalException - indicates a general problem during the unmarshalling process.ValidationException - indicates a problem related to validation.public java.lang.Object unmarshal(SAX2EventAndErrorProducer eventProducer) throws MarshalException, ValidationException
Unmarshaller's class type. eventProducer - the SAX2EventAndErrorProducer instance which produces
            the SAX 2 events and handles SAX 2 errors.MarshalException - indiactes a general error during the unmarshalling
                process.ValidationException - indicates a validation error.public static org.xml.sax.ContentHandler getContentHandler(UnmarshalHandler handler) throws org.xml.sax.SAXException
org.xml.sax.SAXExceptionpublic static java.lang.Object unmarshal(java.lang.Class c,
                                         java.io.Reader reader)
                                  throws MarshalException,
                                         ValidationException
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.
c - the Class to create a new instance ofreader - the Reader to read the XML fromMarshalException - when there is an error during
 the unmarshalling processValidationException - when there is a validation errorpublic static java.lang.Object unmarshal(java.lang.Class c,
                                         org.xml.sax.InputSource source)
                                  throws MarshalException,
                                         ValidationException
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.
c - the Class to create a new instance ofsource - the InputSource to read the XML fromMarshalException - when there is an error during
 the unmarshalling processValidationException - when there is a validation errorpublic static java.lang.Object unmarshal(java.lang.Class c,
                                         org.w3c.dom.Node node)
                                  throws MarshalException,
                                         ValidationException
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.
c - The Class to create a new instance of.node - The DOM Node to read the XML from.MarshalException - When there is an error during the unmarshalling
            process.ValidationException - When there is a validation error.public void setObjectFactory(ObjectFactory objectFactory)
objectFactory - Factory used for constructing objects during unmarshalling.public java.lang.String getProperty(java.lang.String name)
name - Qualified name of the CASTOR XML-specific property.public void setProperty(java.lang.String name,
                        java.lang.String value)
name - Name of the Castor XML propertyvalue - Custom value to set.public void setInternalContext(InternalContext internalContext)
internalContext - the context to be usedpublic InternalContext getInternalContext()
InternalContext in usepublic void setResolver(XMLClassDescriptorResolver xmlClassDescriptorResolver)
xmlClassDescriptorResolver - the XMLClassDescriptorResolver to use
 Note: This method will nullify any Mapping
 currently being used by this UnmarshallerIntalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com