Marshaller implementation.
This class provides a partial default implementation for the
jakarta.xml.bind.Marshaller interface.
The only methods that a Jakarta XML Binding Provider has to implement are
marshal(Object, javax.xml.transform.Result),
marshal(Object, javax.xml.stream.XMLStreamWriter), and
marshal(Object, javax.xml.stream.XMLEventWriter).
jakarta.xml.bind.Marshaller
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static String[] | |
| private String | encoding
store the value of the encoding property. |
| private ValidationEventHandler | eventHandler
handler that will be used to process errors and warnings during marshal |
| private boolean | formattedOutput
store the value of the formattedOutput property. |
| private boolean | fragment
store the value of the fragment property. |
| private String | noNSSchemaLocation
store the value of the noNamespaceSchemaLocation property. |
| private String | schemaLocation
store the value of the schemaLocation property. |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| private void | |
| public <A extends XmlAdapter | getAdapter(Class<A>
The type of the adapter. The specified instance will be used when
type)jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter#value()
refers to this type.Implements jakarta. |
| public AttachmentMarshaller | |
| protected String | Returns: the current encoding or "UTF-8" if it hasn't been set.Convenience method for getting the current output encoding. |
| public ValidationEventHandler | getEventHandler()
Implements jakarta. |
| protected String | |
| public Marshaller. | getListener()
Implements jakarta. Return |
| public Node | getNode(Object
- Jakarta XML Binding Java representation of XML content obj)Implements jakarta. java.lang.UnsupportedOperationException.
|
| protected String | Returns: the current noNamespaceSchemaLocation or null if it hasn't been setConvenience method for getting the current noNamespaceSchemaLocation. |
| public Object | getProperty(String
the name of the property to retrieve name)Implements jakarta. |
| public Schema | getSchema()
Implements jakarta. Schema object
being used to perform marshal-time validation.
|
| protected String | Returns: the current schemaLocation or null if it hasn't been setConvenience method for getting the current schemaLocation. |
| protected boolean | Returns: the current value of the formatted output flag or false if it hasn't been set.Convenience method for getting the formatted output flag. |
| protected boolean | Returns: the current value of the fragment flag or false if it hasn't been set.Convenience method for getting the fragment flag. |
| public final void | marshal(Object
The root of content tree to be marshalled. obj, OutputStream XML will be added to this stream. os)Implements jakarta. jaxbElement into an output stream.
|
| public void | marshal(Object
The root of content tree to be marshalled. jaxbElement, File File to be written. If this file already exists, it will be overwritten. output)Implements jakarta. jaxbElement into a file.
|
| public final void | marshal(Object
The root of content tree to be marshalled. obj, Writer XML will be sent to this writer. w)Implements jakarta. jaxbElement into a Writer.
|
| public final void | marshal(Object
The root of content tree to be marshalled. obj, ContentHandler XML will be sent to this handler as SAX2 events. handler)Implements jakarta. jaxbElement into SAX2 events.
|
| public final void | marshal(Object
The content tree to be marshalled. obj, Node DOM nodes will be added as children of this node.
This parameter must be a Node that accepts children
( node)org.w3c.dom.Document,
org.w3c.dom.DocumentFragment, or
org.w3c.dom.Element)Implements jakarta. jaxbElement into a DOM tree.
|
| public void | marshal(Object
The content tree rooted at jaxbElement to be marshalled. obj, XMLEventWriter XML will be sent to this writer. writer)Implements jakarta. jaxbElement into a
javax.xml.stream.XMLEventWriter.
|
| public void | marshal(Object
The content tree to be marshalled. obj, XMLStreamWriter XML will be sent to this writer. writer)Implements jakarta. jaxbElement into a
javax.xml.stream.XMLStreamWriter.
|
| public <A extends XmlAdapter | setAdapter(A
The instance of the adapter to be used. If null, it will un-register
the current adapter set for this type. adapter)Implements jakarta. XmlAdapter with this marshaller.
|
| public <A extends XmlAdapter | setAdapter(Class<A>
The type of the adapter. The specified instance will be used when
type, A jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter#value()
refers to this type.The instance of the adapter to be used. If null, it will un-register
the current adapter set for this type. adapter)Implements jakarta. XmlAdapter with this marshaller.
|
| public void | setAttachmentMarshaller(AttachmentMarshaller
the attachment marshaller to be set am)Implements jakarta. |
| protected void | setEncoding(String
a valid encoding as specified in the Marshaller class
documentation encoding)Convenience method for setting the output encoding. |
| public void | setEventHandler(ValidationEventHandler
the validation event handler handler)Implements jakarta. |
| protected void | setFormattedOutput(boolean
value of the formatted output flag. v)Convenience method for setting the formatted output flag. |
| protected void | |
| public void | setListener(Marshaller.
an instance of a class that implements listenerListenerImplements jakarta.
Register marshal event callback |
| protected void | setNoNSSchemaLocation(String
the noNamespaceSchemaLocation value location)Convenience method for setting the noNamespaceSchemaLocation. |
| public void | setProperty(String
the name of the property to be set. This value can either
be specified using one of the constant fields or a user
supplied string. name, Object the value of the property to be set value)Implements jakarta. |
| public void | setSchema(Schema
Schema object to validate marshal operations against or null to disable validation schema)Implements jakarta. Schema
object that should be used to validate subsequent marshal operations
against.
|
| protected void | setSchemaLocation(String
the schemaLocation value location)Convenience method for setting the schemaLocation. |
| aliases | back to summary |
|---|---|
| pack-priv static String[] aliases | |
| encoding | back to summary |
|---|---|
| private String encoding store the value of the encoding property. | |
| eventHandler | back to summary |
|---|---|
| private ValidationEventHandler eventHandler handler that will be used to process errors and warnings during marshal | |
| formattedOutput | back to summary |
|---|---|
| private boolean formattedOutput store the value of the formattedOutput property. | |
| fragment | back to summary |
|---|---|
| private boolean fragment store the value of the fragment property. | |
| noNSSchemaLocation | back to summary |
|---|---|
| private String noNSSchemaLocation store the value of the noNamespaceSchemaLocation property. | |
| schemaLocation | back to summary |
|---|---|
| private String schemaLocation store the value of the schemaLocation property. | |
| AbstractMarshallerImpl | back to summary |
|---|---|
| protected AbstractMarshallerImpl() Do-nothing constructor for the derived classes. | |
| checkBoolean | back to summary |
|---|---|
| private void checkBoolean(String name, Object value) throws PropertyException | |
| checkNotNull | back to summary |
|---|---|
| private void checkNotNull(Object o1, String o1Name, Object o2, String o2Name) | |
| checkString | back to summary |
|---|---|
| private void checkString(String name, Object value) throws PropertyException | |
| getAdapter | back to summary |
|---|---|
| public <A extends XmlAdapter Implements jakarta. Doc from jakarta. Gets the adapter associated with the specified type.
This is the reverse operation of the
| |
| getAttachmentMarshaller | back to summary |
|---|---|
| public AttachmentMarshaller getAttachmentMarshaller() Implements jakarta.
| |
| getEncoding | back to summary |
|---|---|
| protected String getEncoding() Convenience method for getting the current output encoding.
| |
| getEventHandler | back to summary |
|---|---|
| public ValidationEventHandler getEventHandler() throws JAXBException Implements jakarta. Doc from jakarta. Return the current event handler or the default event handler if one hasn't been set.
| |
| getJavaEncoding | back to summary |
|---|---|
| protected String getJavaEncoding(String encoding) throws UnsupportedEncodingException Gets the corresponding Java encoding name from an IANA name. This method is a helper method for the derived class to convert encoding names.
| |
| getListener | back to summary |
|---|---|
| public Marshaller. Implements jakarta. Doc from jakarta. Return
| |
| getNode | back to summary |
|---|---|
| public Node getNode(Object obj) throws JAXBException Implements jakarta. By default, the getNode method is unsupported and throw
an
| |
| getNoNSSchemaLocation | back to summary |
|---|---|
| protected String getNoNSSchemaLocation() Convenience method for getting the current noNamespaceSchemaLocation.
| |
| getProperty | back to summary |
|---|---|
| public Object getProperty(String name) throws PropertyException Implements jakarta. Default implementation of the getProperty method handles the four defined properties in Marshaller. If a provider needs to support additional provider specific properties, it should override this method in a derived class.
| |
| getSchema | back to summary |
|---|---|
| public Schema getSchema() Implements jakarta. Doc from jakarta. Get the JAXP | |
| getSchemaLocation | back to summary |
|---|---|
| protected String getSchemaLocation() Convenience method for getting the current schemaLocation.
| |
| isFormattedOutput | back to summary |
|---|---|
| protected boolean isFormattedOutput() Convenience method for getting the formatted output flag.
| |
| isFragment | back to summary |
|---|---|
| protected boolean isFragment() Convenience method for getting the fragment flag.
| |
| marshal | back to summary |
|---|---|
| public final void marshal(Object obj, OutputStream os) throws JAXBException Implements jakarta. Doc from jakarta. Marshal the content tree rooted at
| |
| marshal | back to summary |
|---|---|
| public void marshal(Object jaxbElement, File output) throws JAXBException Implements jakarta. Doc from jakarta. Marshal the content tree rooted at
| |
| marshal | back to summary |
|---|---|
| public final void marshal(Object obj, Writer w) throws JAXBException Implements jakarta. Doc from jakarta. Marshal the content tree rooted at
| |
| marshal | back to summary |
|---|---|
| public final void marshal(Object obj, ContentHandler handler) throws JAXBException Implements jakarta. Doc from jakarta. Marshal the content tree rooted at
| |
| marshal | back to summary |
|---|---|
| public final void marshal(Object obj, Node node) throws JAXBException Implements jakarta. Doc from jakarta. Marshal the content tree rooted at
| |
| marshal | back to summary |
|---|---|
| public void marshal(Object obj, XMLEventWriter writer) throws JAXBException Implements jakarta. Doc from jakarta. Marshal the content tree rooted at
| |
| marshal | back to summary |
|---|---|
| public void marshal(Object obj, XMLStreamWriter writer) throws JAXBException Implements jakarta. Doc from jakarta. Marshal the content tree rooted at
| |
| setAdapter | back to summary |
|---|---|
| public <A extends XmlAdapter Implements jakarta. Doc from jakarta. Associates a configured instance of
This is a convenience method that invokes
| |
| setAdapter | back to summary |
|---|---|
| public <A extends XmlAdapter Implements jakarta. Doc from jakarta. Associates a configured instance of
Every marshaller internally maintains a
This method allows applications to use a configured instance of
| |
| setAttachmentMarshaller | back to summary |
|---|---|
| public void setAttachmentMarshaller(AttachmentMarshaller am) Implements jakarta. Doc from jakarta. Associate a context that enables binary data within an XML document to be transmitted as XML-binary optimized attachment. The attachment is referenced from the XML document content model by content-id URIs(cid) references stored within the xml document.
| |
| setEncoding | back to summary |
|---|---|
| protected void setEncoding(String encoding) Convenience method for setting the output encoding.
| |
| setEventHandler | back to summary |
|---|---|
| public void setEventHandler(ValidationEventHandler handler) throws JAXBException Implements jakarta. Doc from jakarta. Allow an application to register a validation event handler. The validation event handler will be called by the Jakarta XML Binding Provider if any validation errors are encountered during calls to any of the marshal API's. If the client application does not register a validation event handler before invoking one of the marshal methods, then validation events will be handled by the default event handler which will terminate the marshal operation after the first error or fatal error is encountered. Calling this method with a null parameter will cause the Marshaller to revert back to the default default event handler.
| |
| setFormattedOutput | back to summary |
|---|---|
| protected void setFormattedOutput(boolean v) Convenience method for setting the formatted output flag.
| |
| setFragment | back to summary |
|---|---|
| protected void setFragment(boolean v) Convenience method for setting the fragment flag.
| |
| setListener | back to summary |
|---|---|
| public void setListener(Marshaller. Implements jakarta. Doc from jakarta.
Register marshal event callback
There is only one Listener per Marshaller. Setting a Listener replaces the previous set Listener.
One can unregister current Listener by setting listener to
| |
| setNoNSSchemaLocation | back to summary |
|---|---|
| protected void setNoNSSchemaLocation(String location) Convenience method for setting the noNamespaceSchemaLocation.
| |
| setProperty | back to summary |
|---|---|
| public void setProperty(String name, Object value) throws PropertyException Implements jakarta. Default implementation of the setProperty method handles the four defined properties in Marshaller. If a provider needs to handle additional properties, it should override this method in a derived class.
| |
| setSchema | back to summary |
|---|---|
| public void setSchema(Schema schema) Implements jakarta. Doc from jakarta. Specify the JAXP This method allows the caller to validate the marshalled XML as it's marshalled.
Initially this property is set to | |
| setSchemaLocation | back to summary |
|---|---|
| protected void setSchemaLocation(String location) Convenience method for setting the schemaLocation.
| |