semaine::util::XMLTool Class Reference

#include <XMLTool.h>

List of all members.

Static Public Member Functions

static void startupXMLTools () throw (semaine::cms::exceptions::SystemConfigurationException)
static void shutdownXMLTools ()
static
XERCES_CPP_NAMESPACE::DOMImplementation * 
getDOMImplementation ()
static const std::string transcode (const XMLCh *xmlString)
static
XERCES_CPP_NAMESPACE::DOMDocument * 
parse (const std::string &xmlAsText) throw (semaine::cms::exceptions::MessageFormatException)
static
XERCES_CPP_NAMESPACE::DOMDocument * 
parseFile (const std::string &filename) throw (semaine::cms::exceptions::MessageFormatException)
static
XERCES_CPP_NAMESPACE::DOMDocument * 
newDocument (const std::string &rootTagname, const std::string &aNamespace)
static
XERCES_CPP_NAMESPACE::DOMDocument * 
newDocument (const std::string &rootTagname, const std::string &aNamespace, const std::string &version)
static
XERCES_CPP_NAMESPACE::DOMElement * 
createElement (XERCES_CPP_NAMESPACE::DOMDocument *doc, const std::string &elementName)
static
XERCES_CPP_NAMESPACE::DOMElement * 
createElement (XERCES_CPP_NAMESPACE::DOMDocument *doc, const std::string &elementName, const std::string &aNamespace)
static
XERCES_CPP_NAMESPACE::DOMText * 
createTextNode (XERCES_CPP_NAMESPACE::DOMDocument *doc, const std::string &textContent)
static
XERCES_CPP_NAMESPACE::DOMElement * 
appendChildElement (XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &childName)
static
XERCES_CPP_NAMESPACE::DOMElement * 
appendChildElement (XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &childName, const std::string &childNamespace)
static
XERCES_CPP_NAMESPACE::DOMText * 
appendChildTextNode (XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &textContent)
static bool hasAttribute (XERCES_CPP_NAMESPACE::DOMElement *e, const std::string &attributeName)
static const std::string getAttribute (XERCES_CPP_NAMESPACE::DOMElement *e, const std::string &attributeName)
static const std::string needAttribute (XERCES_CPP_NAMESPACE::DOMElement *e, const std::string &attributeName) throw (semaine::cms::exceptions::MessageFormatException)
static void setAttribute (XERCES_CPP_NAMESPACE::DOMElement *e, const std::string &attribute, const std::string &value)
static const std::string getNamespaceURI (XERCES_CPP_NAMESPACE::DOMNode *node)
static const std::string getNodeName (XERCES_CPP_NAMESPACE::DOMNode *node)
static const std::string getTagName (XERCES_CPP_NAMESPACE::DOMElement *e)
static const std::string getLocalName (XERCES_CPP_NAMESPACE::DOMElement *e)
static const std::string getPrefix (XERCES_CPP_NAMESPACE::DOMElement *e)
static void setPrefix (XERCES_CPP_NAMESPACE::DOMElement *e, const std::string &prefix)
static const std::string getTextContent (XERCES_CPP_NAMESPACE::DOMNode *node)
static void setTextContent (XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &text)
static
XERCES_CPP_NAMESPACE::DOMElement * 
getChildElementByTagNameNS (XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &childName, const std::string &childNamespace)
static
XERCES_CPP_NAMESPACE::DOMElement * 
getChildElementByLocalNameNS (XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &childName, const std::string &childNamespace)
static
XERCES_CPP_NAMESPACE::DOMElement * 
needChildElementByTagNameNS (XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &childName, const std::string &childNamespace) throw (semaine::cms::exceptions::MessageFormatException)
static
XERCES_CPP_NAMESPACE::DOMElement * 
needChildElementByLocalNameNS (XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &childName, const std::string &childNamespace) throw (semaine::cms::exceptions::MessageFormatException)
static std::list
< XERCES_CPP_NAMESPACE::DOMElement * > * 
getChildrenByTagNameNS (XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &childName, const std::string &childNamespace) throw (semaine::cms::exceptions::MessageFormatException)
static std::list
< XERCES_CPP_NAMESPACE::DOMElement * > * 
getChildrenByLocalNameNS (XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &childName, const std::string &childNamespace) throw (semaine::cms::exceptions::MessageFormatException)
static const std::string dom2string (const XERCES_CPP_NAMESPACE::DOMDocument *doc)

Member Function Documentation

static XERCES_CPP_NAMESPACE::DOMElement* semaine::util::XMLTool::appendChildElement ( XERCES_CPP_NAMESPACE::DOMNode *  node,
const std::string &  childName,
const std::string &  childNamespace 
) [static]

Create a child element with the given name and namespace, and append it below node.

Parameters:
node 
childName 
childNamespace the namespace of the child, or NULL if no namespace is desired.
Returns:
the child element
static XERCES_CPP_NAMESPACE::DOMElement* semaine::util::XMLTool::appendChildElement ( XERCES_CPP_NAMESPACE::DOMNode *  node,
const std::string &  childName 
) [static]

Create a child element with the given name and append it below node. The new element will have the same namespace as node.

Parameters:
node 
childName 
Returns:
the child element
static XERCES_CPP_NAMESPACE::DOMText* semaine::util::XMLTool::appendChildTextNode ( XERCES_CPP_NAMESPACE::DOMNode *  node,
const std::string &  textContent 
) [static]

Create a text node with the given content, and append it below node.

Parameters:
node 
textContent 
Returns:
the text node
static XERCES_CPP_NAMESPACE::DOMElement* semaine::util::XMLTool::createElement ( XERCES_CPP_NAMESPACE::DOMDocument *  doc,
const std::string &  elementName,
const std::string &  aNamespace 
) [static]

In the given document, create a new element with the given name and the given namespace.

Parameters:
doc 
elementName 
namespace the namespace URI, e.g. http://www.w3.org/2003/04/emma, or null if no namespace is to be associated with the new element.
Returns:
an element which is not yet included in the tree hierarchy of the document.
Exceptions:
NullPointerException if doc or elementName is null.
static XERCES_CPP_NAMESPACE::DOMElement* semaine::util::XMLTool::createElement ( XERCES_CPP_NAMESPACE::DOMDocument *  doc,
const std::string &  elementName 
) [static]

In the given document, create a new element of the given name, with the same namespace as the document element.

Parameters:
doc a document
elementName the name of the new element
Returns:
an element which is not yet included in the tree hierarchy of the document.
static XERCES_CPP_NAMESPACE::DOMText* semaine::util::XMLTool::createTextNode ( XERCES_CPP_NAMESPACE::DOMDocument *  doc,
const std::string &  textContent 
) [static]

In the given document, create a new text node, containing the given text content.

Parameters:
doc a document
textContent the text content
Returns:
a text node which is not yet included in the tree hierarchy of the document.
static const std::string semaine::util::XMLTool::dom2string ( const XERCES_CPP_NAMESPACE::DOMDocument *  doc  )  [static]

Serialise the given DOM document to a std::string.

static const std::string semaine::util::XMLTool::getAttribute ( XERCES_CPP_NAMESPACE::DOMElement *  e,
const std::string &  attributeName 
) [static]

For the given element, return the value of the given attribute if it exists, or an empty string if it doesn't exist.

Parameters:
e the element whose attribute to return
attributeName the name of the attribute to look up.
Returns:
the String value of the attribute if it exists, or an empty string
static XERCES_CPP_NAMESPACE::DOMElement* semaine::util::XMLTool::getChildElementByLocalNameNS ( XERCES_CPP_NAMESPACE::DOMNode *  node,
const std::string &  childName,
const std::string &  childNamespace 
) [static]

Get the direct child of node that is an element with the given local name and namespace.

Parameters:
node 
childName 
childNamespace 
Returns:
the child element, or NULL if there is no such child.
static XERCES_CPP_NAMESPACE::DOMElement* semaine::util::XMLTool::getChildElementByTagNameNS ( XERCES_CPP_NAMESPACE::DOMNode *  node,
const std::string &  childName,
const std::string &  childNamespace 
) [static]

Get the direct child of node that is an element with the given tag name and namespace.

Parameters:
node 
childName 
childNamespace 
Returns:
the child element, or NULL if there is no such child.
static std::list<XERCES_CPP_NAMESPACE::DOMElement *>* semaine::util::XMLTool::getChildrenByLocalNameNS ( XERCES_CPP_NAMESPACE::DOMNode *  node,
const std::string &  childName,
const std::string &  childNamespace 
) throw (semaine::cms::exceptions::MessageFormatException) [static]

Get a list of all direct children with the given local name and namespace. Whereas getChildElementByLocalNameNS() returns the single first child, this method returns all the children that match. The calling code must delete the list when it is no longer needed.

Parameters:
node 
childName 
childNamespace 
Returns:
a list containing the children that match, or an empty list if none match.
Exceptions:
MessageFormatException 
static std::list<XERCES_CPP_NAMESPACE::DOMElement *>* semaine::util::XMLTool::getChildrenByTagNameNS ( XERCES_CPP_NAMESPACE::DOMNode *  node,
const std::string &  childName,
const std::string &  childNamespace 
) throw (semaine::cms::exceptions::MessageFormatException) [static]

Get a list of all direct children with the given tag name and namespace. Whereas getChildElementByTagNameNS() returns the single first child, this method returns all the children that match. The calling code must delete the list when it is no longer needed.

Parameters:
node 
childName 
childNamespace 
Returns:
a list containing the children that match, or an empty list if none match.
Exceptions:
MessageFormatException 
DOMImplementation * semaine::util::XMLTool::getDOMImplementation (  )  [static]

Get a DOM implementation.

static const std::string semaine::util::XMLTool::getLocalName ( XERCES_CPP_NAMESPACE::DOMElement *  e  )  [static]

Get the local name of the given element.

static const std::string semaine::util::XMLTool::getNamespaceURI ( XERCES_CPP_NAMESPACE::DOMNode *  node  )  [static]

Get the namespace of the given node, or the empty string if the node has no namespace.

static const std::string semaine::util::XMLTool::getNodeName ( XERCES_CPP_NAMESPACE::DOMNode *  node  )  [static]

Get the node name of the given node.

static const std::string semaine::util::XMLTool::getPrefix ( XERCES_CPP_NAMESPACE::DOMElement *  e  )  [static]

Get the namespace prefix of the given element.

static const std::string semaine::util::XMLTool::getTagName ( XERCES_CPP_NAMESPACE::DOMElement *  e  )  [static]

Get the tag name of the given element.

static const std::string semaine::util::XMLTool::getTextContent ( XERCES_CPP_NAMESPACE::DOMNode *  node  )  [static]

Get the text content below this node.

static bool semaine::util::XMLTool::hasAttribute ( XERCES_CPP_NAMESPACE::DOMElement *  e,
const std::string &  attributeName 
) [static]

Determine whether the given element has the named attribute.

static const std::string semaine::util::XMLTool::needAttribute ( XERCES_CPP_NAMESPACE::DOMElement *  e,
const std::string &  attributeName 
) throw (semaine::cms::exceptions::MessageFormatException) [static]

For the given element, return the value of the given attribute if it exists, or complain with a MessageFormatException if it doesn't exist.

Parameters:
e the element whose attribute to return
attributeName the name of the attribute to look up.
Returns:
the String value of the attribute if it exists
Exceptions:
MessageFormatException if the attribute doesn't exist.
static XERCES_CPP_NAMESPACE::DOMElement* semaine::util::XMLTool::needChildElementByLocalNameNS ( XERCES_CPP_NAMESPACE::DOMNode *  node,
const std::string &  childName,
const std::string &  childNamespace 
) throw (semaine::cms::exceptions::MessageFormatException) [static]

Same as getChildElementByLocalNameNS(Node, String, String), but throw a MessageFormatException if there is no such child element.

Parameters:
node 
childName 
childNamespace 
Returns:
a non-NULL child element
Exceptions:
MessageFormatException if there is no such child, i.e. when getChildElementByTagNameNS() would return NULL.
static XERCES_CPP_NAMESPACE::DOMElement* semaine::util::XMLTool::needChildElementByTagNameNS ( XERCES_CPP_NAMESPACE::DOMNode *  node,
const std::string &  childName,
const std::string &  childNamespace 
) throw (semaine::cms::exceptions::MessageFormatException) [static]

Same as getChildElementByTagNameNS(Node, String, String), but throw a MessageFormatException if there is no such child element.

Parameters:
node 
childName 
childNamespace 
Returns:
a non-NULL child element
Exceptions:
MessageFormatException if there is no such child, i.e. when getChildElementByTagNameNS() would return NULL.
DOMDocument * semaine::util::XMLTool::newDocument ( const std::string &  rootTagname,
const std::string &  aNamespace,
const std::string &  version 
) [static]

Create a new document with the given name and namespace for the root element, and set the 'version' attribute of the root element to the given value.

Parameters:
rootTagname 
namespace the namespace URI, e.g. http://www.w3.org/2003/04/emma, or null if no namespace is to be associated with the new element.
version a value to add to the 'version' attribute of the root element
Returns:
DOMDocument * semaine::util::XMLTool::newDocument ( const std::string &  rootTagname,
const std::string &  aNamespace 
) [static]

Create a new document with the given name and namespace for the root element.

Parameters:
rootTagname 
namespace the namespace URI, e.g. http://www.w3.org/2003/04/emma, or null if no namespace is to be associated with the new element.
Returns:
DOMDocument * semaine::util::XMLTool::parse ( const std::string &  xmlAsText  )  throw (semaine::cms::exceptions::MessageFormatException) [static]
DOMDocument * semaine::util::XMLTool::parseFile ( const std::string &  filename  )  throw (semaine::cms::exceptions::MessageFormatException) [static]
static void semaine::util::XMLTool::setAttribute ( XERCES_CPP_NAMESPACE::DOMElement *  e,
const std::string &  attribute,
const std::string &  value 
) [static]

For the given element, set the attribute to the value.

static void semaine::util::XMLTool::setPrefix ( XERCES_CPP_NAMESPACE::DOMElement *  e,
const std::string &  prefix 
) [static]

Set the namespace prefix of the given element.

static void semaine::util::XMLTool::setTextContent ( XERCES_CPP_NAMESPACE::DOMNode *  node,
const std::string &  text 
) [static]

Get the text content below this node.

void semaine::util::XMLTool::shutdownXMLTools (  )  [static]

This should be called to clean up after the code is done.

void semaine::util::XMLTool::startupXMLTools (  )  throw (semaine::cms::exceptions::SystemConfigurationException) [static]

This needs to be called once before any of the methods here can be used.

const std::string semaine::util::XMLTool::transcode ( const XMLCh *  xmlString  )  [static]

Convert a string in XML representation into a standard string. If xmlString is NULL, an empty string is returned.


The documentation for this class was generated from the following files:
Generated on Tue Dec 14 17:13:19 2010 for SEMAINE by  doxygen 1.6.3