Package org.exolab.castor.xml
package org.exolab.castor.xml
The XML Marshaller API
- Version:
- $Revision$ $Date: 2003-03-03 00:05:44 -0700 (Mon, 03 Mar 2003) $
- Author:
- Keith Visco
Marshaller
marshalls a Java object into an XML document.
Unmarshaller
unmarshalls an XML document back into a Java
object.
The following example unmarshals the XML document product.xml into a Product object, performs simple changes to the object and then marshals it back into an XML document.
Product prod; File file; file = new File( "product.xml" ); // Unmarshal the document into an object prod = (Product) Unmarshaller.unmarshal( Product.class, new FileReader( file ) ); // A 25% mark down for each product and mark as sale prod.markDown( 0.25 ); prod.setOnSale( true ); // Marshal the object into a document Marshaller.marshal( Product, new FileWriter( file ) );
In addition to static methods, marshaller objects can be created and set with a variety of options affecting how they will operation. The above example adapted to use a specific mapping file:
Mapping map; Unmarshaller umr; Marshaller mar; // Load the specified mapping file map = new Mapping(); map.loadMapping( "mapping.xml" ); // Unmarshal the document into an object umr = new Unmarshaller( Product.class ); umr.setMapping( mapping ); prod = (Product) umr.unmarshal( new FileReader( file ) ); : : : // Marshal the object into a document mar = new Marshaller( new FileWriter( file ) ); mar.setMapping( mapping ); mar.marshal( Product );
-
ClassDescriptionAn abstract class to handing XML namingA class used to indicate access rightsXerces-specific implementation of the Serializer interface for AIX, used for JDK 5 on AIX only where Xerces has been integrated with the core code base.Xerces-specific implementation of the
XMLSerializerFactory
interface.A simple interface for handling Attributes in the Marshalling Framework.This provides shared code forSax2EventFromStaxEventProducer
andSax2EventFromStaxStreamProducer
.Xerces-specific implementation of the Serializer interface, used for JDK 5 only where Xerecs has been integrated with the core code base.Xerces-specific OutputFormat instance.The base exception for Castor (or at least Castor XML)A processor that assistsUnmarshalHandler
in dealing with the SAX 2ContentHandler.characters(char[], int, int)
callback method.An interface for finding or "resolving" ClassDescriptor classes.A factory that - based upon the binding type specified - returnsClassDescriptorResolver
instances.A Simple SAX1 DocumentHandler that intercepts SAX events and prints them to the console.This class represents the Possible Descriptor types used by the marshalling Framework.A processor that assistsUnmarshalHandler
in dealing with the SAX 2ContentHandler.endElement(String, String, String)
callback method.Deprecated.use @see org.castor.xml.SAX2EventProducer instead.Handles field validation.A simple interface for doing custom IDREF resolving during Unmarshalling.A Helper class for the Marshaller and Unmarshaller, basically the common code base between the two.An exception that is used to signal marshalling exceptions.A Marshaller that serializes Java Object's to XML Note: This class is not thread safe, and not intended to be, so please create a new Marshaller for each thread if it is to be used in a multithreaded environment.A wrapper for a "Nil" objectAn interface to allow external "listening" to objects when they are being marshalled for various tracking purposes and potential modification, and to prevent an object from being marshalled if necessary.A class for handling Namespace declaration and scopingThis class is an actual namespace stack implementation, responsible for adding and removing namespace scopes, as well as resolving namespace urls and prefixes by traversing all the namespace stack.The possible node types for an XML field.Output format contract for XML serialization.An immutable class that represents an XML processing instruction.The exception class thrown by the ClassDescriptorResolverA interface which extendsSAX2EventProducer
.A interface which abstracts anything which can produce SAX 2 events.Interface contract for XML serialization business.A processor that assistsUnmarshalHandler
in dealing with the SAX 2ContentHandler.startElement(String, String, String, org.xml.sax.Attributes)
callback method.The basic type validation interface class.An unmarshaller to allowing unmarshaling of XML documents to Java Objects.A class for handling Arrays during unmarshalling.An unmarshaller to allowing unmarshalling of XML documents to Java Objects.Deprecated.a new extended interface was introducedThe state information class for the UnmarshalHandler.A class which can be used to hold validation information, used by the TypeValidator interface.An Exception that can be used to signal XML validation errors.A class which can perform Validation on an Object model.Xerces-specific OutputFormat instance, used with JDK 5.0 only.Xerces-specific implementation of the Serializer interface, used for JDK 5 only where Xerces has been integrated with the core code base.Xerces-specific implementation of theXMLSerializerFactory
interface.Xerces-specific OutputFormat instance.Xerces-specific implementation of the Serializer interface.Xerces-specific implementation of theXMLSerializerFactory
interface.A class descriptor for describing relationships between a Class and an XML element or complexType.An interface for finding or "resolving" XMLClassDescriptor classes.Constants used by all of Castor-XML are defined here.Bootstrap class for Castor XML that allows you to load information about the domain objects used with Castor XML (marshallers and unmarshallers) by various means.An exception that is used to signal an error that has occurred during marshaling or unmarshaling.XML field descriptor.This FieldHandler is used in the generated descriptors.An XML implementation of mapping helper.Configurable factory object for XML serialization.