If your working with DB2 on Rails you probably need to check if the xml document is – at least – well formed.
I found a neat plugin called validates-xml that uses REXML to see if documents are well formed.
To install it simply
svn co http://validates-xml.googlecode.com/svn/trunk/ validates-xml-read-only
And copy that folder to vendor/plugins.
You can easily integrate schema validation with a validates_xml_with_schema method. But you should use REXML as it cames with the standard ruby bundle since version 1.8.
To use it simply restart your server and