From: Peter Fitzgibbons Date: 2006-10-03T06:01:21+09:00 Subject: libxml 0.3.8 - How to validate document with schema ? ------=_Part_90038_8285836.1159822877975 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello all (Ross), I'm trying to get libxml to validate an XML::Document using #validate with an XML::Schema. Can one of you describe to me what is wrong ? I have this, with the examples pasted at the end of this post. This is from the W3Schools example at : http://www.w3schools.com/schema/schema_example.asp $ irb irb(main):001:0> require 'rubygems' => true irb(main):002:0> require 'xml/libxml' => true irb(main):003:0> xml = XML::Document.new('shiporder.xml') => irb(main):004:0> sch = XML::Schema.from_string(File.open('shiporder.xsd ').read) => # irb(main):005:0> xml.validate sch error -- found validity error: no root element => false irb(main):006:0> ============ shiporder.xml =============== John Smith Ola Nordmann
Langgt 23
4000 Stavanger Norway
Empire Burlesque Special Edition 1 10.90 Hide your heart 1 9.90
============ shiporder.xml =============== ============ shiporder.xsd =============== ============ shiporder.xsd =============== -- ------------------------------ Apple MacBook. Black. It's the new White! ------------------------------ Peter Fitzgibbons ------=_Part_90038_8285836.1159822877975--