org.apache.ws.jaxme.impl

Class JMMarshallerImpl

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 StringDEFAULT_JAXB_ENCODING
Default value for {@link Marshaller#JAXB_ENCODING}.
static StringDEFAULT_JAXME_INDENTATION_SEPARATOR
Default value for {@link #JAXME_INDENTATION_SEPARATOR}.
static StringDEFAULT_JAXME_INDENTATION_STRING
Default value for {@link #JAXME_INDENTATION_STRING}: Two blanks.
static StringJAXME_INDENTATION_SEPARATOR
Property name for setting the String used as a line separator in the formatted output.
static StringJAXME_INDENTATION_STRING
Property name for setting the String used to indent the formatted output by one level.
static StringJAXME_XML_DECLARATION
Property name for choosing whether the marshalled output should contain an XML declaration.
static StringJAXME_XML_WRITER
Property name for a SAX {@link ContentHandler} which is able to marshal a SAX stream into a character stream.
Method Summary
StringgetEncoding()
Returns the controllers encoding; to be used in marshalling.
booleangetIndentation()

Returns whether XML documents generated by the controller ought to be formatted.

StringgetIndentationSeparator()

Returns the string used as a line separator.

StringgetIndentationString()

Returns the string used to indent one level.

NodegetNode(Object contentTree)
StringgetNoNamespaceSchemaLocation()

Returns the schema location.

ObjectgetProperty(String pProperty)
StringgetSchemaLocation()

Returns the schema location.

booleangetXmlDeclaration()

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

ClassgetXMLWriterClass()

Returns the controllers class implementing {@link XMLWriter}.

voidmarshal(Object pObject, OutputStream pStream)
voidmarshal(Object pObject, ContentHandler pHandler)
voidmarshal(Object pObject, Writer pWriter)
voidmarshal(Object pObject, Node pNode)
voidmarshal(Object pObject, Result pResult)
voidsetEncoding(String pEncoding)
Sets the controllers encoding; to be used in marshalling.
voidsetIndentation(boolean pIndentation)

Sets whether XML documents generated by the controller ought to be formatted.

voidsetIndentationSeparator(String pStr)

Sets the string used as a line separator.

voidsetIndentationString(String pStr)

Sets the string used to indent one level.

voidsetNoNamespaceSchemaLocation(String pValue)

Sets the schema location without namespace.

voidsetProperty(String pProperty, Object pValue)
voidsetSchemaLocation(String pValue)

Sets the schema location.

voidsetXmlDeclaration(boolean pDeclaration)

Sets whether the methods marshal(Object, Writer) and marshal(Object, OutputStream) ought to emit an XML declaration.

voidsetXMLWriterClass(Class pClass)
Sets the controllers class implementing {@link XMLWriter}.

Field Detail

DEFAULT_JAXB_ENCODING

public static final String DEFAULT_JAXB_ENCODING
Default value for {@link Marshaller#JAXB_ENCODING}. (UTF-8 encoding)

DEFAULT_JAXME_INDENTATION_SEPARATOR

public static final String DEFAULT_JAXME_INDENTATION_SEPARATOR
Default value for {@link #JAXME_INDENTATION_SEPARATOR}. ("\n", Line Feed)

DEFAULT_JAXME_INDENTATION_STRING

public static final String DEFAULT_JAXME_INDENTATION_STRING
Default value for {@link #JAXME_INDENTATION_STRING}: Two blanks.

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")

See Also: JMMarshallerImpl JMMarshallerImpl

JAXME_INDENTATION_STRING

public static final String JAXME_INDENTATION_STRING
Property name for setting the String used to indent the formatted output by one level. ("jaxme.indentation.string") Defaults to {@link #DEFAULT_JAXME_INDENTATION_STRING}.

See Also: JMMarshallerImpl JMMarshallerImpl

JAXME_XML_DECLARATION

public static final String JAXME_XML_DECLARATION
Property name for choosing whether the marshalled output should contain an XML declaration. The methods {@link #marshal(Object, OutputStream)} and {@link #marshal(Object, Writer)} recognize requests for XML declarations.

See Also: JMMarshallerImpl JMMarshallerImpl

JAXME_XML_WRITER

public static final String JAXME_XML_WRITER
Property name for a SAX {@link ContentHandler} which is able to marshal a SAX stream into a character stream. The property value is an instance of {@link Class} implementing {@link XMLWriter}.

Method Detail

getEncoding

public String getEncoding()
Returns the controllers encoding; to be used in marshalling. Defaults to {@link #DEFAULT_JAXB_ENCODING}.

getIndentation

public boolean getIndentation()

Returns whether XML documents generated by the controller ought to be formatted. Defaults to true.

getIndentationSeparator

public String getIndentationSeparator()

Returns the string used as a line separator. Defaults to {@link #DEFAULT_JAXME_INDENTATION_SEPARATOR}. Equivalent to getProperty(JAXME_INDENTATION_SEPARATOR).

See Also: DEFAULT_JAXME_INDENTATION_SEPARATOR JMMarshallerImpl JMMarshallerImpl

getIndentationString

public String getIndentationString()

Returns the string used to indent one level. Defaults to {@link #DEFAULT_JAXME_INDENTATION_STRING}. Equivalent to getProperty(JAXME_INDENTATION_STRING).

See Also: DEFAULT_JAXME_INDENTATION_STRING JMMarshallerImpl JMMarshallerImpl

getNode

public Node getNode(Object contentTree)

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.

See Also: JAXB_NO_NAMESPACE_SCHEMA_LOCATION JMMarshallerImpl setNoNamespaceSchemaLocation

getProperty

public Object getProperty(String pProperty)

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.

See Also: JAXB_SCHEMA_LOCATION JMMarshallerImpl setSchemaLocation

getXmlDeclaration

public boolean getXmlDeclaration()

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

getXMLWriterClass

public Class getXMLWriterClass()

Returns the controllers class implementing {@link XMLWriter}. Defaults to {@link XMLWriterImpl}.

marshal

public void marshal(Object pObject, OutputStream pStream)

marshal

public void marshal(Object pObject, ContentHandler pHandler)

marshal

public void marshal(Object pObject, Writer pWriter)

marshal

public void marshal(Object pObject, Node pNode)

marshal

public void marshal(Object pObject, Result pResult)

setEncoding

public void setEncoding(String pEncoding)
Sets the controllers encoding; to be used in marshalling. Defaults to {@link #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 {@link #DEFAULT_JAXME_INDENTATION_SEPARATOR}. Equivalent to setProperty(JAXME_INDENTATION_SEPARATOR, pStr).

See Also: DEFAULT_JAXME_INDENTATION_SEPARATOR JMMarshallerImpl JMMarshallerImpl

setIndentationString

public void setIndentationString(String pStr)

Sets the string used to indent one level. Defaults to {@link #DEFAULT_JAXME_INDENTATION_STRING}. Equivalent to setProperty(JAXME_INDENTATION_STRING, pStr).

See Also: DEFAULT_JAXME_INDENTATION_STRING JMMarshallerImpl JMMarshallerImpl

setNoNamespaceSchemaLocation

public void setNoNamespaceSchemaLocation(String pValue)

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.

See Also: JAXB_NO_NAMESPACE_SCHEMA_LOCATION JMMarshallerImpl getNoNamespaceSchemaLocation

setProperty

public void setProperty(String pProperty, Object pValue)

setSchemaLocation

public void setSchemaLocation(String pValue)

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.

See Also: JAXB_SCHEMA_LOCATION JMMarshallerImpl getSchemaLocation

setXmlDeclaration

public void setXmlDeclaration(boolean pDeclaration)

Sets whether the methods marshal(Object, Writer) and marshal(Object, OutputStream) ought to emit an XML declaration.

setXMLWriterClass

public void setXMLWriterClass(Class pClass)
Sets the controllers class implementing {@link XMLWriter}. Defaults to {@link XMLWriterImpl}.

Parameters: pClass A class implementing {@link XMLWriterImpl} or null to restore the default.