|
List Info
Thread: validate XML doc against its XSD on Win32 platform
|
|
| validate XML doc against its XSD on
Win32 platform |

|
2006-11-30 18:29:47 |
|
The thing about Xerces that's such a lifesaver is how it can
cache the schema so you can validate hundreds or thousands
of XML documents in no time at all. I don't know if other
validation toolkits and libraries can do that nowdays but
it sure was the answer to my prayers when I researched all of
this back when. Here are my settings:
my $parser = XML::Xerces::XMLReaderFactory::createXMLReader();
$parser->setErrorHandler(new ErrorHandlers);
$parser->setFeature("$XML::Xerces::XMLUni::fgXercesSchemaFullChecking", 1);
$parser->setFeature("$XML::Xerces::XMLUni::fgXercesContinueAfterFatalError", 1);
$parser->setFeature("$XML::Xerces::XMLUni::fgXercesValidationErrorAsFatal", 0);
$parser->setFeature("$XML::Xerces::XMLUni::fgSAX2CoreValidation", 1);
$parser->setFeature("$XML::Xerces::XMLUni::fgXercesDynamic", 1);
$parser->setFeature("$XML::Xerces::XMLUni::fgXercesCacheGrammarFromParse", 1);
$parser->setFeature("$XML::Xerces::XMLUni::fgXercesUseCachedGrammarInParse", 1);
There have been many instances where Xerces has disagreed with
other validators and it's always turned out Xerces was right.
XML Spy, for example, is wrong A LOT. In my community Xerces has
always been viewed as the cadillac of validators.
---------[ Received Mail Content ]----------
>Subject : Re: validate XML doc against its XSD on Win32 platform
>Date : Thu, 30 Nov 2006 09:19:09 -0500
>From : "John.Ulmer" noaa.gov>
>To : Arvin Porthog lycos.com>
>Cc : "Richard E. Rathmann" comcast.net>, perl-xml listserv.ActiveState.com
>
I got the Xerces stuff working. Just followed the directions.
>
>
As with so many other chores, the 'doing it' was straight forward. The
'figuring out which way to do it is better/best' was a pain.
>
>
The Xerces-p distribution comes with some examples including
'validate.pl' and is exactly what I was trying to do. It reports
errors by line and column and schema error. Perfect.
>
>
Thanks for all the info.
>
>
Arvin Porthog wrote:
As far as I know, Xerces is still the best option out
there
>
for validating XML documents against W3 Schemata. Admittedly
>
it's been awhile since I attempted it with LibXML, but Xerces
>
has always been highly regarded as far as it's correctness (though
>
the Perl module itself is a bitch to install!).
>
>
I wrote a small self-contained Win32 application which shows
>
how this is done. You can get it here:
>
>
http://sunsite3.berkeley.edu/ead/tools/schema_validate
>
>
Double click to install, no perl installation required (it's
>
included in the .exe). Contact me if you're leery of exes and
>
want a zip or something.
>
>
Best regards,
>
>
Arvin
>
>
---------[ Received Mail Content ]----------
>
>Subject : Re: validate XML doc against its XSD on Win32 platform
>
>Date : Tue, 28 Nov 2006 10:26:33 -0500
>
>From : "Richard E. Rathmann"
>
>To : John.Ulmer noaa.gov
>
>Cc : perl-xml listserv.ActiveState.com
>
>
>
>John.Ulmer noaa.gov wrote:
>
>> Hello All,
>
>> I've tried surfing a search of previous posts to no avail. If
I've
>
>> missed my answer in there, forgive me and please point me in
the
>
>> appropriate direction.
>
>>
>
>> I am trying to do something that I thought would be quite
simple.
>
>>
>
>> I need to write an XML validator to run on Win32 machines that
will take
>
>> an XML document and validate it against its XSD doc. This is
nearly
>
>> trivial on my preferred platform (*nix) using LibXML. But, I
don't see
>
>> an obvious route to accomplishing the same on the Win32
platforms.
>
>>
>
>> 'XML::Validate' seems to have some potential but it only
validates
>
>> against a limited set of tags. And, I need to distribute this
little
>
>> application to users that won't be up to doing things like
installing
>
>> Xerces or LibXML. I need a clean Perl solution. Or, I go
Java.... I
>
>> much slower at writing Java..... can do it but don't want
to.... grumble
>
>> grumble......
>
>>
>
>> Any direction would be greatly appreciated.
>
>>
>
>> Thanks,
>
>>
>
>>
>
>John,
>
>
>
>LibXML is probably still your best bet for Win32 as well...you can
find
>
>PPMs for it on Randy Kobes' PPM servers at the University of
Winnipeg:
>
>
>
> *
*http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer58*
>
> (ActivePerl Build < 819)
>
> * *http://theoryx5.uwinnipeg.ca/ppms/* (ActivePerl Build >=
819)
>
>
>
>If you have troubles installing libxml.dll, you can get the latest
>
>version separately from http://www.zlatkovic.com/libxml.en.html and
copy
>
>it to your Perl bin directory.
>
>
>
>Richard
>
>
>
>
>
Lycos Cinema : Catch up with your friends and see free movies online -
watch, chat & connect now >>
http://cinema.lycos.com
_______________________________________________
Perl-XML mailing list
Perl-XML listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
--
John R. Ulmer
Senior Computer Analyst
Perot Systems Government Services Contractor
NOAA Coastal Services Center
john.ulmer noaa.gov
(843)740-1228
2234 South Hobson Avenue, Charleston, SC 29405
Lycos Cinema : Catch up with your friends and see free movies online - watch, chat & connect now >>
http://cinema.lycos.com
|
[1]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|