Any clue from anyone ?.
Am still struggling with the problem.

Ashok

On 2/1/07, Ashok Varma <[EMAIL PROTECTED]> wrote:

Hi,

I have XSD, XML files and want to validate the XML against the XSD and
then only proceed with parsing the XML file.

I used XML::SAX::ParserFactory, XML::Validator::Schema modules but
following is the issues i faced ...
1. Failed with this reason --- elementFormDefault in <schema> must be
'unqualified', 'qualified' is not supported.
    I modified the attribute 'elementFormDefault' value to 'unqualified'
and it worked (practically, i should not do this).

Can any one please suggest me a better module which does the above.

code snippet i used
------------------
use XML::SAX::ParserFactory;
use XML::Validator::Schema;

my $xsd_file = '/Users/vashokvarma/EID/xmlfile/EID.xsd';
my $xml_file = '/Users/vashokvarma/EID/xmlfile/EID.xml';

my $validator = XML::Validator::Schema->new(file => $xsd_file);

my $parser = XML::SAX::ParserFactory->parser(Handler => $validator);

eval { $parser->parse_uri($xml_file) };
if ($@) {
    print "File failed validation: $@"
} else {
    print "proceed with parsing XML\n";
}
------------------

Let me know if anyone need any additional information. Any kind of help is
agreatly appreciated.

Thanks,
Ashok

Reply via email to