# XSD and XML

**URL:** <https://www.ruby-forum.com/t/xsd-and-xml/109149>\
**Category:** Ruby\
**Created:** [July 11, 2007, 10:36pm UTC](https://www.ruby-forum.com/t/xsd-and-xml/109149 "2007-07-11T22:36:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 11, 2007, 10:36pm UTC](https://www.ruby-forum.com/t/xsd-and-xml/109149/1 "2007-07-11T22:36:30Z")

</div>

Hi!  
Is there a way to deal with XML-files in Ruby? And further: is there a  
(existing) solution/way how to parse/validate XML-files against a XML-  
Schema (XSD)?

Thanks for any help!  
Dominik A.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 12, 2007, 12:26am UTC](https://www.ruby-forum.com/t/xsd-and-xml/109149/2 "2007-07-12T00:26:55Z")

</div>

On Jul 11, 4:33 pm, “removed\_email\_address@domain.invalid”  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi!  
> Is there a way to deal with XML-files in Ruby? And further: is there a  
> (existing) solution/way how to parse/validate XML-files against a XML-  
> Schema (XSD)?
> 
> Thanks for any help!  
> Dominik A.

REXML is the Ruby Library for parsing xml docs. Not sure if it  
validates though.  
[http://www.germane-software.com/software/rexml/](http://www.germane-software.com/software/rexml/) has a tutorial and the  
documentation. The documentation is also available with the standard  
RDoc.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 12, 2007, 12:49am UTC](https://www.ruby-forum.com/t/xsd-and-xml/109149/3 "2007-07-12T00:49:57Z")

</div>

On 7/11/07, removed\_email\_address@domain.invalid wrote:

> On Jul 11, 4:33 pm, “removed\_email\_address@domain.invalid” wrote:
> 
> > Is there a way to deal with XML-files in Ruby? And further: is there a  
> > (existing) solution/way how to parse/validate XML-files against a XML-  
> > Schema (XSD)?
> 
> REXML is the Ruby Library for parsing xml docs. Not sure if it  
> validates though.

There is also libxml-ruby:  
[http://libxml.rubyforge.org/doc/](http://libxml.rubyforge.org/doc/)

Also, I have used JRuby to use Java XML processing libraries.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 12, 2007, 11:06am UTC](https://www.ruby-forum.com/t/xsd-and-xml/109149/4 "2007-07-12T11:06:42Z")

</div>

I finally found (after I googled “libxml-ruby xsd”) a “Recipe” how to  
validate XML-files against DTD/XSD!  
Here is the link:  
[http://codeidol.com/other/rubyckbk/XML-and-HTML/Validating-an-XML-Document/](http://codeidol.com/other/rubyckbk/XML-and-HTML/Validating-an-XML-Document/)  
I think it’s using “libxml-ruby”, but (as I understood it) it is not a  
“pure-Ruby”-solution because it’s using a C library. But that’s no  
problem.

Thanks for your hints!

Best Regards,

- dominik aumayr
