12 #include <xercesc/dom/DOM.hpp>
15 #include <carma/util/xercesUtils.h>
22 inline bool isEmpty(
const std::string &s)
24 if (s.find_first_not_of(
" \t\n\r") != std::string::npos)
30 inline std::string getAttributeAsString(
const xercesc::DOMElement *elem,
const std::string &attr)
35 return valueStr.getString();
38 inline unsigned int getAttributeAsInt(
const xercesc::DOMElement *elem,
const std::string &attr)
42 std::istringstream iss;
45 iss.str(valueStr.getString());
47 std::ostringstream oss;
49 oss <<
"could not parse \"" << valueStr.getString() <<
"\" as an int";
56 inline bool getAttributeAsBool(
const xercesc::DOMElement *elem,
const std::string &attr)
60 std::string s = valueStr.getString();
63 std::transform(s.begin(), s.end(), s.begin(), ::tolower);
72 std::ostringstream oss;
73 oss <<
"could not parse \"" << valueStr.getString() <<
"\" as a bool";
77 inline bool isNodeType(
const xercesc::DOMNode *node,
const std::string &tag)
82 if (node->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
85 const xercesc::DOMElement *elem =
dynamic_cast<const xercesc::DOMElement *
>(node);
90 if (elemTag.getString() != tag)
Exception class for errors.
auto cleanup class for xercesc::XMLString instances
#define CARMA_ERROR(y)
Trick to get the file name and line number passed to the exception handler.