Re: [xml] Proceed on error.



On Fri, Jan 14, 2005 at 11:19:50AM +0100, Morten W. J. wrote:
Hello all.

I use libxml (2.6.7) to check if a string of XML is well formed by running it 
through xmlParseMemory.

Sometimes, eg. when encountering "<nacho" or "<d></d><e>", libxml prints an 
error similar to 
"Entity: line 1: error: Couldn't find end of Start Tag nacho"
or
"Entity: line 1: error: Extra content at the end of the document" and halts 
execution.

I just want to catch if the returned doc is NULL or not, free it and return a 
proper value from my function. 

Any idea on how I get xmlParseMemory to proceed instead of halting or any 
alternative ideas?

  those are Well formedness errors. The processor will stop delivering data
from that point, it's mandatory behaviour.
  - so it can't "proceed", it has to "halt"
  - if you mean you don't want to see the errors, 
    http://xmlsoft.org/html/libxml-xmlerror.html
    set up your own error handler.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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