|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.xml.bind.helpers.AbstractMarshallerImpl
Default implementation of a Marshaller. The JAXB provider needs
to implement only
Marshaller.marshal(Object, javax.xml.transform.Result).
Marshaller| Field Summary |
| Fields inherited from interface javax.xml.bind.Marshaller |
JAXB_ENCODING, JAXB_FORMATTED_OUTPUT, JAXB_NO_NAMESPACE_SCHEMA_LOCATION, JAXB_SCHEMA_LOCATION |
| Constructor Summary | |
AbstractMarshallerImpl()
Creates a new instance of AbstractMarshallerImpl. |
|
| Method Summary | |
protected java.lang.String |
getEncoding()
Returns the current output encoding. |
ValidationEventHandler |
getEventHandler()
Returns an event handler previously registered by the application. |
protected java.lang.String |
getJavaEncoding(java.lang.String pEncoding)
Converts the given IANA encoding name into a Java encoding name. |
org.w3c.dom.Node |
getNode(java.lang.Object obj)
This method is unsupported in the default implementation and throws an UnsupportedOperationException. |
protected java.lang.String |
getNoNSSchemaLocation()
Returns the marshallers "no namespace" schema location. |
java.lang.Object |
getProperty(java.lang.String pName)
Public interface to get the properties defined by the Marshaller interface. |
protected java.lang.String |
getSchemaLocation()
Returns the marshallers schema location. |
protected boolean |
isFormattedOutput()
Returns whether the marshaller will create formatted output or not. |
void |
marshal(java.lang.Object pObject,
org.xml.sax.ContentHandler pHandler)
Marshals the given JAXB object by emitting SAX events into into the given SAX ContentHandler. |
void |
marshal(java.lang.Object pObject,
org.w3c.dom.Node pNode)
Marshals the given JAXB object by creating a DOM tree below the given node. |
void |
marshal(java.lang.Object pObject,
java.io.OutputStream pStream)
Marshals the given JAXB object pObject and
serializes it into the byte stream pTarget. |
void |
marshal(java.lang.Object pObject,
java.io.Writer pWriter)
Marshals the given JAXB object pObject and
serializes it into the character stream pTarget. |
protected void |
setEncoding(java.lang.String pEncoding)
Sets the current output encoding. |
void |
setEventHandler(ValidationEventHandler pHandler)
Allows the application to set an event handler. |
protected void |
setFormattedOutput(boolean pFormattedOutput)
Sets whether the marshaller will create formatted output or not. |
protected void |
setNoNSSchemaLocation(java.lang.String pNoNSSchemaLocation)
Sets the marshallers "no namespace" schema location. |
void |
setProperty(java.lang.String pName,
java.lang.Object pValue)
Public interface to set the properties defined by the Marshaller interface. |
protected void |
setSchemaLocation(java.lang.String pSchemaLocation)
Sets the marshallers schema location. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.xml.bind.Marshaller |
marshal |
| Constructor Detail |
public AbstractMarshallerImpl()
Creates a new instance of AbstractMarshallerImpl.
| Method Detail |
public void setEventHandler(ValidationEventHandler pHandler)
throws JAXBException
MarshallerAllows the application to set an event handler. The event handler will be invoked in case of a validation event.
Note: The ability to register an event handler does not
indicate that a JAXB provider is required to validate the objects
being marshalled. If you want to ensure, that only valid objects
are marshalled, you should perform an explicit validation using a
Validator.
setEventHandler in interface MarshallerpHandler - An application specific event handler or null to
revert to the default event handler. The default handler is
throwing an exception in case of errors.
JAXBException
public ValidationEventHandler getEventHandler()
throws JAXBException
MarshallerReturns an event handler previously registered by the application. The event handler will be invoked in case of a validation event.
Note: The ability to register an event handler does not
indicate that a JAXB provider is required to validate the objects
being marshalled. If you want to ensure, that only valid objects
are marshalled, you should perform an explicit validation using a
Validator.
getEventHandler in interface MarshallerJAXBException - An error occurred while getting the event
handler.
public void setProperty(java.lang.String pName,
java.lang.Object pValue)
throws PropertyException
Public interface to set the properties defined
by the Marshaller interface.
Works by invocation of setEncoding(String),
setFormattedOutput(boolean),
setNoNSSchemaLocation(String), and
setSchemaLocation(String) internally.
If you want to support additional properties, you have to override this method in a subclass.
setProperty in interface MarshallerpName - The property name.
PropertyException - Unknown property name
public java.lang.Object getProperty(java.lang.String pName)
throws PropertyException
Public interface to get the properties defined
by the Marshaller interface.
Works by invocation of getEncoding(),
isFormattedOutput(),
getNoNSSchemaLocation(), and
getSchemaLocation() internally.
If you want to support additional properties, you have to override this method in a subclass.
getProperty in interface MarshallerpName - The property name.
PropertyException - Unknown property nameprotected java.lang.String getEncoding()
Returns the current output encoding.
Marshaller.JAXB_ENCODING
protected java.lang.String getJavaEncoding(java.lang.String pEncoding)
throws java.io.UnsupportedEncodingException
Converts the given IANA encoding name into a Java encoding name. This is a helper method for derived subclasses.
java.io.UnsupportedEncodingExceptionprotected void setEncoding(java.lang.String pEncoding)
Sets the current output encoding.
Marshaller.JAXB_ENCODINGprotected void setSchemaLocation(java.lang.String pSchemaLocation)
Sets the marshallers schema location. Defaults to null.
Marshaller.JAXB_SCHEMA_LOCATIONprotected java.lang.String getSchemaLocation()
Returns the marshallers schema location. Defaults to null.
Marshaller.JAXB_SCHEMA_LOCATIONprotected void setNoNSSchemaLocation(java.lang.String pNoNSSchemaLocation)
Sets the marshallers "no namespace" schema location. Defaults to null.
Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATIONprotected java.lang.String getNoNSSchemaLocation()
Returns the marshallers "no namespace" schema location. Defaults to null.
Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATIONprotected void setFormattedOutput(boolean pFormattedOutput)
Sets whether the marshaller will create formatted output or not. By default it does.
Marshaller.JAXB_FORMATTED_OUTPUTprotected boolean isFormattedOutput()
Returns whether the marshaller will create formatted output or not. By default it does.
Marshaller.JAXB_FORMATTED_OUTPUT
public final void marshal(java.lang.Object pObject,
java.io.OutputStream pStream)
throws JAXBException
MarshallerMarshals the given JAXB object pObject and
serializes it into the byte stream pTarget. Note,
that serialization into a byte stream demands the use of an
encoding. It may be required to set the parameter
Marshaller.JAXB_ENCODING. By default the created output is
formatted, which may be turned off using
Marshaller.JAXB_FORMATTED_OUTPUT.
marshal in interface MarshallerpObject - The JAXB object being marshalled.pStream - The output byte stream.
JAXBException - An unexpected problem occurred. This may be used,
for example, to throw a nested IOException.Marshaller.JAXB_ENCODING,
Marshaller.JAXB_FORMATTED_OUTPUT,
Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION,
Marshaller.JAXB_SCHEMA_LOCATION
public final void marshal(java.lang.Object pObject,
java.io.Writer pWriter)
throws JAXBException
MarshallerMarshals the given JAXB object pObject and
serializes it into the character stream pTarget.
Unlike serialization to a byte stream, an encoding is not
required, but a Marshaller may use the encoding
whether to escape a character or not. Use of the
Marshaller.JAXB_ENCODING property is still recommended. By
default the created output is
formatted, which may be turned off using
Marshaller.JAXB_FORMATTED_OUTPUT.
marshal in interface MarshallerpObject - The JAXB object being marshalled.pWriter - The output character stream.
JAXBException - An unexpected problem occurred. This may be used,
for example, to throw a nested IOException.Marshaller.JAXB_ENCODING,
Marshaller.JAXB_FORMATTED_OUTPUT,
Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION,
Marshaller.JAXB_SCHEMA_LOCATION
public final void marshal(java.lang.Object pObject,
org.xml.sax.ContentHandler pHandler)
throws JAXBException
MarshallerMarshals the given JAXB object by emitting SAX events into
into the given SAX ContentHandler. This
includes the events ContentHandler.startDocument()
and ContentHandler.endDocument().
marshal in interface MarshallerpObject - The JAXB Object being marshalled.pHandler - The target event handler.
JAXBException - An unexpected problem occurred. This may be used,
for example, to throw a nested SAXException.Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION,
Marshaller.JAXB_SCHEMA_LOCATION
public final void marshal(java.lang.Object pObject,
org.w3c.dom.Node pNode)
throws JAXBException
MarshallerMarshals the given JAXB object by creating a DOM tree below the given node.
marshal in interface MarshallerpObject - The JAXB object being marshalled.pNode - The target node. This node must be ready to accept a
child element. For example, it may be a Document,
a DocumentFragment, or an
Element.
JAXBException - An unexpected problem occurred. This may be used,
for example, to throw a nested DOMException.Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION,
Marshaller.JAXB_SCHEMA_LOCATION
public org.w3c.dom.Node getNode(java.lang.Object obj)
throws JAXBException
This method is unsupported in the default implementation
and throws an UnsupportedOperationException.
getNode in interface Marshallerobj - The JAXB object being viewed.
UnsupportedException - This method is not available in the
default implementation.
JAXBException - An unexpected problem occurred. This may be used,
for example, to throw a nested DOMException.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||