Krang::XML::Validator - validate XML documents against XML Schemas
# create a new validator
$validator = pkg('XML::Validator')->new();
# validate a file ($ok, $msg) = $validator->validate(path => 'story1024.xml');
# deal with results
unless ($ok) {
croak "That story just ain't right: $msg";
}
This module allows you to validate XML documents against schemas
stored in $KRANG_ROOT/schema. The documents must contain schema
declarations like this one in their root element:
<index xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="index.xsd">
The .xsd file specified for xsi:noNamespaceSchemaLocation must
exist in $KRANG_ROOT/schema.
$validator = Krang::XML::Validator = Krang::XML::Validator->new()($ok, $msg) = $validator->validate(path => 'foo.xml')(1, undef) if the file
passed, otherwise returns (0, "msg") describing the problem.
Will croak if validation cannot be performed.