Re: [xml] Catch parsing error



On Tue, Jul 28, 2009 at 10:57:23AM +0300, Tiberius Duluman wrote:
[...]
the error from context->lastError is
"Premature end of data in tag presence line 1"
but the one displayed on the screen is:

Entity: line 6: parser error : Opening and ending tag mismatch: tuple line 2 and presence
</presence>
           ^
Entity: line 8: parser error : Premature end of data in tag presence line 1

Why doesn't the parser stop after first error is found?

  Because people find more generally useful to get all errors than just
  one at a time.

How can I obtain the first error generated by the parser because it is more suggestive to
report to a user?

  Set your own error handler, either generic or structured
see http://xmlsoft.org/html/libxml-xmlerror.html for all entry points

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]