On Mon, Feb 13, 2006 at 02:39:49PM +0000, Chris Wareham wrote: > If I deliberately break my NewsML file by adding an invalid element, I > get an error message on the console, but the xmlReadFile function still > returns a non-NULL xmlDocPtr. How should I test the validity of the XML > after a call to xmlReadFile?
catch the error callback (validity errors are not fatal per the spec) I pointed less than 2 days ago on the list how to do this. Or access directly the parser context, create it, use xmlCtxtReadDoc and then check ctxt->valid If you don't care about the tree, don't use xmlRead... use a reader set it up to validate and ask the reader for validity at the end of the parse. Daniel -- Daniel Veillard | Red Hat http://redhat.com/ [EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
