Validating XML Parser?

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

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

Best,
Zev

···

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.

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 :slight_smile:

Regards,

Iwan

E

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

···

On Fri, February 25, 2005 8:25 am, Iwan van der Kleyn said:

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/XML/Schema

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://mail.gnome.org/archives/xml/2002-April/msg00162.html

James

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.tar.bzip2

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

"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?

W3C XML Schema

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://xmlsoft.org/

http://xmlsoft.org/search.php?query=ruby&submit=Search
Re: [xml] Ruby bindings??
http://libgdome-ruby.berlios.de/

Probably a stand alone validation tool helps.

    robert

They seemed in complete last I used them (the webpage seems inaccessible
now, but I got it through FreeBSD ports:
FreshPorts -- textproc/ruby-libxml: A friendly API to libxml for Ruby ), but they do the job.

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

···

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.

--
Neil Stevens - neil@hakubi.us

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

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:
FreshPorts -- textproc/ruby-libxml: A friendly API to libxml for Ruby ), 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.net/rnv.html
[2] http://www.relax-ng.org

···

On Fri, February 25, 2005 3:50 pm, Neil Stevens said:

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

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:
FreshPorts -- textproc/ruby-libxml: A friendly API to libxml for Ruby ), 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