org.apache.ws.jaxme.impl

Class JMMarshallerImpl

Implemented Interfaces:
JMMarshaller, Marshaller

public class JMMarshallerImpl
extends JMControllerImpl
implements JMMarshaller

Version:
$Id: JMMarshallerImpl.java 232067 2005-03-10 10:14:08Z jochen $
Author:
Jochen Wiedmann

Field Summary

static String
DEFAULT_JAXB_ENCODING
Default value for Marshaller.JAXB_ENCODING.
static String
DEFAULT_JAXME_INDENTATION_SEPARATOR
Default value for JAXME_INDENTATION_SEPARATOR.
static String
DEFAULT_JAXME_INDENTATION_STRING
Default value for JAXME_INDENTATION_STRING: Two blanks.
static String
JAXME_INDENTATION_SEPARATOR
Property name for setting the String used as a line separator in the formatted output.
static String
JAXME_INDENTATION_STRING
Property name for setting the String used to indent the formatted output by one level.
static String
JAXME_XML_DECLARATION
Property name for choosing whether the marshalled output should contain an XML declaration.
static String
JAXME_XML_WRITER
Property name for a SAX ContentHandler which is able to marshal a SAX stream into a character stream.

Fields inherited from class org.apache.ws.jaxme.impl.JMControllerImpl

JAXME_DATATYPE_CONVERTER, JAXME_FORMAT_DATE, JAXME_FORMAT_DATETIME, JAXME_FORMAT_TIME, JAXME_PRIVATE, eventHandler

Fields inherited from interface javax.xml.bind.Marshaller

JAXB_ENCODING, JAXB_FORMATTED_OUTPUT, JAXB_NO_NAMESPACE_SCHEMA_LOCATION, JAXB_SCHEMA_LOCATION

Method Summary

String
getEncoding()
Returns the controllers encoding; to be used in marshalling.
boolean
getIndentation()
Returns whether XML documents generated by the controller ought to be formatted.
String
getIndentationSeparator()
Returns the string used as a line separator.
String
getIndentationString()
Returns the string used to indent one level.
String
getNoNamespaceSchemaLocation()
Returns the schema location.
Node
getNode(java.lang.Object contentTree)
Object
getProperty(String pProperty)
String
getSchemaLocation()
Returns the schema location.
Class
getXMLWriterClass()
Returns the controllers class implementing XMLWriter.
boolean
getXmlDeclaration()
Returns whether the methods marshal(Object, Writer) and marshal(Object, OutputStream) ought to emit an XML declaration.
void
marshal(Object pObject, ContentHandler pHandler)
void
marshal(Object pObject, Node pNode)
void
marshal(Object pObject, OutputStream pStream)
void
marshal(Object pObject, Result pResult)
void
marshal(Object pObject, Writer pWriter)
void
setEncoding(String pEncoding)
Sets the controllers encoding; to be used in marshalling.
void
setIndentation(boolean pIndentation)
Sets whether XML documents generated by the controller ought to be formatted.
void
setIndentationSeparator(String pStr)
Sets the string used as a line separator.
void
setIndentationString(String pStr)
Sets the string used to indent one level.
void
setNoNamespaceSchemaLocation(String pValue)
Sets the schema location without namespace.
void
setProperty(String pProperty, Object pValue)
void
setSchemaLocation(String pValue)
Sets the schema location.
void
setXMLWriterClass(Class pClass)
Sets the controllers class implementing XMLWriter.
void
setXmlDeclaration(boolean pDeclaration)
Sets whether the methods marshal(Object, Writer) and marshal(Object, OutputStream) ought to emit an XML declaration.

Methods inherited from class org.apache.ws.jaxme.impl.JMControllerImpl

getDatatypeConverter, getDateFormat, getDateTimeFormat, getEventHandler, getJAXBContextImpl, getProperty, getTimeFormat, setDatatypeConverter, setDateFormat, setDateTimeFormat, setEventHandler, setJAXBContextImpl, setProperty, setTimeFormat

Field Details

DEFAULT_JAXB_ENCODING

public static final String DEFAULT_JAXB_ENCODING

DEFAULT_JAXME_INDENTATION_SEPARATOR

public static final String DEFAULT_JAXME_INDENTATION_SEPARATOR

DEFAULT_JAXME_INDENTATION_STRING

public static final String DEFAULT_JAXME_INDENTATION_STRING

JAXME_INDENTATION_SEPARATOR

public static final String JAXME_INDENTATION_SEPARATOR
Property name for setting the String used as a line separator in the formatted output. ("jaxme.indentation.separator")

JAXME_INDENTATION_STRING

public static final String JAXME_INDENTATION_STRING

JAXME_XML_DECLARATION

public static final String JAXME_XML_DECLARATION

JAXME_XML_WRITER

public static final String JAXME_XML_WRITER

Method Details

getEncoding

public String getEncoding()

getIndentation

public boolean getIndentation()
Returns whether XML documents generated by the controller ought to be formatted. Defaults to true.

getIndentationSeparator

public String getIndentationSeparator()

getIndentationString

public String getIndentationString()

getNoNamespaceSchemaLocation

public String getNoNamespaceSchemaLocation()
Returns the schema location. The marshaller will use this to create an attribute xsi:noNamespaceSchemaLocation. Equivalent to setProperty(JAXB_SCHEMA_LOCATION, pValue). Defaults to null, in which case the attribute isn't created.

getNode

public Node getNode(java.lang.Object contentTree)
            throws JAXBException

getProperty

public Object getProperty(String pProperty)
            throws PropertyException
Specified by:
getProperty in interface Marshaller
Overrides:
getProperty in interface JMControllerImpl

getSchemaLocation

public String getSchemaLocation()
Returns the schema location. The marshaller will use this to create an attribute xsi:schemaLocation. Equivalent to setProperty(JAXB_SCHEMA_LOCATION, pValue). Defaults to null, in which case the attribute isn't created.

getXMLWriterClass

public Class getXMLWriterClass()

getXmlDeclaration

public boolean getXmlDeclaration()
Returns whether the methods marshal(Object, Writer) and marshal(Object, OutputStream) ought to emit an XML declaration.

marshal

public void marshal(Object pObject,
                    ContentHandler pHandler)
            throws JAXBException
Specified by:
marshal in interface Marshaller

marshal

public void marshal(Object pObject,
                    Node pNode)
            throws JAXBException
Specified by:
marshal in interface Marshaller

marshal

public void marshal(Object pObject,
                    OutputStream pStream)
            throws JAXBException
Specified by:
marshal in interface Marshaller

marshal

public void marshal(Object pObject,
                    Result pResult)
            throws JAXBException
Specified by:
marshal in interface Marshaller

marshal

public void marshal(Object pObject,
                    Writer pWriter)
            throws JAXBException
Specified by:
marshal in interface Marshaller

setEncoding

public void setEncoding(String pEncoding)
            throws PropertyException
Sets the controllers encoding; to be used in marshalling. Defaults to DEFAULT_JAXB_ENCODING.
Parameters:
pEncoding - Suggested encoding or null to restore the default

setIndentation

public void setIndentation(boolean pIndentation)
Sets whether XML documents generated by the controller ought to be formatted. Defaults to true.

setIndentationSeparator

public void setIndentationSeparator(String pStr)
Sets the string used as a line separator. Defaults to DEFAULT_JAXME_INDENTATION_SEPARATOR. Equivalent to setProperty(JAXME_INDENTATION_SEPARATOR, pStr).

setIndentationString

public void setIndentationString(String pStr)
Sets the string used to indent one level. Defaults to DEFAULT_JAXME_INDENTATION_STRING. Equivalent to setProperty(JAXME_INDENTATION_STRING, pStr).

setNoNamespaceSchemaLocation

public void setNoNamespaceSchemaLocation(String pValue)
            throws PropertyException
Sets the schema location without namespace. The marshaller will use this to create an attribute xsi:noNamespaceSchemaLocation. Equivalent to setProperty(JAXB_NO_NAMESPACE_SCHEMA_LOCATION, pValue). Defaults to null, in which case the attribute isn't created.

setProperty

public void setProperty(String pProperty,
                        Object pValue)
            throws PropertyException
Specified by:
setProperty in interface Marshaller
Overrides:
setProperty in interface JMControllerImpl

setSchemaLocation

public void setSchemaLocation(String pValue)
            throws PropertyException
Sets the schema location. The marshaller will use this to create an attribute xsi:schemaLocation. Equivalent to setProperty(JAXB_SCHEMA_LOCATION, pValue). Defaults to null, in which case the attribute isn't created.

setXMLWriterClass

public void setXMLWriterClass(Class pClass)
            throws PropertyException
Sets the controllers class implementing XMLWriter. Defaults to XMLWriterImpl.
Parameters:
pClass - A class implementing XMLWriterImpl or null to restore the default.

setXmlDeclaration

public void setXmlDeclaration(boolean pDeclaration)
Sets whether the methods marshal(Object, Writer) and marshal(Object, OutputStream) ought to emit an XML declaration.