Hi avatar382,

I'll ask the question in one sentence first, and then I'll explain
what I am trying to do.

Does libxml-ruby provide a way to validate a document against multiple
XML Schemas such that any XML in different namespaces, with other XML
Schemas mapped to the namespaces in an xsi:schemaLocation attribute on
the root element are validated against their respective schemas if
they are present?

Boy, its been a while since I've used XML Schemas. So, a couple questions for you:

* Does XML Schema support this (and would something like XMLSpy or Visual Studio work with your example)?

* If yes, then do you know if using libxml directly works for you? Libxml has some command line tools that let you access its functionality directly.

* And if yes again, then I'm happy to look at the ruby bindings and see if there is something there we can make better.

Example document:

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<FOO:foo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:FOO="http://foo.org/FOO";
xmlns:BAR="http://bar.org";
xmlns:BAZ="http://baz.org";
xsi:schemaLocation="http://foo.org http://foo.org/foo.xsd
http://bar.org http://bar.org/bar.xsd";>
  <FOO:xmlData>
    <BAR:bar>42</BAR:bar>
  </FOO:xmlData>
  <FOO:xmlData>
    <BAZ:baz>some text</BAZ:baz>
  </FOO:xmlData>
</FOO:foo>

So in this example, there is a snippet of XML in the BAR namespace,
and another in the BAZ namespace. The xsi:schemaLocation attribute has
an XML schema mapped to the BAR namespace, but not to the BAZ
namespace.

I'd like to validate the whole document against the the FOO schema.
With other namespaces, the XML is to be validated if a schema is
present for that namespace, and ignored otherwise.

My ruby code currently looks like this:

doc = LibXML::XML::Document.file path_to_xml_file
schema = LibXML::XML::Schema.new url_to_foo_schema

puts doc.validate_schema schema

What happens if you try this in a different tool. So take the xml file, the schema file, and validate it using libxml command line tools or any number of IDEs that support xml/xml schema.

Just trying to figure out if this is a ruby bindings issue, libxml issue, or xml schema issue.

Thanks,

Charlie

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to