xmltooling 3.2.4
xmltooling::AbstractDOMCachingXMLObject Class Reference

AbstractXMLObject mixin that implements DOM caching. More...

#include <xmltooling/AbstractDOMCachingXMLObject.h>

Inheritance diagram for xmltooling::AbstractDOMCachingXMLObject:
xmltooling::AbstractXMLObject xmltooling::XMLObject

Public Member Functions

xercesc::DOMElement * getDOM () const
 Gets the DOM representation of this XMLObject, if one exists.
 
void setDOM (xercesc::DOMElement *dom, bool bindDocument=false) const
 Sets the DOM representation of this XMLObject.
 
void setDocument (xercesc::DOMDocument *doc) const
 Assigns ownership of a DOM document to the XMLObject.
 
void releaseDOM () const
 Releases the DOM representation of this XMLObject, if there is one.
 
void releaseParentDOM (bool propagateRelease=true) const
 Releases the DOM representation of this XMLObject's parent.
 
void releaseChildrenDOM (bool propagateRelease=true) const
 Releases the DOM representation of this XMLObject's children.
 
XMLObjectclone () const
 Creates a copy of the object, along with all of its children.
 
void detach ()
 Specialized function for detaching a child object from its parent while disposing of the parent.
 
- Public Member Functions inherited from xmltooling::AbstractXMLObject
void detach ()
 Specialized function for detaching a child object from its parent while disposing of the parent.
 
const QNamegetElementQName () const
 Gets the QName for this element.
 
const std::set< Namespace > & getNamespaces () const
 Gets the namespaces that are scoped to this element.
 
void addNamespace (const Namespace &ns) const
 Adds a namespace to the ones already scoped to this element.
 
void removeNamespace (const Namespace &ns)
 Removes a namespace from this element.
 
const QNamegetSchemaType () const
 Gets the XML schema type of this element.
 
const XMLCh * getXMLID () const
 Gets the value of the ID attribute set on this object, if any.
 
xmlconstants::xmltooling_bool_t getNil () const
 Returns the xsi:nil property as an explicit enumerated value.
 
void nil (xmlconstants::xmltooling_bool_t value)
 Sets the xsi:nil property using an enumerated value.
 
bool hasParent () const
 Checks to see if this object has a parent.
 
XMLObjectgetParent () const
 Gets the parent of this element or null if there is no parent.
 
void setParent (XMLObject *parent)
 Sets the parent of this element.
 
- Public Member Functions inherited from xmltooling::XMLObject
virtual const XMLCh * getLang () const
 Returns the xml:lang property of the object, if any.
 
bool nil () const
 Returns the xsi:nil property of the object, or false if not set.
 
void nil (bool value)
 Sets the xsi:nil property.
 
void setNil (const XMLCh *value)
 Sets the xsi:nil property using a string constant.
 
virtual bool hasChildren () const =0
 Checks if this XMLObject has children.
 
virtual const std::list< XMLObject * > & getOrderedChildren () const =0
 Returns an unmodifiable list of child objects in the order that they should appear in the serialized representation.
 
virtual void removeChild (XMLObject *child)=0
 Used by a child's detach method to isolate the child from this parent object in preparation for destroying the parent (this object).
 
virtual const XMLCh * getTextContent (unsigned int position=0) const =0
 Returns the text content at the specified position relative to any child elements.
 
virtual void setTextContent (const XMLCh *value, unsigned int position=0)=0
 Sets (or clears) text content relative to a child element's position.
 
void releaseThisandParentDOM () const
 A convenience method that is equal to calling releaseDOM() then releaseParentDOM(true).
 
void releaseThisAndChildrenDOM () const
 A convenience method that is equal to calling releaseChildrenDOM(true) then releaseDOM().
 
virtual xercesc::DOMElement * marshall (xercesc::DOMDocument *document=0, const std::vector< xmlsignature::Signature * > *sigs=0, const Credential *credential=0) const =0
 Marshalls the XMLObject, and its children, into a DOM element.
 
virtual xercesc::DOMElement * marshall (xercesc::DOMElement *parentElement, const std::vector< xmlsignature::Signature * > *sigs=0, const Credential *credential=0) const =0
 Marshalls the XMLObject and appends it as a child of the given parent element.
 
virtual XMLObjectunmarshall (xercesc::DOMElement *element, bool bindDocument=false)=0
 Unmarshalls the given W3C DOM element into the XMLObject.
 

Protected Member Functions

 AbstractDOMCachingXMLObject (const AbstractDOMCachingXMLObject &src)
 Copy constructor.
 
xercesc::DOMElement * cloneDOM (xercesc::DOMDocument *doc=0) const
 If a DOM representation exists, this clones it into a new document.
 
- Protected Member Functions inherited from xmltooling::AbstractXMLObject
 AbstractXMLObject (const XMLCh *nsURI=0, const XMLCh *localName=0, const XMLCh *prefix=0, const QName *schemaType=0)
 Constructor.
 
 AbstractXMLObject (const AbstractXMLObject &src)
 Copy constructor.
 
XMLCh * prepareForAssignment (XMLCh *oldValue, const XMLCh *newValue)
 A helper function for derived classes, for assignment of strings.
 
xercesc::XMLDateTime * prepareForAssignment (xercesc::XMLDateTime *oldValue, const xercesc::XMLDateTime *newValue)
 A helper function for derived classes, for assignment of date/time data.
 
xercesc::XMLDateTime * prepareForAssignment (xercesc::XMLDateTime *oldValue, time_t newValue, bool duration=false)
 A helper function for derived classes, for assignment of date/time data.
 
xercesc::XMLDateTime * prepareForAssignment (xercesc::XMLDateTime *oldValue, const XMLCh *newValue, bool duration=false)
 A helper function for derived classes, for assignment of date/time data.
 
QNameprepareForAssignment (QName *oldValue, const QName *newValue)
 A helper function for derived classes, for assignment of QName data.
 
XMLObjectprepareForAssignment (XMLObject *oldValue, XMLObject *newValue)
 A helper function for derived classes, for assignment of (singleton) XML objects.
 
- Protected Member Functions inherited from xmltooling::XMLObject

Additional Inherited Members

- Protected Attributes inherited from xmltooling::AbstractXMLObject
std::set< Namespacem_namespaces
 Set of namespaces associated with the object.
 
logging::Category & m_log
 Logging object.
 
XMLCh * m_schemaLocation
 Stores off xsi:schemaLocation attribute.
 
XMLCh * m_noNamespaceSchemaLocation
 Stores off xsi:noNamespaceSchemaLocation attribute.
 
xmlconstants::xmltooling_bool_t m_nil
 Stores off xsi:nil attribute.
 

Detailed Description

AbstractXMLObject mixin that implements DOM caching.

Inherit from this class to implement standard DOM caching behavior.

Member Function Documentation

◆ clone()

XMLObject * xmltooling::AbstractDOMCachingXMLObject::clone ( ) const
virtual

Creates a copy of the object, along with all of its children.

The new object tree will be completely distinct and independent of the original in all respects.

Implements xmltooling::XMLObject.

◆ cloneDOM()

xercesc::DOMElement * xmltooling::AbstractDOMCachingXMLObject::cloneDOM ( xercesc::DOMDocument * doc = 0) const
protected

If a DOM representation exists, this clones it into a new document.

Parameters
docthe document to clone into, or nullptr, in which case a new document is created
Returns
the cloned DOM

◆ detach()

void xmltooling::AbstractDOMCachingXMLObject::detach ( )
virtual

Specialized function for detaching a child object from its parent while disposing of the parent.

This is not a generic way of detaching any child object, but only of pruning a single child from the root of an XMLObject tree. If the detached XMLObject's parent is itself a child, an exception will be thrown. It's mainly useful for turning a child into the new root of the tree without having to clone the child.

Implements xmltooling::XMLObject.

◆ getDOM()

xercesc::DOMElement * xmltooling::AbstractDOMCachingXMLObject::getDOM ( ) const
virtual

Gets the DOM representation of this XMLObject, if one exists.

Returns
the DOM representation of this XMLObject

Implements xmltooling::XMLObject.

◆ releaseChildrenDOM()

void xmltooling::AbstractDOMCachingXMLObject::releaseChildrenDOM ( bool propagateRelease = true) const
virtual

Releases the DOM representation of this XMLObject's children.

Parameters
propagateReleasetrue if all descendants of this element should release their DOM

Implements xmltooling::XMLObject.

◆ releaseDOM()

void xmltooling::AbstractDOMCachingXMLObject::releaseDOM ( ) const
virtual

Releases the DOM representation of this XMLObject, if there is one.

Implements xmltooling::XMLObject.

◆ releaseParentDOM()

void xmltooling::AbstractDOMCachingXMLObject::releaseParentDOM ( bool propagateRelease = true) const
virtual

Releases the DOM representation of this XMLObject's parent.

Parameters
propagateReleasetrue if all ancestors of this element should release their DOM

Implements xmltooling::XMLObject.

◆ setDocument()

void xmltooling::AbstractDOMCachingXMLObject::setDocument ( xercesc::DOMDocument * doc) const
virtual

Assigns ownership of a DOM document to the XMLObject.

This binds the lifetime of the document to the lifetime of the object.

Parameters
docDOM document bound to this object

Implements xmltooling::XMLObject.

◆ setDOM()

void xmltooling::AbstractDOMCachingXMLObject::setDOM ( xercesc::DOMElement * dom,
bool bindDocument = false ) const
virtual

Sets the DOM representation of this XMLObject.

Parameters
domDOM representation of this XMLObject
bindDocumenttrue if the object should take ownership of the associated Document

Implements xmltooling::XMLObject.


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