NSCL DDAS  1.0
Support for XIA DDAS at the NSCL
 All Classes Namespaces Files Functions Variables Macros Pages
Functions
tinyxmlutil.cpp File Reference

: Implement useful tinyxml2 utility methods. More...

#include <tinyxmlutil.h>
#include <sstream>
#include <stdexcept>

Functions

void getAttribute (uint32_t &result, tinyxml2::XMLElement &container, const char *att)
 
void getAttribute (double &result, tinyxml2::XMLElement &container, const char *att)
 
void getAttribute (bool &result, tinyxml2::XMLElement &container, const char *att)
 
tinyxml2::XMLElementhaveChild (tinyxml2::XMLElement &parent, const char *element)
 
void checkXmlError (tinyxml2::XMLError err, tinyxml2::XMLDocument &doc)
 

Detailed Description

: Implement useful tinyxml2 utility methods.

Function Documentation

void checkXmlError ( tinyxml2::XMLError  err,
tinyxml2::XMLDocument doc 
)

checkXmlError IF the XML status passed in is not normal, throw an std::invalid_argument with as detailed a message as possible.

Parameters
err- XMLError which, hopefully is success.
doc- Reference to the document.
void getAttribute ( uint32_t &  result,
tinyxml2::XMLElement container,
const char *  att 
)

Various overloads for getAttribute that call the appropriate QueryxxxAttribute.

Parameters
result– where to put the reulst, this type varies.
container- the container to query.
att- attribute name (e.g. "value").
tinyxml2::XMLElement* haveChild ( tinyxml2::XMLElement parent,
const char *  element 
)

haveChild Checks for and returns a required child element

Parameters
parent- the parent that's required to have the child.
element- the name of the element.
Returns
tinyxml2::XMLElement* - pointer to the element.
Exceptions
std::invalid_argumentif the elmeent does not exist.