Re: validate an XML against an XSD
Stephen Collyer <[email protected]> Thu, 22 Sep 2005 19:00:32 +0100
| Newsgroups | gmane.text.xml.xerces-p.devel |
|---|---|
| Message-ID | <[email protected]> |
Raju Sunny wrote:
> i have the XML file like this
> <?xml version="1.0" encoding="UTF-8"?>
> <IPU-Answers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="ipu_answers_ses.xsd" >
> <IPU-Masterinfo>
First point: you're using a noNamespaceSchemaLocation, whereas my
example showed a schemaLocation attribute. I'd have to run your
code to see what happens here.
> now the code is something liek this
>
> my $parser = XML::Xerces::XMLReaderFactory::createXMLReader();
>
> #$parser->setFeature("$XML::Xerces::XMLUni::fgSAX2CoreNameSpaces", 0);
>
> #$parser->setFeature("$XML::Xerces::XMLUni::fgSAX2CoreValidation", 0);
>
> #$parser->setFeature("$XML::Xerces::XMLUni::fgXercesSchema", 0);
>
> #$parser->setErrorHandler(MyErrorHandler->new);
You seem to have commented all of the interesting lines out.
> my $xml = "ipu_answers.xml";
> open (HNDLR,$xml);
> my (@lines) = <HNDLR>;
> close HNDLR;
> my $something = join (" ",@lines);
>
>
> eval ($parser->parse(XML::Xerces::MemBufInputSource->new($something)));
>
> it just runs without any err and nithing happens
How do you know ? You don't seem to have set an error handler,
or enabled the correct features, due to the comments above, and you
don't seem to be checking $@.
I may be misunderstanding what you're doing in the code, as what
you've shown above looks rather odd.
> the things coloured in red means that the script exists there...
Two points
1. Please don't send HTML based messages, as not all readers
support HTML
2. I don't know what you mean by "the script exists there".
It seems to me that the script doesn't exist there, as you've
commented it out.
--
Regards
Stephen Collyer
Netspinner Ltd