You are viewing a plain text version of this content. The canonical link for it is here.
Posted to p-dev@xerces.apache.org by Lucas Mbiwe <le...@gmx.net> on 2003/03/12 18:09:09 UTC
DTD Validation
Hi,
there's something about dtd validation, that's threatening to drive me
mad.
I'd really like to check, if the document i want to process is valid.
But the parser doesn't seem to care about validity. It only checks the
well-formedness.
Here's an excerpt from my code:
my $parser = XML::Xerces::XercesDOMParser->new ();
# Parseroptionen setzen
$parser- >setValidationScheme($XML::Xerces::XercesDOMParser::Val_Always);
$parser->setLoadExternalDTD(1);
$parser->setDoNamespaces(1);
$parser->setDoSchema(0);
$parser->setValidationConstraintFatal(1);
$parser->setExitOnFirstFatalError(1);
$parser->setCreateEntityReferenceNodes(1);
$parser->setIncludeIgnorableWhitespace(0);
$parser->setCreateCommentNodes(0);
# ErrorHandler setzen
my $error_handler = XML::Xerces::PerlErrorHandler->new ();
$parser->setErrorHandler ($error_handler);
eval {
$parser->parse ($xmlfile);
};
XML::Xerces::error($@) if ($@);
The xml declaration of the doc contains standalone='no' and of course
there's a line pointing to the dtd. It's really strange.
Lucas
--
"The coroner? Ugh. I'm so sick of that guy."
-Dr. Nick Riveria
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org
Re: DTD Validation
Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
Hi Lucas,
I'm sorry that it has taken me this long to reply.
"Lucas Mbiwe" <le...@gmx.net> writes:
> $parser->setValidationScheme($XML::Xerces::XercesDOMParser::Val_Always);
You should have gotten the folling warning:
Name "XML::Xerces::XercesDOMParser::Val_Always" used only once:
possible typo at /tmp/test.pl line 10.
The variable should be in the 'AbstractDOMParser' class:
$parser->setValidationScheme($XML::Xerces::AbstractDOMParser::Val_Always);
This should work much better.
Cheers,
jas.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org
Re: DTD Validation
Posted by Bjoern Haje <Bj...@gmx.de>.
Ich hab nen deutlich unschönen Workaround:
xmllint --valid --noout <Datei>
aber funktioniert.
Björn
At 18:09 12.03.2003 +0100, you wrote:
>Hi,
>
>there's something about dtd validation, that's threatening to drive me
>mad.
>I'd really like to check, if the document i want to process is valid.
>But the parser doesn't seem to care about validity. It only checks the
>well-formedness.
>
>Here's an excerpt from my code:
>
> my $parser = XML::Xerces::XercesDOMParser->new ();
> # Parseroptionen setzen
>
>$parser- >setValidationScheme($XML::Xerces::XercesDOMParser::Val_Always);
> $parser->setLoadExternalDTD(1);
> $parser->setDoNamespaces(1);
> $parser->setDoSchema(0);
> $parser->setValidationConstraintFatal(1);
> $parser->setExitOnFirstFatalError(1);
> $parser->setCreateEntityReferenceNodes(1);
> $parser->setIncludeIgnorableWhitespace(0);
> $parser->setCreateCommentNodes(0);
> # ErrorHandler setzen
> my $error_handler = XML::Xerces::PerlErrorHandler->new ();
> $parser->setErrorHandler ($error_handler);
>
> eval {
> $parser->parse ($xmlfile);
> };
> XML::Xerces::error($@) if ($@);
>
>The xml declaration of the doc contains standalone='no' and of course
>there's a line pointing to the dtd. It's really strange.
>
>Lucas
>--
>"The coroner? Ugh. I'm so sick of that guy."
>
>-Dr. Nick Riveria
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-p-dev-help@xml.apache.org
--
Bjoern Haje
mailto:bjoern.haje@gmx.de
ICQ: 158775500
PGP-KeyID: 0xB3A620BB
Fingerprint: CB9B 6447 E8EC 0BA7 A1A9 0EE3 B865 931F B3A6 20BB
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org