List Info

Thread: validate XML doc against its XSD on Win32 platform




validate XML doc against its XSD on Win32 platform
user name
2006-11-30 00:00:42
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" comcast.net>
>To : John.Ulmernoaa.gov
>Cc : perl-xmllistserv.ActiveState.com
>
>John.Ulmernoaa.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
validate XML doc against its XSD on Win32 platform
user name
2006-11-30 00:10:35
I have heard rumors of unspecific "problems" with
XML::LibXML's  
schema validation, but I have not experienced any of them
myself. As  
far as I know, it's still undocumented, but has worked
without a  
hitch for me in many applications:

     my $parser = new XML::LibXML;
     my $validator = new XML::LibXML::Schema (location =>
  
"schema.xsd");
     $doc = $parser-> parse_string($content);
     eval { $validator-> validate($doc) };
     if ($) {
         ...
     }
     else
     {
         ...
     }

-Danny

(See also http://aspn.activestate.com/ASPN/Mail/Message/perl-xml/ 
3211721. 

_______________________________________________
Perl-XML mailing list
Perl-XMLlistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
validate XML doc against its XSD on Win32 platform
user name
2006-11-30 00:12:01
Ahem, I only just realized you said LibXML was not an option
under  
Win32.  Sorry.

- Danny

_______________________________________________
Perl-XML mailing list
Perl-XMLlistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
validate XML doc against its XSD on Win32 platform
user name
2006-11-30 11:40:54
On Thursday 30 November 2006 01:10, Danny Brian wrote:
> I have heard rumors of unspecific "problems"
with XML::LibXML's
> schema validation, but I have not experienced any of
them myself.
> As far as I know, it's still undocumented,

Danny,

stop this FUD, XML::LibXML::Schema API *is* documented, the 
documentation POD is included in the distribution package.
On UNIX, 
even manual pages are generated (man XML::LibXML::Schema). 

I guess that your "undocumented" means that you do
not see the 
documentation on Randy Kobes' http://kobesearch.cpan.o
rg/. I do not 
know, why Randy's engine ignores some of the .pod files,
probably 
it's because for some modules, there is no corresponding .pm
file. 

You can still find all the documentation on-line using the
good old 
CPAN-search site:

htt
p://search.cpan.org/~pajas/XML-LibXML-1.62001/

-- Petr


> but has worked without 
> a hitch for me in many applications:
>
>      my $parser = new XML::LibXML;
>      my $validator = new XML::LibXML::Schema (location
=>
> "schema.xsd");
>      $doc = $parser-> parse_string($content);
>      eval { $validator-> validate($doc) };
>      if ($) {
>          ...
>      }
>      else
>      {
>          ...
>      }
>
> -Danny
>
> (See also http://aspn.activestate.com/ASPN/Mail/Message/perl-xml/
> 3211721. 
>
> _______________________________________________
> Perl-XML mailing list
> Perl-XMLlistserv.ActiveState.com
> To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-XML mailing list
Perl-XMLlistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
validate XML doc against its XSD on Win32 platform
user name
2006-11-30 14:19:09
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:
arvinporthog.bos-mail-wwl1.lycos.com" type="cite">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" comcast.net>
>To : noaa.gov">John.Ulmernoaa.gov
>Cc : listserv.ActiveState.com">perl-xmllistserv.ActiveState.com
>
>noaa.gov">John.Ulmernoaa.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
>

comcast.net>


Lycos Cinema : Catch up with your friends and see free movies online - watch, chat & connect now >> http://cinema.lycos.com

_______________________________________________ Perl-XML mailing list listserv.ActiveState.com">Perl-XMLlistserv.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
noaa.gov">john.ulmernoaa.gov
(843)740-1228
2234 South Hobson Avenue, Charleston, SC 29405
[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )