Re: [xml] valid document confirmation

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Wed Oct 11 2000 - 07:54:37 EDT


On Tue, Oct 10, 2000 at 04:19:38AM -0700, Adam Clarke wrote:
>
> Assuming one is parsing and validating a document, eg
>
> ...
> extern int xmlDoValidityCheckingDefaultValue = 1;
> ...
> res = fread(chars, 1, 4, stdin);
> if (res > 0) {
> ctxt = xmlCreatePushParserCtxt(NULL, NULL, chars, res, "stdin");
> while ((res = fread(chars, 1, size, stdin)) > 0) {
> xmlParseChunk(ctxt, chars, res, 0);
> }
> xmlParseChunk(ctxt, chars, 0, 1);
> doc = ctxt->myDoc;
> xmlFreeParserCtxt(ctxt);
> }
> ...
>
> how do I test at this point if my document is valid?
> I would like to exit our of my process if any validation
> errors or warnings have occurred....

  
  if (ctxt->valid)

  should be sufficient to catch validity errors.
I'm unsure it will be okay if there is only validity warnings ...

Daniel

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | Today's Bookmarks :
Tel : +33 476 615 257  | 655, avenue de l'Europe | Linux XML libxml WWW
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Gnome rpm2html rpmfind
 http://www.w3.org/People/all#veillard%40w3.org  | RPM badminton Kaffe
----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Oct 11 2000 - 09:43:42 EDT