Validing with an XSD in ruby
06 Sep 2008 xml = generate_xml
require 'xml'
Tempfile.open(self.class.to_s) do |tmp|
tmp.write(xml)
tmp.close
document = XML::Document.file(tmp.path)
schema_doc = XML::Document.file("some.xsd")
schema = XML::Schema.document(schema_doc)
assert document.validate(schema), "the xml isn't valid. look above for error."
end