Re: [xml] Validity Checking headache :-(

On Tue, May 15, 2001 at 06:45:26PM +0200, Fabrizio Ammollo wrote:

I'm writing this message because of a doubt about the way an application 
should enable and use validity checking.

I have successfully used post-parse checking of the DTD by using 
xmlValidateDocument, but, how may I use parse-time checking ?
I thought that I had only to set xmlDoValidityCheckingDefaultValue to 1, but 
when I call xmlParseMemory xmlParseMemory returns a doc != NULL.

 if it's well formed you get a document back

The validity problems are recognized by the parser, but, how may I know about 
these ? I think the parser context does not exist anymore after the parsing, 
so they are certainly not accessible anymore from that one.
Do I have to implement a modified version of xmlParseMemory which keeps track 
of the validity returned (if so) into the parser context ? 

  Create a parser context for your input, run the parser and look
at ctxt->valid at the end of the parsing stage.
  Look at the xmllint.c code from line 487 
    ctxt = xmlCreateFileParserCtxt(filename);

Another doubt I have is the following: from the source of xsltproc, I have 
noticed that xmlLoadExtDtdDefaultValue is set depending upon the --novalid 
flag, but xmlDoValidityCheckingDefaultValue is never changed.
Does it mean that xmlDoValidityCheckingDefaultValue is automatically enabled 
when xmlLoadExtDtdDefaultValue is enabled too,


or are they totally 
independent ? And if so, why is the DTD loaded at all if not for checking the 
validity of the document ?

   Because you need the DTd for ID and default attributes supports but
you don't want the validation to occur.


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

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