xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peiyo...@ca.ibm.com
Subject Re: forcing validation
Date Wed, 28 Mar 2001 21:26:21 GMT


>Is it possible to force the dom parser to validate against a dtd? I have
>not found anything in the api.

    You may force the DOM parser to validate by:

    DOMParser *parser = new DOMParser;
    parser->setValidationScheme(DOMParser::Val_Always);

    The problem is, if the instance XML document does NOT have either in
internal
DTD or an external DTD, the parsing will fail.

>If not, the best way seems to do a regexp
>in the file and insert the "dtd-link"

    If you know which dtd file are to be used, even it is NOT present in
the instance XML
docuement, probably you may modify the <!DOCTYPE ...> before parsing.

Regards,

Peiyong Zhang
____________________________________________
XML Parsers Development
IBM Toronto Laboratory email: peiyongz@ca.ibm.com
Phone: (416)448-4088; Fax: (416)448-4414; T/L: 778-4088



Henrik Melander <d95-hmr@sm.luth.se> on 03/28/2001 03:51:28 PM

Please respond to general@xml.apache.org

To:   general@xml.apache.org
cc:
Subject:  forcing validation


I have a server that receives a XML-file over http and responds with
another. I do not have control over the client and they may not send
correct xml. (usually not ;)  Therefore we want to validate the xml file
against the dtd.

Is it possible to force the dom parser to validate against a dtd? I have
not found anything in the api. If not, the best way seems to do a regexp
in the file and insert the "dtd-link".

Regards,
Henrik

---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org






---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Mime
View raw message