public abstract class AbstractXMLObjectMarshaller extends Object implements Marshaller
Marshaller
interface. This class handles
most of the boilerplate code:
Modifier | Constructor and Description |
---|---|
protected |
AbstractXMLObjectMarshaller()
Constructor.
|
protected |
AbstractXMLObjectMarshaller(String targetNamespaceURI,
String targetLocalName)
Deprecated.
no replacement
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkXMLObjectIsTarget(XMLObject xmlObject)
Checks to make sure the given XMLObject's schema type or element QName matches the target parameters given at
marshaller construction time.
|
Element |
marshall(XMLObject xmlObject)
Marshall this element, and its children, and root them in a newly created Document.
|
Element |
marshall(XMLObject xmlObject,
Document document)
Marshall this element, and its children, into a W3C DOM element.
|
Element |
marshall(XMLObject xmlObject,
Element parentElement)
Marshall the given XMLObject and append it as a child to the given parent element.
|
protected abstract void |
marshallAttributes(XMLObject xmlObject,
Element domElement)
Marshalls a given XMLObject into a W3C Element.
|
protected void |
marshallChildElements(XMLObject xmlObject,
Element domElement)
Marshalls the child elements of the given XMLObject.
|
protected abstract void |
marshallElementContent(XMLObject xmlObject,
Element domElement)
Marshalls data from the XMLObject into content of the DOM Element.
|
protected Element |
marshallInto(XMLObject xmlObject,
Element targetElement)
Marshalls the given XMLObject into the given DOM Element.
|
protected void |
marshallNamespacePrefix(XMLObject xmlObject,
Element domElement)
Marshalls the namespace prefix of the XMLObject into the DOM element.
|
protected void |
marshallNamespaces(XMLObject xmlObject,
Element domElement)
Creates the xmlns attributes for any namespaces set on the given XMLObject.
|
protected void |
marshallSchemaInstanceAttributes(XMLObject xmlObject,
Element domElement)
Creates the XSI type, schemaLocation, and noNamespaceSchemaLocation attributes for an XMLObject.
|
protected void |
setDocumentElement(Document document,
Element element)
Sets the given element as the Document Element of the given Document.
|
protected AbstractXMLObjectMarshaller()
protected AbstractXMLObjectMarshaller(String targetNamespaceURI, String targetLocalName)
targetNamespaceURI
- the namespace URI of either the schema type QName or element QName of the elements this
unmarshaller operates ontargetLocalName
- the local name of either the schema type QName or element QName of the elements this
unmarshaller operates onpublic Element marshall(XMLObject xmlObject) throws MarshallingException
DocumentBuilder
obtained from a DocumentBuilderFactory
created without any additional parameters or properties set; that is the system defaults properties are used.marshall
in interface Marshaller
xmlObject
- the object to marshallMarshallingException
- thrown if there is a problem marshalling the given objectpublic Element marshall(XMLObject xmlObject, Document document) throws MarshallingException
marshall
in interface Marshaller
xmlObject
- the object to marshalldocument
- the DOM document the marshalled element will be placed inMarshallingException
- thrown if there is a problem marshalling the given objectpublic Element marshall(XMLObject xmlObject, Element parentElement) throws MarshallingException
marshall
in interface Marshaller
xmlObject
- the XMLObject to be marshalledparentElement
- the parent of the Element resulting from marshalling the given XMLObjectMarshallingException
- thrown if the given XMLObject can not be marshalled.protected void setDocumentElement(Document document, Element element)
document
- the documentelement
- the Element that will serve as the Document Elementprotected Element marshallInto(XMLObject xmlObject, Element targetElement) throws MarshallingException
xmlObject
- the XMLObject to marshalltargetElement
- the Element into which the XMLObject is marshalled intoXMLObject
is marshalled intoMarshallingException
- thrown if there is a problem marshalling the objectprotected void checkXMLObjectIsTarget(XMLObject xmlObject) throws MarshallingException
xmlObject
- the XMLObject to marshallMarshallingException
- thrown if the given object is not or the required typeprotected void marshallNamespacePrefix(XMLObject xmlObject, Element domElement)
xmlObject
- the XMLObject being marshalleddomElement
- the DOM element the XMLObject is being marshalled intoprotected void marshallChildElements(XMLObject xmlObject, Element domElement) throws MarshallingException
xmlObject
- the XMLObject whose children will be marshalleddomElement
- the DOM element that will recieved the marshalled childrenMarshallingException
- thrown if there is a problem marshalling a child elementprotected void marshallNamespaces(XMLObject xmlObject, Element domElement)
xmlObject
- the XMLObjectdomElement
- the DOM element the namespaces will be added toprotected void marshallSchemaInstanceAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException
xmlObject
- the XMLObjectdomElement
- the DOM element the namespaces will be added toMarshallingException
- thrown if the schema type information is invalidprotected abstract void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException
xmlObject
- the XMLObject to marshalldomElement
- the W3C DOM elementMarshallingException
- thrown if there is a problem marshalling the elementprotected abstract void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException
xmlObject
- the XMLObjectdomElement
- the DOM element recieving the contentMarshallingException
- thrown if the textual content can not be added to the DOM elementCopyright © 2018 JBoss by Red Hat. All rights reserved.