[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Validating XML Parser?

Yuu

2/25/2005 8:23:00 AM

Hi there,

Through my employer I am involded in a rather major standardisation
effort in the Netherlands were we try to interconnect governmental
databases through XML/ReST based webservices (I've designed the
architecture and protocol). Yesterday I got permission from the Project
Board to use Ruby or Python as the prototyping language for use in the
implementation toolkit which will be distributed among implementors.
Well. that's the good news. The "bad" news is that a functional
requirement of any participating system is, that it can automaticaly
validate the XML messages against a provided schema. Unfortunately,
REXML, nice as it is, doesn't support XML validation in this manner.

Can anyone point me to a (schema based) validating XML parser which can
be used from Ruby? I've seen a reference to a Ruby binding for expat.
But that one dates from 2002.

Regards,

Iwan
8 Answers

Zev Blut

2/25/2005 9:07:00 AM

0

On Fri, 25 Feb 2005 17:25:00 +0900, Iwan van der Kleyn <none@none.net>
wrote:

> Can anyone point me to a (schema based) validating XML parser which can
> be used from Ruby? I've seen a reference to a Ruby binding for expat.
> But that one dates from 2002.

It may not be exactly what you want, but you can use xmllint from Ruby
using
system or ` .

Best,
Zev



ES

2/25/2005 9:34:00 AM

0

On Fri, February 25, 2005 8:25 am, Iwan van der Kleyn said:
> Hi there,
>
> Through my employer I am involded in a rather major standardisation
> effort in the Netherlands were we try to interconnect governmental
> databases through XML/ReST based webservices (I've designed the
> architecture and protocol). Yesterday I got permission from the Project
> Board to use Ruby or Python as the prototyping language for use in the
> implementation toolkit which will be distributed among implementors.
> Well. that's the good news. The "bad" news is that a functional
> requirement of any participating system is, that it can automaticaly
> validate the XML messages against a provided schema. Unfortunately,
> REXML, nice as it is, doesn't support XML validation in this manner.
>
> Can anyone point me to a (schema based) validating XML parser which can
> be used from Ruby? I've seen a reference to a Ruby binding for expat.
> But that one dates from 2002.

XMLParser[1] wraps expat, don't know about validation (REXML is generally
good enough for me).

I would, however, suggest considering just calling expat (or whatever)
to do validation if that's necessary and there are no alternatives.

On the other hand, you could use REXML to parse the schema and build
the validator yourself :)

> Regards,
>
> Iwan

E

[1] http://www.yoshidam.net/Ruby.html...



James Britt

2/25/2005 1:44:00 PM

0

Iwan van der Kleyn wrote:
> Hi there,
>
>
> Can anyone point me to a (schema based) validating XML parser which can
> be used from Ruby? I've seen a reference to a Ruby binding for expat.
> But that one dates from 2002.

When you say "schema", do you mean W3C Schema?

http://www.w3.org/...


There are Ruby bindings for libxml2, though I do not know how up-to-date
they are. But it may only validate against a DTD.

http://xm...

http://xm...search.php?query=ruby&submit=Search
http://mail.gnome.org/archives/xml/2002-April/msg...
http://libgdome-ruby.b...



James


Robert Klemme

2/25/2005 2:37:00 PM

0


"James Britt" <jamesUNDERBARb@neurogami.com> schrieb im Newsbeitrag
news:421F2BDF.3020001@neurogami.com...
> Iwan van der Kleyn wrote:
> > Hi there,
> >
> >
> > Can anyone point me to a (schema based) validating XML parser which
can
> > be used from Ruby? I've seen a reference to a Ruby binding for expat.
> > But that one dates from 2002.
>
> When you say "schema", do you mean W3C Schema?
>
> http://www.w3.org/...
>
>
> There are Ruby bindings for libxml2, though I do not know how up-to-date
> they are. But it may only validate against a DTD.
>
> http://xm...
>
> http://xm...search.php?query=ruby&submit=Search
> http://mail.gnome.org/archives/xml/2002-April/msg...
> http://libgdome-ruby.b...

Probably a stand alone validation tool helps.

robert

Neil Stevens

2/25/2005 3:48:00 PM

0

On Fri, 25 Feb 2005 22:44:23 +0900, James Britt wrote:

> There are Ruby bindings for libxml2, though I do not know how up-to-date
> they are. But it may only validate against a DTD.

They seemed in complete last I used them (the webpage seems inaccessible
now, but I got it through FreeBSD ports:
http://www.freshports.org/textproc/ru... ), but they do the job.

I've never used schemas before, though. so I wouldn't know what to
recommend for them.

--
Neil Stevens - neil@hakubi.us

'A republic, if you can keep it.' -- Benjamin Franklin

ES

2/26/2005 12:28:00 AM

0

On Fri, February 25, 2005 3:50 pm, Neil Stevens said:
> On Fri, 25 Feb 2005 22:44:23 +0900, James Britt wrote:
>
>> There are Ruby bindings for libxml2, though I do not know how up-to-date
>> they are. But it may only validate against a DTD.
>
> They seemed in complete last I used them (the webpage seems inaccessible
> now, but I got it through FreeBSD ports:
> http://www.freshports.org/textproc/ru... ), but they do the job.
>
> I've never used schemas before, though. so I wouldn't know what to
> recommend for them.

David Ashen has a C validator [1] for Relax-NG schemas [2].

> Neil Stevens - neil@hakubi.us

E

[1] http://davidashen.ne...
[2] http://www.re...




James Britt

2/26/2005 12:43:00 AM

0

ES wrote:
> On Fri, February 25, 2005 3:50 pm, Neil Stevens said:
>
>>On Fri, 25 Feb 2005 22:44:23 +0900, James Britt wrote:
>>
>>
>>>There are Ruby bindings for libxml2, though I do not know how up-to-date
>>>they are. But it may only validate against a DTD.
>>
>>They seemed in complete last I used them (the webpage seems inaccessible
>>now, but I got it through FreeBSD ports:
>>http://www.freshports.org/textproc/ru... ), but they do the job.
>>
>>I've never used schemas before, though. so I wouldn't know what to
>>recommend for them.
>
>
> David Ashen has a C validator [1] for Relax-NG schemas [2].

There is also some beta stuff in REXML for R-NG validation, too.



James


Martin Povolný

2/27/2005 10:01:00 AM

0

Iwan van der Kleyn wrote:
> Hi there,
>
> Through my employer I am involded in a rather major standardisation
> effort in the Netherlands were we try to interconnect governmental
> databases through XML/ReST based webservices (I've designed the
> architecture and protocol). Yesterday I got permission from the Project
> Board to use Ruby or Python as the prototyping language for use in the
> implementation toolkit which will be distributed among implementors.
> Well. that's the good news. The "bad" news is that a functional
> requirement of any participating system is, that it can automaticaly
> validate the XML messages against a provided schema. Unfortunately,
> REXML, nice as it is, doesn't support XML validation in this manner.
>
> Can anyone point me to a (schema based) validating XML parser which can
> be used from Ruby? I've seen a reference to a Ruby binding for expat.
> But that one dates from 2002.
>
> Regards,
>
> Iwan
>
>

I have basic wrappers for schema and dtd validation in my version of
libxml-ruby.

Download
http://martin.solnet.cz/software/ruby/ruby-xml/libxml-ruby-latest...

untar, ruby extconf.rb && make

cd tests
ruby -I.. schema-test.rb

ruby -I.. dtd-test.rb

Regards,

--
Mgr. Martin Povolný, soLNet, s.r.o.,
+420777714458, martin.povolny@solnet.cz