P
Philipp Kraus
Hello,
I' using for XML parsing the libxml2 library and I use the native C
interface (not the C++ bindings). I parse a std::string with this code
const char* l_xmlcontent = p_xml.c_str();
xmlDocPtr l_xml = xmlParseMemory( l_xmlcontent,
strlen(l_xmlcontent) );
p_xml is a std::string. In some cases the XML data within the string
can't be valid and I get the correct message:
Entity: line 1: parser error : Start tag expected, '<' not found
The message is shown on the command line on each time, but I would like
to catch the error and would like to throw an exception. A try-catch
statement around the xmlParseMemory does not work. I've found some
notes that I can use a callback function, which is run on an error, but
I don't find any information for the implementation.
I hope my question isn't off-topic and anyonw can help me to create on
a parser error a correct exception
Thanks
Phil
I' using for XML parsing the libxml2 library and I use the native C
interface (not the C++ bindings). I parse a std::string with this code
const char* l_xmlcontent = p_xml.c_str();
xmlDocPtr l_xml = xmlParseMemory( l_xmlcontent,
strlen(l_xmlcontent) );
p_xml is a std::string. In some cases the XML data within the string
can't be valid and I get the correct message:
Entity: line 1: parser error : Start tag expected, '<' not found
The message is shown on the command line on each time, but I would like
to catch the error and would like to throw an exception. A try-catch
statement around the xmlParseMemory does not work. I've found some
notes that I can use a callback function, which is run on an error, but
I don't find any information for the implementation.
I hope my question isn't off-topic and anyonw can help me to create on
a parser error a correct exception
Thanks
Phil