Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #7777
| From | Philipp Kraus <philipp.kraus@flashpixx.de> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | libxml2 with C++ exception |
| Date | 2011-07-13 13:34 +0200 |
| Organization | 1&1 Internet AG |
| Message-ID | <ivjvro$i4t$1@online.de> (permalink) |
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
Back to comp.lang.c++ | Previous | Next — Next in thread | Find similar | Unroll thread
libxml2 with C++ exception Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-07-13 13:34 +0200
Re: libxml2 with C++ exception Michael DOUBEZ <michael.doubez@free.fr> - 2011-07-13 05:25 -0700
Re: libxml2 with C++ exception Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-07-13 15:14 +0200
csiph-web