Fwd: Re: [xml] xml help

Is there any way of checking that the dtd that is referenced in the xml file
exists and if so, can we check that the dtd is valid.


Michael Picheca, pichecma mcmaster ca on 12/13/2001

--- Original Message ---
From: "Daniel Veillard" <veillard redhat com>
To: Michael Picheca <pichecma mcmaster ca>
Cc: <xml gnome org>
Sent: Mon, 10 Dec 2001 11:35:12 -0500
Subject: Re: [xml] xml help

On Mon, Dec 10, 2001 at 11:26:34AM -0800, Michael Picheca wrote:
I tried using the xmlDoValidityCheckingDefaultValue =1 that you
suggested and
need to be able to halt the program after the validation with the
dtd listed
within the xml file fails. How do I do that? Is there a return
value or
something that I can use to invoke a halt? WHen I was using
xmlValidateDtd it
would return 0 if it failed and I would halt the program at this

The problem is taht interfaces like xmlParseFile don't allow you
to do this !
You need to use more advanced interfaces like the ones used in
where you create your own parser context:
Look at xmllint.c code, somethings like the following should work:

 xmlParserCtxtPtr ctxt;

 xmlDoValidityCheckingDefaultValue =1;
 ctxt = xmlCreateFileParserCtxt(filename);

 ret = ctxt->wellFormed;
 valid = ctxt->valid;
 doc = ctxt->myDoc;
 if (!ret) {
   doc = NULL;


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