|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opensaml.xml.io.AbstractXMLObjectMarshaller
public abstract class AbstractXMLObjectMarshaller
A thread safe, abstract implementation of the Marshaller
interface. This class handles
most of the boilerplate code:
Field Summary | |
---|---|
private Logger |
log
Class logger. |
private MarshallerFactory |
marshallerFactory
Factory for XMLObject Marshallers. |
private QName |
targetQName
The target name and namespace for this marshaller. |
Constructor Summary | |
---|---|
protected |
AbstractXMLObjectMarshaller()
Constructor. |
protected |
AbstractXMLObjectMarshaller(String targetNamespaceURI,
String targetLocalName)
Deprecated. no replacement |
Method Summary | |
---|---|
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. |
private void |
prepareForAdoption(XMLObject domCachingObject)
Prepares the given DOM caching XMLObject for adoption into another document. |
protected void |
setDocumentElement(Document document,
Element element)
Sets the given element as the Document Element of the given Document. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final Logger log
private QName targetQName
private MarshallerFactory marshallerFactory
Constructor Detail |
---|
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 onMethod Detail |
---|
public 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 marshall
MarshallingException
- 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 in
MarshallingException
- 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 XMLObject
MarshallingException
- 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 into
XMLObject
is marshalled into
MarshallingException
- thrown if there is a problem marshalling the objectprotected void checkXMLObjectIsTarget(XMLObject xmlObject) throws MarshallingException
xmlObject
- the XMLObject to marshall
MarshallingException
- 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 children
MarshallingException
- 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 to
MarshallingException
- 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 element
MarshallingException
- 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 content
MarshallingException
- thrown if the textual content can not be added to the DOM elementprivate void prepareForAdoption(XMLObject domCachingObject) throws MarshallingException
domCachingObject
- the XMLObject to prepare for adoption
MarshallingException
- thrown if a namespace within the XMLObject's DOM subtree can not be resolved.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |