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 Sergei Pavlovskiy <se...@yahoo.com> on 2002/01/29 13:41:56 UTC

Can't turn validation of SAX2 off completly.

I try to parse XML-file with a referance to external DTD file with SAX2
parser.

<!DOCTYPE clu SYSTEM "CLUInputConversion.DTD">

But DTD file (CLUInputConversion.DTD) is absent. I don't need validation,
just want to check that my XML-file is well formed, so I turn validation off

SAX2XMLReader* pParser = XMLReaderFactory::createXMLReader();

// turn off validation
pParser->setFeature(
   XMLString::transcode("http://xml.org/sax/features/validation"),
   false);
pParser->setFeature(

XMLString::transcode("http://apache.org/xml/features/validation/dynamic"),
   false);

But I get fatal error at that line (referance to external DTD file) and
parsing terminates.

Setting  "ExitOnFirstFatalError" to true and/or "ValidationConstraintFatal"
to false has no effect.

But Microsoft parser do parse this file.

Is there any way to avoid that an make parser to ignore external DTD
referance?


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Can't turn validation of SAX2 off completly.

Posted by Tinny Ng <tn...@ca.ibm.com>.
Install an EntityResolver handler.   See FAQ
http://xml.apache.org/xerces-c/faq-parse.html#faq-35.

Thanks!

Tinny

Sergei Pavlovskiy wrote:

> I try to parse XML-file with a referance to external DTD file with SAX2
> parser.
>
> <!DOCTYPE clu SYSTEM "CLUInputConversion.DTD">
>
> But DTD file (CLUInputConversion.DTD) is absent. I don't need validation,
> just want to check that my XML-file is well formed, so I turn validation off
>
> SAX2XMLReader* pParser = XMLReaderFactory::createXMLReader();
>
> // turn off validation
> pParser->setFeature(
>    XMLString::transcode("http://xml.org/sax/features/validation"),
>    false);
> pParser->setFeature(
>
> XMLString::transcode("http://apache.org/xml/features/validation/dynamic"),
>    false);
>
> But I get fatal error at that line (referance to external DTD file) and
> parsing terminates.
>
> Setting  "ExitOnFirstFatalError" to true and/or "ValidationConstraintFatal"
> to false has no effect.
>
> But Microsoft parser do parse this file.
>
> Is there any way to avoid that an make parser to ignore external DTD
> referance?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


RE: Can't turn validation of SAX2 off completly.

Posted by Erik Rydgren <er...@mandarinen.se>.
Implement a simple entity resolver and plug it into the parser. Just return
an empty stream and the parser will he happy. See the examples for free code
to rip off.

Regards

Erik Rydgren
Mandarinen systems AB
Sweden

-----Original Message-----
From: Sergei Pavlovskiy [mailto:sergei_v_p@yahoo.com]
Sent: den 29 januari 2002 13:42
To: xerces-c-dev@xml.apache.org
Subject: Can't turn validation of SAX2 off completly.


I try to parse XML-file with a referance to external DTD file with SAX2
parser.

<!DOCTYPE clu SYSTEM "CLUInputConversion.DTD">

But DTD file (CLUInputConversion.DTD) is absent. I don't need validation,
just want to check that my XML-file is well formed, so I turn validation off

SAX2XMLReader* pParser = XMLReaderFactory::createXMLReader();

// turn off validation
pParser->setFeature(
   XMLString::transcode("http://xml.org/sax/features/validation"),
   false);
pParser->setFeature(

XMLString::transcode("http://apache.org/xml/features/validation/dynamic"),
   false);

But I get fatal error at that line (referance to external DTD file) and
parsing terminates.

Setting  "ExitOnFirstFatalError" to true and/or "ValidationConstraintFatal"
to false has no effect.

But Microsoft parser do parse this file.

Is there any way to avoid that an make parser to ignore external DTD
referance?


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org