xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tobias Wolff" <wo...@falkag.de>
Subject Perl API
Date Thu, 14 Feb 2002 10:28:22 GMT
Hi,

unfortunately, there is no mailing list for users of the Xerces Perl 
API, so I had to post my question to this mailing list. If there is a 
better list, please tell me so.

Given the very simple XML file:

<?xml version="1.0"?>

<!DOCTYPE note [
 <!ELEMENT note (to+)>
 <!ELEMENT to (#PCDATA)>
]>

<note>
 <from>Tove</from>
</note>

and the following Perl code:

$objParser      = new XML::Xerces::DOMParser();
$objErrorHandler = new XML::Xerces::PerlErrorHandler();

$objParser->setToCreateXMLDeclTypeNode(1);
$objParser->setValidationScheme(Val_Always);
$objParser->setValidationSchemaFullChecking (1);
$objParser->setErrorHandler($objErrorHandler);
$objParser->setDoSchema(1);

eval
{
    $objParser->parse($ARGV[0]);
};

if($@)
{
    if(ref $@)
    {
        die $@->getMessage();
    }
    else
    {
        die $@;
    }
}

print $objParser->getErrorCount();  # Gives 0!

I have just started using Xerces, so be patient. Am I missing 
something? Shouldn't Xerces come up with an error, because the DTD 
requires the "note" element to consist one or more "to" elements?

Best regards,
Tobias Wolff.


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