You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Heiko Faasch <he...@gmx.de> on 2003/08/21 20:04:38 UTC
SAX-Parser does not validate (DTD)
Hi,
I just migrated from Xerces 1.1 to 2.3.0 and now have the problem, that the
parser does not recognize the DTD for validating my documents - it just says
that all elements are not valid and all the attributes are not declared. If I
change the validation scheme to val_auto, nothing happens, even if my
documents don't match the DTD. Can anyone help me?
Thanks,
Heiko
<code>
SAXParser* parser = new SAXParser;
parser->setValidationScheme(SAXParser::Val_Alway);
parser->setDoNamespaces(false);
MemBufInputSource* ruledtd = new MemBufInputSource
(
(const XMLByte*)_r2r_ruledtd, strlen(_r2r_ruledtd), "dummy", false
);
parser->loadGrammar(*ruledtd, Grammar::DTDGrammarType, true);
parser->setDocumentHandler(hnd_p);
parser->setErrorHandler(hnd_p);
StreamInputSource streamReader(&in);
parser->parse(streamReader);
</code>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: SAX-Parser does not validate (DTD)
Posted by Gareth Reakes <ga...@decisionsoft.com>.
Hi,
do you have a
<!DOCTYPE chapter SYSTEM "books.dtd">
in your xml file?
Gareth
On Thu, 21 Aug 2003, Heiko Faasch wrote:
> Hi,
>
> I just migrated from Xerces 1.1 to 2.3.0 and now have the problem, that the
> parser does not recognize the DTD for validating my documents - it just says
> that all elements are not valid and all the attributes are not declared. If I
> change the validation scheme to val_auto, nothing happens, even if my
> documents don't match the DTD. Can anyone help me?
>
> Thanks,
>
> Heiko
>
> <code>
>
> SAXParser* parser = new SAXParser;
>
> parser->setValidationScheme(SAXParser::Val_Alway);
> parser->setDoNamespaces(false);
>
> MemBufInputSource* ruledtd = new MemBufInputSource
> (
> (const XMLByte*)_r2r_ruledtd, strlen(_r2r_ruledtd), "dummy", false
> );
>
> parser->loadGrammar(*ruledtd, Grammar::DTDGrammarType, true);
>
> parser->setDocumentHandler(hnd_p);
> parser->setErrorHandler(hnd_p);
>
> StreamInputSource streamReader(&in);
>
> parser->parse(streamReader);
>
> </code>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
>
--
Gareth Reakes, Head of Product Development +44-1865-203192
DecisionSoft Limited http://www.decisionsoft.com
XML Development and Services
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org