|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.castor.xml.MarshalFramework
org.exolab.castor.xml.Marshaller
A Marshaller to allowing serializing Java Object's to XML
Nested Class Summary | |
static class |
MarshalFramework.InheritanceMatch
Used to store the information when we find a possible inheritance. |
Field Summary | |
(package private) 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. |
(package private) static java.lang.String |
JAVA_PREFIX
The default prefix used for specifying the xsi:type as a classname instead of a schema name. |
(package private) static java.lang.String |
QNAME_NAME
The name of the QName type |
static java.lang.String |
XSI_NAMESPACE
The XSI Namespace URI |
Constructor Summary | |
Marshaller(org.xml.sax.DocumentHandler handler)
Creates a new Marshaller with the given DocumentHandler. |
|
Marshaller(org.w3c.dom.Node node)
Creates a new Marshaller for the given DOM Node. |
|
Marshaller(java.io.Writer out)
Creates a new Marshaller with the given writer. |
Method Summary | |
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()
Deprecated. |
java.lang.String |
getRootElement()
Returns the name of the root element to use |
(package private) static boolean |
isPrimitive(java.lang.Class type)
Returns true if the given class should be treated as a primitive type. |
void |
marshal(java.lang.Object object)
Marshals the given Object as XML using the DocumentHandler for this Marshaller. |
static void |
marshal(java.lang.Object object,
org.xml.sax.DocumentHandler handler)
Marshals the given Object as XML using the given DocumentHandler to send events to. |
static void |
marshal(java.lang.Object object,
org.w3c.dom.Node node)
Marshals the given Object as XML using the given DOM Node to send events to. |
static void |
marshal(java.lang.Object object,
java.io.Writer out)
Marshals the given Object as XML using the given writer |
static MarshalFramework.InheritanceMatch[] |
searchInheritance(java.lang.String name,
java.lang.String namespace,
XMLClassDescriptor classDesc,
ClassDescriptorResolver cdResolver)
Search there is a field descriptor which can accept one of the class descriptor which match the given name and namespace. |
void |
setDebug(boolean debug)
Sets the flag to turn on and off debugging |
void |
setLogWriter(java.io.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 |
setNamespaceMapping(java.lang.String nsPrefix,
java.lang.String nsURI)
Sets the mapping for the given Namespace prefix |
void |
setNSPrefixAtRoot(boolean nsPrefixAtRoot)
Deprecated. |
void |
setResolver(ClassDescriptorResolver cdr)
Sets the ClassDescriptorResolver to use during unmarshalling |
void |
setRootElement(java.lang.String rootElement)
Sets the name of the root element to use |
void |
setValidation(boolean validate)
Sets whether or not to validate the object model before marshalling. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static boolean enableDebug
int depth
public static final java.lang.String XSI_NAMESPACE
static final java.lang.String JAVA_PREFIX
static final java.lang.String QNAME_NAME
Constructor Detail |
public Marshaller(org.xml.sax.DocumentHandler handler)
handler
- the DocumentHandler to "marshal" to.public Marshaller(java.io.Writer out) throws java.io.IOException
out
- the Writer to serialize topublic Marshaller(org.w3c.dom.Node node)
node
- the DOM node to marshal into.Method Detail |
public void setMarshalAsDocument(boolean asDocument)
asDocument
- a boolean, when true, indicating to marshal
as a complete XML document.public void setMapping(Mapping mapping) throws MappingException
mapping
- the mapping to using during marshalling
MappingException
public void setNamespaceMapping(java.lang.String nsPrefix, java.lang.String nsURI)
nsPrefix
- the namespace prefixnsURI
- the namespace that the prefix resolves topublic void setRootElement(java.lang.String rootElement)
public java.lang.String getRootElement()
public void setNSPrefixAtRoot(boolean nsPrefixAtRoot)
nsPrefixAtRoot
- public boolean getNSPrefixAtRoot()
public void setResolver(ClassDescriptorResolver cdr)
cdr
- the ClassDescriptorResolver to use
Note: This method will nullify any Mapping
currently being used by this Marshaller
public void setValidation(boolean validate)
validate
- the boolean indicating whether or not to
validate the object model before marshalling.public void setMarshalExtendedType(boolean marshalExtendedType)
public boolean getMarshalExtendedType()
public static void marshal(java.lang.Object object, java.io.Writer out) throws MarshalException, ValidationException
out
- the writer to marshal to
MarshalException
ValidationException
public static void marshal(java.lang.Object object, org.xml.sax.DocumentHandler handler) throws MarshalException, ValidationException
handler
- the DocumentHandler to marshal to
MarshalException
ValidationException
public static void marshal(java.lang.Object object, org.w3c.dom.Node node) throws MarshalException, ValidationException
node
- the DOM Node to marshal to
MarshalException
ValidationException
public void marshal(java.lang.Object object) throws MarshalException, ValidationException
MarshalException
ValidationException
public void setDebug(boolean debug)
debug
- the flag indicating whether or not debug information
should be generatedpublic void setLogWriter(java.io.PrintWriter printWriter)
printWriter
- the PrintWriter to use for loggingstatic boolean isPrimitive(java.lang.Class type)
public static MarshalFramework.InheritanceMatch[] searchInheritance(java.lang.String name, java.lang.String namespace, XMLClassDescriptor classDesc, ClassDescriptorResolver cdResolver)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |