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 point.

  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 xmllint.c
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;


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]