org.exolab.castor.xml
public class Marshaller extends MarshalFramework
Version: $Revision: 1.28 $ $Date: 2005/08/05 19:58:33 $
Nested Class Summary | |
---|---|
static class | Marshaller.MarshalState |
static class | Marshaller.NilObject
A wrapper for a "Nil" object
|
static class | Marshaller.WrapperInfo
Inner-class used for handling wrapper elements
and locations |
Field Summary | |
---|---|
int | depth
The depth of the sub tree, 0 denotes document level
|
static boolean | enableDebug
A static flag used to enable debugging when using
the static marshal methods.
|
Constructor Summary | |
---|---|
Marshaller(DocumentHandler handler)
Creates a new Marshaller with the given DocumentHandler.
| |
Marshaller(ContentHandler handler)
Creates a new Marshaller with the given SAX ContentHandler.
| |
Marshaller(Writer out)
Creates a new Marshaller with the given writer.
| |
Marshaller(Node node)
Creates a new Marshaller for the given DOM Node.
|
Method Summary | |
---|---|
void | addProcessingInstruction(String target, String data)
Adds the given processing instruction data to the set of
processing instructions to output during marshalling.
|
boolean | getMarshalExtendedType()
If True the marshaller will use the 'xsi:type' attribute
to marshall a field value that extended the defined field type.
|
boolean | getNSPrefixAtRoot()
Returns True if the given namespace mappings will be declared at the root node. |
ClassDescriptorResolver | getResolver()
Returns the ClassDescriptorResolver for use during marshalling
|
String | getRootElement()
Returns the name of the root element to use |
static void | marshal(Object object, Writer out)
Marshals the given Object as XML using the given writer |
static void | marshal(Object object, DocumentHandler handler)
Marshals the given Object as XML using the given DocumentHandler
to send events to. |
static void | marshal(Object object, ContentHandler handler)
Marshals the given Object as XML using the given ContentHandler
to send events to. |
static void | marshal(Object object, Node node)
Marshals the given Object as XML using the given DOM Node
to send events to. |
void | marshal(Object object)
Marshals the given Object as XML using the DocumentHandler
for this Marshaller. |
void | setDebug(boolean debug)
Sets the flag to turn on and off debugging |
void | setDoctype(String publicId, String systemId)
Sets the document type definition for the serializer. |
void | setEncoding(String encoding)
Sets the encoding for the serializer. |
void | setLogWriter(PrintWriter printWriter)
Sets the PrintWriter used for logging |
void | setMapping(Mapping mapping)
Sets the given mapping to be used by the marshalling
Framework. |
void | setMarshalAsDocument(boolean asDocument)
Sets whether or not to marshal as a document which includes
the XML declaration, and if necessary the DOCTYPE declaration.
|
void | setMarshalExtendedType(boolean marshalExtendedType)
If True the marshaller will use the 'xsi:type' attribute
to marshall a field value that extended the defined field type.
|
void | setMarshalListener(MarshalListener listener)
Sets an optional MarshalListener to recieve pre and post
marshal notification for each Object in the tree.
|
void | setNamespaceMapping(String nsPrefix, String nsURI)
Sets the mapping for the given Namespace prefix |
void | setNoNamespaceSchemaLocation(String schemaLocation)
Sets the value for the xsi:noNamespaceSchemaLocation attribute.
|
void | setNSPrefixAtRoot(boolean nsPrefixAtRoot)
Set to True to declare the given namespace mappings at the root node. |
void | setResolver(ClassDescriptorResolver cdr)
Sets the ClassDescriptorResolver to use during marshalling
Note: This method will nullify any Mapping currently being used by this Marshaller |
void | setRootElement(String rootElement)
Sets the name of the root element to use |
void | setSchemaLocation(String schemaLocation)
Sets the value for the xsi:schemaLocation attribute.
|
void | setSuppressNamespaces(boolean suppressNamespaces)
Sets whether or not namespaces are output. |
void | setSuppressXSIType(boolean suppressXSIType)
Sets whether or not the xsi:type attribute should appear
on the marshalled document.
|
void | setSupressXMLDeclaration(boolean supressXMLDeclaration)
Sets whether or not to marshal as a document which includes
the XML declaration, and if necessary the DOCTYPE declaration.
|
void | setUseXSITypeAtRoot(boolean useXSITypeAtRoot)
Sets whether or not to output the xsi:type at the root
element. |
void | setValidation(boolean validate)
Sets whether or not to validate the object model
before marshalling. |
Parameters: handler the DocumentHandler to "marshal" to.
Parameters: handler the ContentHandler to "marshal" to.
Parameters: out the Writer to serialize to
Parameters: node the DOM node to marshal into.
Parameters: target the processing instruction target data the processing instruction data
Returns: If True the marshaller will use the 'xsi:type' attribute to marshall a field value that extended the defined field type. Default is True.
Deprecated:
Returns True if the given namespace mappings will be declared at the root node.Returns: Returns True if the given namespace mappings will be declared at the root node.
Returns: the ClassDescriptorResolver
See Also: Marshaller
Returns: Returns the name of the root element to use
Parameters: obj the Object to marshal out the writer to marshal to
Throws: org.exolab.castor.xml.MarshalException org.exolab.castor.xml.ValidationException
Parameters: obj the Object to marshal handler the DocumentHandler to marshal to
Throws: org.exolab.castor.xml.MarshalException org.exolab.castor.xml.ValidationException
Parameters: obj the Object to marshal handler the ContentHandler to marshal to
Throws: org.exolab.castor.xml.MarshalException org.exolab.castor.xml.ValidationException
Parameters: obj the Object to marshal node the DOM Node to marshal to
Throws: org.exolab.castor.xml.MarshalException org.exolab.castor.xml.ValidationException
Parameters: obj the Object to marshal
Throws: org.exolab.castor.xml.MarshalException org.exolab.castor.xml.ValidationException
Parameters: debug the flag indicating whether or not debug information should be generated
Parameters: publicId the public identifier systemId the system identifier
Parameters: encoding the encoding to set
Parameters: printWriter the PrintWriter to use for logging
Parameters: mapping the mapping to using during marshalling
Parameters: asDocument a boolean, when true, indicating to marshal as a complete XML document.
See Also: Marshaller
Parameters: listener the MarshalListener to set.
Parameters: nsPrefix the namespace prefix nsURI the namespace that the prefix resolves to
Parameters: schemaLocation the URI location of the schema to which the marshalled document is an instance of.
Deprecated:
Set to True to declare the given namespace mappings at the root node. Default is False.Parameters: nsPrefixAtRoot
Parameters: cdr the ClassDescriptorResolver to use
See Also: Marshaller Marshaller
Parameters: The name of the root element to use
Parameters: schemaLocation the URI location of the schema to which the marshalled document is an instance of.
Parameters: suppressNamespaces a boolean that when true will prevent namespaces from being output.
Parameters: suppressXSIType a boolean that when true will prevent xsi:type attribute from being used in the marshalling process.
Parameters: supressXMLDeclaration a boolean that when true includes that generated XML should not contain the XML declaration.
See Also: Marshaller
Parameters: useXSITypeAtRoot a boolean that when true indicates that the xsi:type should be output on the root element.
Parameters: validate the boolean indicating whether or not to validate the object model before marshalling.