org.exolab.castor.xml
Class UnmarshalHandler

java.lang.Object
  |
  +--org.exolab.castor.xml.MarshalFramework
        |
        +--org.exolab.castor.xml.UnmarshalHandler

public class UnmarshalHandler
extends org.exolab.castor.xml.MarshalFramework
implements org.xml.sax.DocumentHandler

An unmarshaller to allowing unmarshalling of XML documents to Java Objects. The Class must specify the proper access methods (setters/getters) in order for instances of the Class to be properly unmarshalled.

Version:
$Revision: 1.52 $ $Date: 2001/03/14 00:28:12 $
Author:
Keith Visco

Method Summary
 void characters(char[] ch, int start, int length)
           
 void endDocument()
           
 void endElement(java.lang.String name)
           
 org.xml.sax.Locator getDocumentLocator()
           
 void ignorableWhitespace(char[] ch, int start, int length)
           
 void processingInstruction(java.lang.String target, java.lang.String data)
           
 void setClassLoader(java.lang.ClassLoader loader)
          Sets the ClassLoader to use when loading classes
 void setDebug(boolean debug)
          Turns debuging on or off.
 void setDocumentLocator(org.xml.sax.Locator locator)
           
 void setIDResolver(IDResolver idResolver)
          Sets the IDResolver to use when resolving IDREFs for which no associated element may exist in XML document.
 void setLogWriter(java.io.PrintWriter printWriter)
          Sets the PrintWriter used for printing log messages
 void setResolver(ClassDescriptorResolver cdResolver)
          Sets the ClassDescriptorResolver to use for loading and resolving ClassDescriptors
 void setValidation(boolean validate)
          Sets the flag for validation
 void startDocument()
           
 void startElement(java.lang.String name, org.xml.sax.AttributeList atts)
           
static java.lang.Object toPrimitiveObject(java.lang.Class type, java.lang.String value)
          Converts a String to the given primitive object type
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setClassLoader

public void setClassLoader(java.lang.ClassLoader loader)
Sets the ClassLoader to use when loading classes
Parameters:
loader - the ClassLoader to use

setResolver

public void setResolver(ClassDescriptorResolver cdResolver)
Sets the ClassDescriptorResolver to use for loading and resolving ClassDescriptors
Parameters:
cdResolver - the ClassDescriptorResolver to use

setDebug

public void setDebug(boolean debug)
Turns debuging on or off. If no Log Writer has been set, then System.out will be used to display debug information
Parameters:
debug - the flag indicating whether to generate debug information. A value of true, will turn debuggin on.
See Also:
#setLogWriter.

setIDResolver

public void setIDResolver(IDResolver idResolver)
Sets the IDResolver to use when resolving IDREFs for which no associated element may exist in XML document.
Parameters:
idResolver - the IDResolver to use when resolving IDREFs for which no associated element may exist in the XML document.

setLogWriter

public void setLogWriter(java.io.PrintWriter printWriter)
Sets the PrintWriter used for printing log messages
Parameters:
printWriter - the PrintWriter to use when printing log messages

setValidation

public void setValidation(boolean validate)
Sets the flag for validation
Parameters:
validate, - a boolean to indicate whether or not validation should be done during umarshalling.
By default, validation will be performed.

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.DocumentHandler

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Specified by:
endDocument in interface org.xml.sax.DocumentHandler

endElement

public void endElement(java.lang.String name)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.DocumentHandler

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException
Specified by:
ignorableWhitespace in interface org.xml.sax.DocumentHandler

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Specified by:
processingInstruction in interface org.xml.sax.DocumentHandler

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Specified by:
setDocumentLocator in interface org.xml.sax.DocumentHandler

getDocumentLocator

public org.xml.sax.Locator getDocumentLocator()

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Specified by:
startDocument in interface org.xml.sax.DocumentHandler

startElement

public void startElement(java.lang.String name,
                         org.xml.sax.AttributeList atts)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.DocumentHandler

toPrimitiveObject

public static java.lang.Object toPrimitiveObject(java.lang.Class type,
                                                 java.lang.String value)
Converts a String to the given primitive object type
Parameters:
type - the class type of the primitive in which to convert the String to
value - the String to convert to a primitive
Returns:
the new primitive Object


Intalio Inc. (C) 1999-2001. All rights reserved http://www.intalio.com