xmltooling  1.4.2
xmltooling::AbstractXMLObjectMarshaller Class Reference

A mix-in to implement object marshalling with DOM reuse. More...

#include <xmltooling/io/AbstractXMLObjectMarshaller.h>

Inheritance diagram for xmltooling::AbstractXMLObjectMarshaller:
Collaboration diagram for xmltooling::AbstractXMLObjectMarshaller:

List of all members.

Public Member Functions

xercesc::DOMElement * marshall (xercesc::DOMDocument *document=0, const std::vector< xmlsignature::Signature * > *sigs=0, const Credential *credential=0) const
 Marshalls the XMLObject, and its children, into a DOM element.
xercesc::DOMElement * marshall (xercesc::DOMElement *parentElement, const std::vector< xmlsignature::Signature * > *sigs=0, const Credential *credential=0) const
 Marshalls the XMLObject and appends it as a child of the given parent element.

Protected Member Functions

void setDocumentElement (xercesc::DOMDocument *document, xercesc::DOMElement *element) const
 Sets the given element as the Document Element of the given Document.
void marshallInto (xercesc::DOMElement *targetElement, const std::vector< xmlsignature::Signature * > *sigs, const Credential *credential=0) const
 Marshalls the XMLObject into the given DOM Element.
void marshallElementType (xercesc::DOMElement *domElement) const
 Creates an xsi:type attribute, corresponding to the given type of the XMLObject, on the DOM element.
void marshallNamespaces (xercesc::DOMElement *domElement) const
 Creates the xmlns attributes for any namespaces set on the XMLObject.
void marshallContent (xercesc::DOMElement *domElement, const Credential *credential) const
 Marshalls the text content and/or child elements of the XMLObject.
virtual void marshallAttributes (xercesc::DOMElement *domElement) const
 Marshalls the attributes from the XMLObject into the given DOM element.
virtual void prepareForMarshalling () const
 Called before marshalling in the event that a new DOM is being generated.

Detailed Description

A mix-in to implement object marshalling with DOM reuse.


Member Function Documentation

xercesc::DOMElement* xmltooling::AbstractXMLObjectMarshaller::marshall ( xercesc::DOMDocument *  document = 0,
const std::vector< xmlsignature::Signature * > *  sigs = 0,
const Credential *  credential = 0 
) const [virtual]

Marshalls the XMLObject, and its children, into a DOM element.

If a document is supplied, then it will be used to create the resulting elements. If the document does not have a Document Element set, then the resulting element will be set as the Document Element. If no document is supplied, then a new document will be created and bound to the lifetime of the root object being marshalled, unless an existing DOM can be reused without creating a new document.

Parameters:
documentthe DOM document the marshalled element will be placed in, or nullptr
sigsordered array of signatures to create after marshalling is complete
credentialoptional credential to supply signing key and related info
Returns:
the DOM element representing this XMLObject
Exceptions:
MarshallingExceptionthrown if there is a problem marshalling the given object
SignatureExceptionthrown if a problem occurs during signature creation

Implements xmltooling::XMLObject.

xercesc::DOMElement* xmltooling::AbstractXMLObjectMarshaller::marshall ( xercesc::DOMElement *  parentElement,
const std::vector< xmlsignature::Signature * > *  sigs = 0,
const Credential *  credential = 0 
) const [virtual]

Marshalls the XMLObject and appends it as a child of the given parent element.

NOTE: The given Element must be within a DOM tree rooted in the Document owning the given Element.

Parameters:
parentElementthe parent element to append the resulting DOM tree
sigsordered array of signatures to create after marshalling is complete
credentialoptional credential to supply signing key and related info
Returns:
the marshalled element tree
Exceptions:
MarshallingExceptionthrown if the given XMLObject can not be marshalled.
SignatureExceptionthrown if a problem occurs during signature creation

Implements xmltooling::XMLObject.

virtual void xmltooling::AbstractXMLObjectMarshaller::marshallAttributes ( xercesc::DOMElement *  domElement) const [protected, virtual]

Marshalls the attributes from the XMLObject into the given DOM element.

Parameters:
domElementthe DOM Element into which attributes will be marshalled
Exceptions:
MarshallingExceptionthrown if there is a problem marshalling an attribute
void xmltooling::AbstractXMLObjectMarshaller::marshallContent ( xercesc::DOMElement *  domElement,
const Credential *  credential 
) const [protected]

Marshalls the text content and/or child elements of the XMLObject.

Parameters:
domElementthe DOM element that will recieved the marshalled children
credentialoptional credential to supply signing key and related info
Exceptions:
MarshallingExceptionthrown if there is a problem marshalling a child element
void xmltooling::AbstractXMLObjectMarshaller::marshallElementType ( xercesc::DOMElement *  domElement) const [protected]

Creates an xsi:type attribute, corresponding to the given type of the XMLObject, on the DOM element.

Parameters:
domElementthe DOM element
Exceptions:
MarshallingExceptionthrown if the type on the XMLObject is doesn't contain a local name, prefix, and namespace URI
void xmltooling::AbstractXMLObjectMarshaller::marshallInto ( xercesc::DOMElement *  targetElement,
const std::vector< xmlsignature::Signature * > *  sigs,
const Credential *  credential = 0 
) const [protected]

Marshalls the XMLObject into the given DOM Element.

The DOM Element must be within a DOM tree rooted in the owning Document.

Parameters:
targetElementthe Element into which the XMLObject is marshalled into
sigsoptional array of signatures to create after marshalling
credentialoptional credential to supply signing key and related info
Exceptions:
MarshallingExceptionthrown if there is a problem marshalling the object
SignatureExceptionthrown if a problem occurs during signature creation
void xmltooling::AbstractXMLObjectMarshaller::marshallNamespaces ( xercesc::DOMElement *  domElement) const [protected]

Creates the xmlns attributes for any namespaces set on the XMLObject.

Parameters:
domElementthe DOM element the namespaces will be added to
virtual void xmltooling::AbstractXMLObjectMarshaller::prepareForMarshalling ( ) const [protected, virtual]

Called before marshalling in the event that a new DOM is being generated.

Allows objects to adjust internal state prior to the marshalling step.

void xmltooling::AbstractXMLObjectMarshaller::setDocumentElement ( xercesc::DOMDocument *  document,
xercesc::DOMElement *  element 
) const [protected]

Sets the given element as the Document Element of the given Document.

If the document already has a Document Element it is replaced by the given element.

Parameters:
documentthe document
elementthe Element that will serve as the Document Element

The documentation for this class was generated from the following file: