Classes | |
class | Arguments |
class | ArrayHandler |
class | ElementInfo |
class | IDResolverImpl |
class | ReferenceInfo |
Public Member Functions | |
void | addNamespaceToPackageMapping (String nsURI, String packageName) |
Object | getCurrentObject () |
Object | getObject () |
void | setClassLoader (ClassLoader loader) |
void | setClearCollections (boolean clear) |
void | setDebug (boolean debug) |
void | setIDResolver (IDResolver idResolver) |
void | setIgnoreExtraAttributes (boolean ignoreExtraAtts) |
void | setIgnoreExtraElements (boolean ignoreExtraElems) |
void | setLogWriter (PrintWriter printWriter) |
void | setReuseObjects (boolean reuse) |
void | setResolver (ClassDescriptorResolver cdResolver) |
void | setRootObject (Object root) |
void | setUnmarshalListener (UnmarshalListener listener) |
void | setValidation (boolean validate) |
void | setWhitespacePreserve (boolean preserve) |
void | characters (char[] ch, int start, int length) throws SAXException |
void | endDocument () throws org.xml.sax.SAXException |
void | endElement (String name) throws org.xml.sax.SAXException |
void | endElement (String namespaceURI, String localName, String qName) throws org.xml.sax.SAXException |
void | endPrefixMapping (String prefix) throws SAXException |
void | ignorableWhitespace (char[] ch, int start, int length) throws org.xml.sax.SAXException |
void | processingInstruction (String target, String data) throws org.xml.sax.SAXException |
void | setDocumentLocator (Locator locator) |
Locator | getDocumentLocator () |
void | skippedEntity (String name) throws SAXException |
void | startDocument () throws org.xml.sax.SAXException |
void | startElement (String namespaceURI, String localName, String qName, Attributes atts) throws org.xml.sax.SAXException |
void | startElement (String name, AttributeList attList) throws org.xml.sax.SAXException |
void | startPrefixMapping (String prefix, String uri) throws SAXException |
void | error (SAXParseException exception) throws org.xml.sax.SAXException |
void | fatalError (SAXParseException exception) throws org.xml.sax.SAXException |
void | warning (SAXParseException exception) throws org.xml.sax.SAXException |
Static Public Member Functions | |
static Object | toPrimitiveObject (Class type, String value) |
Protected Member Functions | |
UnmarshalHandler () | |
UnmarshalHandler (Class _class) | |
void | setConfiguration (Configuration config) |
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.
org.exolab.castor.xml.UnmarshalHandler.UnmarshalHandler | ( | ) | [protected] |
Creates a new UnmarshalHandler The "root" class will be obtained by looking into the mapping for a descriptor that matches the root element.
org.exolab.castor.xml.UnmarshalHandler.UnmarshalHandler | ( | Class | _class | ) | [protected] |
Creates a new UnmarshalHandler
_class | the Class to create the UnmarshalHandler for |
void org.exolab.castor.xml.UnmarshalHandler.addNamespaceToPackageMapping | ( | String | nsURI, | |
String | packageName | |||
) |
Adds a mapping from the given namespace URI to the given package name
nsURI | the namespace URI to map from | |
packageName | the package name to map to |
Referenced by org.exolab.castor.xml.Unmarshaller.createHandler().
void org.exolab.castor.xml.UnmarshalHandler.characters | ( | char[] | ch, | |
int | start, | |||
int | length | |||
) | throws SAXException |
void org.exolab.castor.xml.UnmarshalHandler.endDocument | ( | ) | throws org.xml.sax.SAXException |
void org.exolab.castor.xml.UnmarshalHandler.endElement | ( | String | name | ) | throws org.xml.sax.SAXException |
DEBUG System.out.println("end: " + name);
References org.exolab.castor.xml.UnmarshalState.args, org.exolab.castor.xml.UnmarshalState.buffer, org.exolab.castor.xml.UnmarshalState.classDesc, org.exolab.castor.xml.UnmarshalState.elementName, org.exolab.castor.util.Stack.empty(), org.exolab.castor.xml.util.SAX2ANY.endElement(), org.exolab.castor.xml.UnmarshalListener.fieldAdded(), org.exolab.castor.xml.UnmarshalState.fieldDesc, org.exolab.castor.util.MimeBase64Decoder.getByteArray(), org.exolab.castor.xml.XMLClassDescriptor.getContentDescriptor(), org.exolab.castor.mapping.FieldDescriptor.getFieldName(), org.exolab.castor.mapping.FieldDescriptor.getFieldType(), org.exolab.castor.mapping.FieldDescriptor.getHandler(), org.exolab.castor.mapping.ClassDescriptor.getIdentity(), org.exolab.castor.xml.ValidationException.getNext(), org.exolab.castor.xml.Namespaces.getParent(), org.exolab.castor.xml.XMLFieldDescriptor.getSchemaType(), org.exolab.castor.xml.util.SAX2ANY.getStartingNode(), org.exolab.castor.mapping.MapItem.getValue(), org.exolab.castor.mapping.FieldHandler.getValue(), org.exolab.castor.xml.XMLFieldDescriptor.getXMLName(), org.exolab.castor.xml.XMLFieldDescriptor.isContainer(), org.exolab.castor.xml.XMLFieldDescriptor.isIncremental(), org.exolab.castor.xml.XMLFieldDescriptor.isMapped(), org.exolab.castor.xml.XMLFieldDescriptor.isMultivalued(), org.exolab.castor.xml.MarshalFramework.isPrimitive(), org.exolab.castor.xml.XMLFieldDescriptor.isReference(), org.exolab.castor.xml.UnmarshalState.isUsed(), org.exolab.castor.xml.UnmarshalState.key, org.exolab.castor.xml.UnmarshalState.markAsUsed(), org.exolab.castor.xml.UnmarshalState.nil, org.exolab.castor.xml.UnmarshalState.object, org.exolab.castor.util.Stack.peek(), org.exolab.castor.util.Stack.pop(), org.exolab.castor.xml.UnmarshalState.primitiveOrImmutable, org.exolab.castor.util.Stack.push(), org.exolab.castor.xml.MarshalFramework.QNAME_NAME, org.exolab.castor.mapping.FieldHandler.resetValue(), org.exolab.castor.xml.ValidationContext.setConfiguration(), org.exolab.castor.xml.ValidationException.setNext(), org.exolab.castor.xml.ValidationContext.setResolver(), org.exolab.castor.mapping.FieldHandler.setValue(), org.exolab.castor.xml.UnmarshalState.targetState, org.exolab.castor.util.MimeBase64Decoder.translate(), org.exolab.castor.xml.UnmarshalState.type, org.exolab.castor.xml.UnmarshalListener.unmarshalled(), org.exolab.castor.xml.Validator.validate(), and org.exolab.castor.xml.UnmarshalState.wrapper.
Referenced by org.exolab.castor.xml.UnmarshalHandler.endElement().
void org.exolab.castor.xml.UnmarshalHandler.endElement | ( | String | namespaceURI, | |
String | localName, | |||
String | qName | |||
) | throws org.xml.sax.SAXException |
ContentHandler.endElement
Signals the end of an element
name | the name of the element |
References org.exolab.castor.xml.UnmarshalHandler.endElement(), org.exolab.castor.xml.UnmarshalHandler.error(), and org.exolab.castor.xml.Namespaces.getNamespacePrefix().
void org.exolab.castor.xml.UnmarshalHandler.endPrefixMapping | ( | String | prefix | ) | throws SAXException |
Signals to end the namespace prefix mapping
prefix | the namespace prefix |
References org.exolab.castor.xml.util.SAX2ANY.endPrefixMapping().
void org.exolab.castor.xml.UnmarshalHandler.error | ( | SAXParseException | exception | ) | throws org.xml.sax.SAXException |
void org.exolab.castor.xml.UnmarshalHandler.fatalError | ( | SAXParseException | exception | ) | throws org.xml.sax.SAXException |
Object org.exolab.castor.xml.UnmarshalHandler.getCurrentObject | ( | ) |
Returns the Object that the UnmarshalHandler is currently handling (within the object model), or null if the current element is a simpleType.
References org.exolab.castor.xml.UnmarshalState.object, and org.exolab.castor.util.Stack.peek().
Locator org.exolab.castor.xml.UnmarshalHandler.getDocumentLocator | ( | ) |
Referenced by org.exolab.castor.xml.Unmarshaller.unmarshal().
Object org.exolab.castor.xml.UnmarshalHandler.getObject | ( | ) |
Returns the "root" Object (ie. the entire object model) being unmarshalled.
References org.exolab.castor.xml.UnmarshalState.object.
Referenced by org.exolab.castor.xml.Unmarshaller.unmarshal().
void org.exolab.castor.xml.UnmarshalHandler.ignorableWhitespace | ( | char[] | ch, | |
int | start, | |||
int | length | |||
) | throws org.xml.sax.SAXException |
void org.exolab.castor.xml.UnmarshalHandler.processingInstruction | ( | String | target, | |
String | data | |||
) | throws org.xml.sax.SAXException |
void org.exolab.castor.xml.UnmarshalHandler.setClassLoader | ( | ClassLoader | loader | ) |
Sets the ClassLoader to use when loading classes
loader | the ClassLoader to use |
Referenced by org.exolab.castor.xml.Unmarshaller.createHandler().
void org.exolab.castor.xml.UnmarshalHandler.setClearCollections | ( | boolean | clear | ) |
Sets whether or not to clear collections (including arrays) upon first use to remove default values. By default, and for backward compatibility with previous versions of Castor this value is false, indicating that collections are not cleared before initial use by Castor.
clear | the boolean value that when true indicates collections should be cleared upon first use. |
Referenced by org.exolab.castor.xml.Unmarshaller.createHandler().
void org.exolab.castor.xml.UnmarshalHandler.setConfiguration | ( | Configuration | config | ) | [protected] |
Sets the current Castor configuration. Currently this Configuration is only used during Validation (which is why this method is currently protected, since it has no effect at this point on the actual configuration of the unmarshaller)
Currently, this method should only be called by the Unmarshaller.
Referenced by org.exolab.castor.xml.Unmarshaller.createHandler().
void org.exolab.castor.xml.UnmarshalHandler.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
debug | the flag indicating whether to generate debug information. A value of true, will turn debuggin on. |
Referenced by org.exolab.castor.xml.Unmarshaller.createHandler().
void org.exolab.castor.xml.UnmarshalHandler.setDocumentLocator | ( | Locator | locator | ) |
void org.exolab.castor.xml.UnmarshalHandler.setIDResolver | ( | IDResolver | idResolver | ) |
Sets the IDResolver to use when resolving IDREFs for which no associated element may exist in XML document.
idResolver | the IDResolver to use when resolving IDREFs for which no associated element may exist in the XML document. |
References org.exolab.castor.xml.UnmarshalHandler.IDResolverImpl.setResolver().
Referenced by org.exolab.castor.xml.Unmarshaller.createHandler().
void org.exolab.castor.xml.UnmarshalHandler.setIgnoreExtraAttributes | ( | boolean | ignoreExtraAtts | ) |
Sets whether or not attributes that do not match a specific field should simply be ignored or reported as an error. By default, extra attributes are ignored.
ignoreExtraAtts | a boolean that when true will allow non-matched attributes to simply be ignored. |
Referenced by org.exolab.castor.xml.Unmarshaller.createHandler().
void org.exolab.castor.xml.UnmarshalHandler.setIgnoreExtraElements | ( | boolean | ignoreExtraElems | ) |
Sets whether or not elements that do not match a specific field should simply be ignored or reported as an error. By default, extra attributes are ignored.
ignoreExtraElems | a boolean that when true will allow non-matched attributes to simply be ignored. |
Referenced by org.exolab.castor.xml.Unmarshaller.createHandler().
void org.exolab.castor.xml.UnmarshalHandler.setLogWriter | ( | PrintWriter | printWriter | ) |
Sets the PrintWriter used for printing log messages
printWriter | the PrintWriter to use when printing log messages |
Referenced by org.exolab.castor.xml.Unmarshaller.createHandler().
void org.exolab.castor.xml.UnmarshalHandler.setResolver | ( | ClassDescriptorResolver | cdResolver | ) |
Sets the ClassDescriptorResolver to use for loading and resolving ClassDescriptors
cdResolver | the ClassDescriptorResolver to use |
Referenced by org.exolab.castor.xml.Unmarshaller.createHandler().
void org.exolab.castor.xml.UnmarshalHandler.setReuseObjects | ( | boolean | reuse | ) |
Sets a boolean that when true indicates that objects contained within the object model should be re-used where appropriate. This is only valid when unmarshalling to an existing object.
reuse | the boolean indicating whether or not to re-use existing objects in the object model. |
Referenced by org.exolab.castor.xml.Unmarshaller.createHandler().
void org.exolab.castor.xml.UnmarshalHandler.setRootObject | ( | Object | root | ) |
Sets the root (top-level) object to use for unmarshalling into.
root | the instance to unmarshal into. |
Referenced by org.exolab.castor.xml.Unmarshaller.createHandler().
void org.exolab.castor.xml.UnmarshalHandler.setUnmarshalListener | ( | UnmarshalListener | listener | ) |
Sets an UnmarshalListener.
listener | the UnmarshalListener to use with this instance of the UnmarshalHandler. |
Referenced by org.exolab.castor.xml.Unmarshaller.createHandler().
void org.exolab.castor.xml.UnmarshalHandler.setValidation | ( | boolean | validate | ) |
Sets the flag for validation
validate,a | boolean to indicate whether or not validation should be done during umarshalling. By default, validation will be performed. |
Referenced by org.exolab.castor.xml.Unmarshaller.createHandler().
void org.exolab.castor.xml.UnmarshalHandler.setWhitespacePreserve | ( | boolean | preserve | ) |
Sets the top-level whitespace (xml:space) to either preserving or non preserving. The XML document can override this value using xml:space on specific elements. This sets the "default" behavior when xml:space="default".
preserve | a boolean that when true enables whitespace preserving by default. |
Referenced by org.exolab.castor.xml.Unmarshaller.createHandler().
void org.exolab.castor.xml.UnmarshalHandler.skippedEntity | ( | String | name | ) | throws SAXException |
Signals that an entity was skipped by the parser
name | the skipped entity's name |
void org.exolab.castor.xml.UnmarshalHandler.startDocument | ( | ) | throws org.xml.sax.SAXException |
Signals the start of a new document
void org.exolab.castor.xml.UnmarshalHandler.startElement | ( | String | name, | |
AttributeList | attList | |||
) | throws org.xml.sax.SAXException |
DocumentHandler.startElement
Signals the start of element
name | the name of the element | |
atts | the AttributeList containing the associated attributes for the element |
References org.exolab.castor.xml.UnmarshalHandler.ElementInfo.attributeList, org.exolab.castor.xml.UnmarshalHandler.ElementInfo.clear(), org.exolab.castor.xml.Namespaces.createNamespaces(), org.exolab.castor.xml.UnmarshalHandler.ElementInfo.qName, org.exolab.castor.xml.UnmarshalHandler.startElement(), and org.exolab.castor.xml.util.SAX2ANY.startElement().
void org.exolab.castor.xml.UnmarshalHandler.startElement | ( | String | namespaceURI, | |
String | localName, | |||
String | qName, | |||
Attributes | atts | |||
) | throws org.xml.sax.SAXException |
ContentHandler.startElement
Signals the start of element
name | the name of the element | |
atts | the AttributeList containing the associated attributes for the element |
References org.exolab.castor.xml.Namespaces.addNamespace(), org.exolab.castor.xml.UnmarshalHandler.ElementInfo.attributes, org.exolab.castor.xml.UnmarshalHandler.ElementInfo.clear(), org.exolab.castor.xml.util.AttributeSetImpl.clear(), org.exolab.castor.xml.Namespaces.createNamespaces(), org.exolab.castor.xml.UnmarshalHandler.error(), org.exolab.castor.xml.Namespaces.getNamespacePrefix(), org.exolab.castor.xml.Namespaces.getNamespaceURI(), org.exolab.castor.xml.UnmarshalHandler.ElementInfo.qName, org.exolab.castor.xml.util.AttributeSetImpl.setAttribute(), and org.exolab.castor.xml.util.SAX2ANY.startElement().
Referenced by org.exolab.castor.xml.UnmarshalHandler.startElement().
void org.exolab.castor.xml.UnmarshalHandler.startPrefixMapping | ( | String | prefix, | |
String | uri | |||
) | throws SAXException |
Signals to start the namespace - prefix mapping
prefix | the namespace prefix to map | |
uri | the namespace URI |
References org.exolab.castor.xml.Namespaces.addNamespace(), org.exolab.castor.xml.Namespaces.createNamespaces(), and org.exolab.castor.xml.util.SAX2ANY.startPrefixMapping().
static Object org.exolab.castor.xml.UnmarshalHandler.toPrimitiveObject | ( | Class | type, | |
String | value | |||
) | [static] |
Converts a String to the given primitive object type
type | the class type of the primitive in which to convert the String to | |
value | the String to convert to a primitive |
void org.exolab.castor.xml.UnmarshalHandler.warning | ( | SAXParseException | exception | ) | throws org.xml.sax.SAXException |