X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-xmltooling.git;a=blobdiff_plain;f=xmltooling%2Futil%2FXMLHelper.cpp;h=26823958c5d9d4dce3fb3583828f4ba52f3162fd;hp=88dccbe68273ef7a464399da610997de67ca2dda;hb=2d795c731e6729309044607154978696a87fd900;hpb=1487fce9686a1f52165ecd0676315f50a52c6bff diff --git a/xmltooling/util/XMLHelper.cpp b/xmltooling/util/XMLHelper.cpp index 88dccbe..2682395 100644 --- a/xmltooling/util/XMLHelper.cpp +++ b/xmltooling/util/XMLHelper.cpp @@ -338,9 +338,11 @@ int XMLHelper::getAttrInt(const DOMElement* e, int defValue, const XMLCh* localN if (e) { const XMLCh* val = e->getAttributeNS(ns, localName); if (val && *val) { - int i = XMLString::parseInt(val); - if (i) - return i; + try { + return XMLString::parseInt(val); + } + catch (XMLException&) { + } } } return defValue; @@ -452,5 +454,11 @@ ostream& xmltooling::operator<<(ostream& ostr, const DOMNode& node) ostream& xmltooling::operator<<(ostream& ostr, const XMLObject& obj) { - return ostr << *(obj.marshall()); + try { + return ostr << *(obj.marshall()); + } + catch (DOMException& ex) { + auto_ptr_char msg(ex.getMessage()); + throw XMLParserException(msg.get()); + } }