diff options
author | Adrian Kummerländer | 2014-06-08 16:49:41 +0200 |
---|---|---|
committer | Adrian Kummerländer | 2014-06-08 16:49:41 +0200 |
commit | f13e1fa9a41006d80e6923489414cfdc2fcadd08 (patch) | |
tree | cc17dacae4402ad655fda62f686585737623ee7f /src/function/read_xml_file.cc | |
parent | 49e2010b489ab6d5516a9abd896c67738e0dc1cc (diff) | |
download | InputXSLT-f13e1fa9a41006d80e6923489414cfdc2fcadd08.tar InputXSLT-f13e1fa9a41006d80e6923489414cfdc2fcadd08.tar.gz InputXSLT-f13e1fa9a41006d80e6923489414cfdc2fcadd08.tar.bz2 InputXSLT-f13e1fa9a41006d80e6923489414cfdc2fcadd08.tar.lz InputXSLT-f13e1fa9a41006d80e6923489414cfdc2fcadd08.tar.xz InputXSLT-f13e1fa9a41006d80e6923489414cfdc2fcadd08.tar.zst InputXSLT-f13e1fa9a41006d80e6923489414cfdc2fcadd08.zip |
Handling xercesc::DOMException in "read-xml-file" and "external-text-formatter"
* external DOM may cause xercesc::DOMException's to be thrown instead of passing all errors to the custom error handlers
** these exceptions are handled by this commit by setting the "result" attribute to "error" and adding "error" value nodes with further information
Diffstat (limited to 'src/function/read_xml_file.cc')
-rw-r--r-- | src/function/read_xml_file.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/function/read_xml_file.cc b/src/function/read_xml_file.cc index 65989b2..e4d256d 100644 --- a/src/function/read_xml_file.cc +++ b/src/function/read_xml_file.cc @@ -61,11 +61,21 @@ xercesc::DOMDocument* FunctionReadXmlFile::constructDocument( result.setAttribute("path", filePath.string()); if ( boost::filesystem::is_regular_file(filePath) ) { - result.setAttribute("result", "success"); + try { + result.setContent( + importDocumentElement(filePath.string(), domDocument) + ); - result.setContent( - importDocumentElement(filePath.string(), domDocument) - ); + result.setAttribute("result", "success"); + } + catch ( const xercesc::DOMException& exception ) { + result.setAttribute("result", "error"); + + result.setValueNode( + "error", + *XercesStringGuard<char>(exception.msg) + ); + } } else { result.setAttribute("result", "error"); } |