org.exolab.castor.xml.descriptors | |
org.exolab.castor.xml.dtd | The XML DTD Object Model Version: $Revision: 6213 $ $Date: 2003-03-03 00:05:44 -0700 (Mon, 03 Mar 2003) $ Author: Alexander Totok This package is an implementation of the XML DTD specification. |
org.exolab.castor.xml.dtd.parser | The XML DTD Parser API Version: $Revision: 6213 $ $Date: 2003-03-03 00:05:44 -0700 (Mon, 03 Mar 2003) $ Author: Alexander Totok This package consists of two parsers: Initial Parser parses the input text, searches for parameter entity declarations (i.e. |
org.exolab.castor.xml.handlers | |
org.exolab.castor.xml.location | |
org.exolab.castor.xml.schema | |
org.exolab.castor.xml.schema.facets | |
org.exolab.castor.xml.schema.reader | |
org.exolab.castor.xml.schema.simpletypes | |
org.exolab.castor.xml.schema.simpletypes.factory | |
org.exolab.castor.xml.schema.util | |
org.exolab.castor.xml.schema.writer | |
org.exolab.castor.xml.util | |
org.exolab.castor.xml.util.resolvers | |
org.exolab.castor.xml.validators | |
org.exolab.castor.xml.wls8 |
AttributeSet | A simple interface for handling Attributes in the Marshalling Framework. | code | html |
ClassDescriptorResolver | An interface for finding or "resolving" ClassDescriptor classes. | code | html |
EventProducer | A interface which abstracts anything which can produce SAX events. | code | html |
IDResolver | A simple interface for doing custom IDREF resolving during Unmarshalling. | code | html |
MarshalListener | An 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. | code | html |
OutputFormat | Output format contract for XML serialization. | code | html |
SAX2EventProducer | A interface which abstracts anything which can produce SAX 2 events. | code | html |
Serializer | Interface contract for XML serialization business. | code | html |
TypeValidator | The basic type validation interface class. | code | html |
UnmarshalListener | An interface to allow external "listening" to objects when they are being unmarshalled for various tracking purposes and potential modification. |
code | html |
XMLClassDescriptor | A class descriptor for describing relationships between a Class and an XML element or complexType. | code | html |
XMLClassDescriptorResolver | An interface for finding or "resolving" XMLClassDescriptor classes. | code | html |
XMLConstants | Constants used by all of Castor-XML are defined here. | code | html |
XMLFieldDescriptor | XML field descriptor. | code | html |
XMLSerializerFactory | Configurable factory object for XML serialization. | code | html |
AbstractXMLNaming | An abstract class to handing XML naming | code | html |
MarshalFramework | A core class for common code shared throughout the Marshalling Framework | code | html |
AccessRights | A class used to indicate access rights | code | html |
CastorException | The base exception for Castor (or at least Castor XML) | code | html |
ClassDescriptorResolverFactory | A factory that - based upon the binding type specified - returns ClassDescriptorResolver instances. | code | html |
DebugHandler | A Simple SAX1 DocumentHandler that intercepts SAX events and prints them to the console. | code | html |
DescriptorType | This class represents the Possible Descriptor types used by the marshalling Framework. | code | html |
FieldValidator | Handles field validation. | code | html |
IDResolverImpl | Default IDResolver for Castor XML during (un)marshaling. | code | html |
IntrospectedXMLClassDescriptor | A simple extension of XMLClassDescriptor so that we can set the "instrospected" flag. | code | html |
Introspector | A Helper class for the Marshaller and Unmarshaller, basically the common code base between the two. | code | html |
Introspector.IdentityConvertor | A special TypeConvertor that simply returns the object given. | code | html |
Introspector.MethodSet | A simple struct for holding a set of accessor methods * | code | html |
MarshalException | An exception that is used to signal marshalling exceptions. | code | html |
MarshalFramework.InheritanceMatch | Used to store the information when we find a possible inheritance. | code | html |
MarshalFramework.InternalXMLClassDescriptor | An internal implementation of XMLClassDescriptor used by the Unmarshaller and Marshaller... | code | html |
Marshaller | 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. | code | html |
Marshaller.MarshalState | code | html | |
Marshaller.NilObject | A wrapper for a "Nil" object | code | html |
Marshaller.WrapperInfo | Inner-class used for handling wrapper elements and locations. | code | html |
Namespaces | A class for handling Namespace declaration and scoping | code | html |
Namespaces.Namespace | An internal class used to represent a namespace * | code | html |
Namespaces.NamespaceEnumerator | A simple Enumeration for Namespace objects | code | html |
NodeType | The possible node types for an XML field. | code | html |
ProcessingInstruction | An immutable class that represents an XML processing instruction. | code | html |
ReferenceInfo | Internal class used to save state for reference resolving. | code | html |
ResolverException | The exception class thrown by the ClassDescriptorResolver | code | html |
UnmarshalHandler | An unmarshaller to allowing unmarshaling of XML documents to Java Objects. | code | html |
UnmarshalHandler.Arguments | Internal class used for passing constructor argument information. | code | html |
UnmarshalHandler.ArrayHandler | A class for handling Arrays during unmarshalling. | code | html |
UnmarshalHandler.ElementInfo | A utility class for keeping track of the qName and how the SAX parser passed attributes | code | html |
UnmarshalState | The state information class for the UnmarshalHandler | code | html |
Unmarshaller | An unmarshaller to allowing unmarshalling of XML documents to Java Objects. | code | html |
ValidationContext | A class which can be used to hold validation information, used by the TypeValidator interface. | code | html |
ValidationException | An Exception that can be used to signal XML validation errors. | code | html |
Validator | A class which can perform Validation on an Object model. | code | html |
XMLContext | 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. | code | html |
XMLException | An exception that is used to signal an error that has occured during marshaling or unmarshaling. | code | html |
XMLFieldHandler | This FieldHandler is used in the generated descriptors. | code | html |
XMLMappingLoader | An XML implementation of mapping helper. | code | html |
XMLMappingLoader.IdentityConvertor | A special TypeConvertor that simply returns the object given. | code | html |
XercesJDK5OutputFormat | Xerces-specific OutputFormat instance, used with JDK 5.0 only. | code | html |
XercesJDK5Serializer | Xerces-specific implementation of the Serializer interface, used for JDK 5 only where Xerecs has been integrated with the core code base. | code | html |
XercesJDK5XMLSerializerFactory | Xerces-specific implementation of the XMLSerializerFactory interface. | code | html |
XercesOutputFormat | Xerces-specific OutputFormat instance. | code | html |
XercesSerializer | Xerces-specific implementation of the Serializer interface. | code | html |
XercesXMLSerializerFactory | Xerces-specific implementation of the XMLSerializerFactory interface. | code | html |
The XML Marshaller API
org.exolab.castor.xml.Marshaller marshalls a Java object into an XML document. org.exolab.castor.xml.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 );