xmltooling::AbstractComplexElement Class Reference

AbstractXMLObject mixin that implements children. More...

`#include <xmltooling/AbstractComplexElement.h>`

Inheritance diagram for xmltooling::AbstractComplexElement:

## Public Member Functions

bool | hasChildren () const
| Checks if this XMLObject has children.
const std::list< XMLObject * > & | getOrderedChildren () const
| Returns an unmodifiable list of child objects in the order that they should appear in the serialized representation.
void | removeChild (XMLObject *child)
| Used by a child's detach method to isolate the child from this parent object in preparation for destroying the parent (this object).
const XMLCh * | getTextContent (unsigned int position=0) const
| Returns the text content at the specified position relative to any child elements.
void | setTextContent (const XMLCh *value, unsigned int position=0)
| Sets (or clears) text content relative to a child element's position.
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 QName & | getElementQName () 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 QName * | getSchemaType () 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.
XMLObject * | getParent () 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 XMLObject * | clone () const =0
| Creates a copy of the object, along with all of its children.
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 xercesc::DOMElement * | getDOM () const =0
| Gets the DOM representation of this XMLObject, if one exists.
virtual void | setDOM (xercesc::DOMElement *dom, bool bindDocument=false) const =0
| Sets the DOM representation of this XMLObject.
virtual void | setDocument (xercesc::DOMDocument *doc) const =0
| Assigns ownership of a DOM document to the XMLObject.
virtual void | releaseDOM () const =0
| Releases the DOM representation of this XMLObject, if there is one.
virtual void | releaseParentDOM (bool propagateRelease=true) const =0
| Releases the DOM representation of this XMLObject's parent.
virtual void | releaseChildrenDOM (bool propagateRelease=true) const =0
| Releases the DOM representation of this XMLObject's children.
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 XMLObject * | unmarshall (xercesc::DOMElement *element, bool bindDocument=false)=0
| Unmarshalls the given W3C DOM element into the XMLObject.

## Protected Member Functions

| AbstractComplexElement (const AbstractComplexElement &src)
| Copy constructor.
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.
QName * | prepareForAssignment (QName *oldValue, const QName *newValue)
| A helper function for derived classes, for assignment of QName data.
XMLObject * | prepareForAssignment (XMLObject *oldValue, XMLObject *newValue)
| A helper function for derived classes, for assignment of (singleton) XML objects.

## Protected Attributes

std::list< XMLObject * > | m_children
| Underlying list of child objects.
std::vector< XMLCh * > | m_text
| Interstitial text nodes.
Protected Attributes inherited from xmltooling::AbstractXMLObject
std::set< Namespace > | m_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 children.

Inherit from this class to implement an element with child objects and mixed content.

## Member Function Documentation

## getOrderedChildren()

const std::list< XMLObject * > & xmltooling::AbstractComplexElement::getOrderedChildren | ( |  | ) | const

virtual

Returns an unmodifiable list of child objects in the order that they should appear in the serialized representation.

The validity of the returned list is not maintained if any non-const operations are performed on the parent object.

Returns
  the list of children

Implements xmltooling::XMLObject.

## getTextContent()

const XMLCh * xmltooling::AbstractComplexElement::getTextContent | ( | unsigned int | position = 0 | ) | const

virtual

Returns the text content at the specified position relative to any child elements.

A zero represents leading text, 1 comes after the first child, and so forth.

Parameters

  position | the relative child element position of the text

Returns
  the designated text value

Implements xmltooling::XMLObject.

## hasChildren()

bool xmltooling::AbstractComplexElement::hasChildren | ( |  | ) | const

virtual

Checks if this XMLObject has children.

Returns
  true if this XMLObject has children, false if not

Implements xmltooling::XMLObject.

## removeChild()

void xmltooling::AbstractComplexElement::removeChild | ( | XMLObject * | child | ) |

virtual

Used by a child's detach method to isolate the child from this parent object in preparation for destroying the parent (this object).

Parameters

  child | the child object to remove

Implements xmltooling::XMLObject.

## setTextContent()

void xmltooling::AbstractComplexElement::setTextContent | ( | const XMLCh * | value,
|  | unsigned int | position = 0 )

virtual

Sets (or clears) text content relative to a child element's position.

Parameters

  value | value to set, or nullptr to clear
  position | position relative to child element

Implements xmltooling::XMLObject.

## Member Data Documentation

## m_children

std::list<XMLObject*> xmltooling::AbstractComplexElement::m_children

protected

Underlying list of child objects.

Manages the lifetime of the children.

## m_text

std::vector<XMLCh*> xmltooling::AbstractComplexElement::m_text

protected

Interstitial text nodes.

Needed to support mixed content, and preserve DOM whitespace across rebuilds.

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

- xmltooling/AbstractComplexElement.h