xmltooling::XMLHelper Class Reference

A helper class for working with W3C DOM objects. More...

#include <xmltooling/util/XMLHelper.h>

List of all members.

Static Public Member Functions

static bool hasXSIType (const xercesc::DOMElement *e)
 Checks if the given element has an xsi:type defined for it.
static QNamegetXSIType (const xercesc::DOMElement *e)
 Gets the XSI type for a given element if it has one.
static xercesc::DOMAttr * getIdAttribute (const xercesc::DOMElement *domElement)
 Gets the ID attribute of a DOM element.
static const XMLObjectgetXMLObjectById (const XMLObject &tree, const XMLCh *id)
 Attempts to locate an XMLObject from this point downward in the tree whose XML ID matches the supplied value.
static XMLObjectgetXMLObjectById (XMLObject &tree, const XMLCh *id)
 Attempts to locate an XMLObject from this point downward in the tree whose XML ID matches the supplied value.
static QNamegetNodeQName (const xercesc::DOMNode *domNode)
 Gets the QName for the given DOM node.
static QNamegetAttributeValueAsQName (const xercesc::DOMAttr *attribute)
static QNamegetNodeValueAsQName (const xercesc::DOMNode *domNode)
 Constructs a QName from a node's value.
static xercesc::DOMElement * appendChildElement (xercesc::DOMElement *parentElement, xercesc::DOMElement *childElement)
 Appends the child Element to the parent Element, importing the child Element into the parent's Document if needed.
static bool isNodeNamed (const xercesc::DOMNode *n, const XMLCh *ns, const XMLCh *local)
 Checks the qualified name of a node.
static xercesc::DOMElement * getFirstChildElement (const xercesc::DOMNode *n, const XMLCh *localName=NULL)
 Returns the first matching child element of the node if any.
static xercesc::DOMElement * getLastChildElement (const xercesc::DOMNode *n, const XMLCh *localName=NULL)
 Returns the last matching child element of the node if any.
static xercesc::DOMElement * getNextSiblingElement (const xercesc::DOMNode *n, const XMLCh *localName=NULL)
 Returns the next matching sibling element of the node if any.
static xercesc::DOMElement * getPreviousSiblingElement (const xercesc::DOMNode *n, const XMLCh *localName=NULL)
 Returns the previous matching sibling element of the node if any.
static xercesc::DOMElement * getFirstChildElement (const xercesc::DOMNode *n, const XMLCh *ns, const XMLCh *localName)
 Returns the first matching child element of the node if any.
static xercesc::DOMElement * getLastChildElement (const xercesc::DOMNode *n, const XMLCh *ns, const XMLCh *localName)
 Returns the last matching child element of the node if any.
static xercesc::DOMElement * getNextSiblingElement (const xercesc::DOMNode *n, const XMLCh *ns, const XMLCh *localName)
 Returns the next matching sibling element of the node if any.
static xercesc::DOMElement * getPreviousSiblingElement (const xercesc::DOMNode *n, const XMLCh *ns, const XMLCh *localName)
 Returns the previous matching sibling element of the node if any.
static const XMLCh * getTextContent (const xercesc::DOMElement *e)
 Returns the content of the first Text node found in the element, if any.
static void serialize (const xercesc::DOMNode *n, std::string &buf, bool pretty=false)
 Serializes the DOM node provided into a buffer using UTF-8 encoding and the default XML serializer available.
static std::ostream & serialize (const xercesc::DOMNode *n, std::ostream &out, bool pretty=false)
 Serializes the DOM node provided to a stream using UTF-8 encoding and the default XML serializer available.


Detailed Description

A helper class for working with W3C DOM objects.


Member Function Documentation

static xercesc::DOMElement* xmltooling::XMLHelper::appendChildElement ( xercesc::DOMElement *  parentElement,
xercesc::DOMElement *  childElement 
) [static]

Appends the child Element to the parent Element, importing the child Element into the parent's Document if needed.

Parameters:
parentElement the parent Element
childElement the child Element
Returns:
the child Element that was added (may be an imported copy)

static QName* xmltooling::XMLHelper::getAttributeValueAsQName ( const xercesc::DOMAttr *  attribute  )  [static]

Deprecated:
Constructs a QName from an attribute's value.
Parameters:
attribute the attribute with a QName value
Returns:
a QName from an attribute's value, or null if the given attribute is null

static xercesc::DOMElement* xmltooling::XMLHelper::getFirstChildElement ( const xercesc::DOMNode *  n,
const XMLCh *  ns,
const XMLCh *  localName 
) [static]

Returns the first matching child element of the node if any.

Parameters:
n node to check
ns namespace to compare with
localName local name to compare with
Returns:
the first matching child node of type Element, or NULL

static xercesc::DOMElement* xmltooling::XMLHelper::getFirstChildElement ( const xercesc::DOMNode *  n,
const XMLCh *  localName = NULL 
) [static]

Returns the first matching child element of the node if any.

Parameters:
n node to check
localName local name to compare with or NULL for any match
Returns:
the first matching child node of type Element, or NULL

static xercesc::DOMAttr* xmltooling::XMLHelper::getIdAttribute ( const xercesc::DOMElement *  domElement  )  [static]

Gets the ID attribute of a DOM element.

Parameters:
domElement the DOM element
Returns:
the ID attribute or null if there isn't one

static xercesc::DOMElement* xmltooling::XMLHelper::getLastChildElement ( const xercesc::DOMNode *  n,
const XMLCh *  ns,
const XMLCh *  localName 
) [static]

Returns the last matching child element of the node if any.

Parameters:
n node to check
ns namespace to compare with
localName local name to compare with
Returns:
the last matching child node of type Element, or NULL

static xercesc::DOMElement* xmltooling::XMLHelper::getLastChildElement ( const xercesc::DOMNode *  n,
const XMLCh *  localName = NULL 
) [static]

Returns the last matching child element of the node if any.

Parameters:
n node to check
localName local name to compare with or NULL for any match
Returns:
the last matching child node of type Element, or NULL

static xercesc::DOMElement* xmltooling::XMLHelper::getNextSiblingElement ( const xercesc::DOMNode *  n,
const XMLCh *  ns,
const XMLCh *  localName 
) [static]

Returns the next matching sibling element of the node if any.

Parameters:
n node to check
ns namespace to compare with
localName local name to compare with
Returns:
the next matching sibling node of type Element, or NULL

static xercesc::DOMElement* xmltooling::XMLHelper::getNextSiblingElement ( const xercesc::DOMNode *  n,
const XMLCh *  localName = NULL 
) [static]

Returns the next matching sibling element of the node if any.

Parameters:
n node to check
localName local name to compare with or NULL for any match
Returns:
the next matching sibling node of type Element, or NULL

static QName* xmltooling::XMLHelper::getNodeQName ( const xercesc::DOMNode *  domNode  )  [static]

Gets the QName for the given DOM node.

Parameters:
domNode the DOM node
Returns:
the QName for the element or null if the element was null

static QName* xmltooling::XMLHelper::getNodeValueAsQName ( const xercesc::DOMNode *  domNode  )  [static]

Constructs a QName from a node's value.

Parameters:
domNode the DOM node with a QName value
Returns:
a QName from a node's value, or null if the given node has no value

static xercesc::DOMElement* xmltooling::XMLHelper::getPreviousSiblingElement ( const xercesc::DOMNode *  n,
const XMLCh *  ns,
const XMLCh *  localName 
) [static]

Returns the previous matching sibling element of the node if any.

Parameters:
n node to check
ns namespace to compare with
localName local name to compare with
Returns:
the previous matching sibling node of type Element, or NULL

static xercesc::DOMElement* xmltooling::XMLHelper::getPreviousSiblingElement ( const xercesc::DOMNode *  n,
const XMLCh *  localName = NULL 
) [static]

Returns the previous matching sibling element of the node if any.

Parameters:
n node to check
localName local name to compare with or NULL for any match
Returns:
the previous matching sibling node of type Element, or NULL

static const XMLCh* xmltooling::XMLHelper::getTextContent ( const xercesc::DOMElement *  e  )  [static]

Returns the content of the first Text node found in the element, if any.

This is roughly similar to the DOM getTextContent function, but only examples the immediate children of the element.

Parameters:
e element to examine
Returns:
the content of the first Text node found, or NULL

static XMLObject* xmltooling::XMLHelper::getXMLObjectById ( XMLObject tree,
const XMLCh *  id 
) [static]

Attempts to locate an XMLObject from this point downward in the tree whose XML ID matches the supplied value.

Parameters:
tree root of tree to search
id ID value to locate
Returns:
XMLObject in the tree with a matching ID value, or NULL

static const XMLObject* xmltooling::XMLHelper::getXMLObjectById ( const XMLObject tree,
const XMLCh *  id 
) [static]

Attempts to locate an XMLObject from this point downward in the tree whose XML ID matches the supplied value.

Parameters:
tree root of tree to search
id ID value to locate
Returns:
XMLObject in the tree with a matching ID value, or NULL

static QName* xmltooling::XMLHelper::getXSIType ( const xercesc::DOMElement *  e  )  [static]

Gets the XSI type for a given element if it has one.

Parameters:
e the element
Returns:
the type or null

static bool xmltooling::XMLHelper::hasXSIType ( const xercesc::DOMElement *  e  )  [static]

Checks if the given element has an xsi:type defined for it.

Parameters:
e the DOM element
Returns:
true if there is a type, false if not

static bool xmltooling::XMLHelper::isNodeNamed ( const xercesc::DOMNode *  n,
const XMLCh *  ns,
const XMLCh *  local 
) [inline, static]

Checks the qualified name of a node.

Parameters:
n node to check
ns namespace to compare with
local local name to compare with
Returns:
true iff the node's qualified name matches the other parameters

static std::ostream& xmltooling::XMLHelper::serialize ( const xercesc::DOMNode *  n,
std::ostream &  out,
bool  pretty = false 
) [static]

Serializes the DOM node provided to a stream using UTF-8 encoding and the default XML serializer available.

No manipulation or formatting is applied.

Parameters:
n node to serialize
out stream to serialize element into
pretty enable pretty printing if supported
Returns:
reference to output stream

static void xmltooling::XMLHelper::serialize ( const xercesc::DOMNode *  n,
std::string &  buf,
bool  pretty = false 
) [static]

Serializes the DOM node provided into a buffer using UTF-8 encoding and the default XML serializer available.

No manipulation or formatting is applied.

Parameters:
n node to serialize
buf buffer to serialize element into
pretty enable pretty printing if supported


The documentation for this class was generated from the following file:
Generated on Mon Oct 19 14:18:35 2009 for xmltooling by  doxygen 1.4.7