Jean-sébastien Jney said:
anyone knows how to validate an xml string a schema using with libxml-
ruby?
validate_schema method is only available for XML:
ocument but not for
XML::Reader.
regards.
Hello,
I saw your post searching some help for LibXML.
I'm trying to validate via LibXML::XML::Schema like it's written in the
official documentation:
http://libxml.rubyforge.org/rdoc/classes/LibXML/XML/Schema.html
"""
# parse schema as xml document
schema_document = XML:
ocument.file('schema.rng')
# prepare schema for validation
schema = XML::Schema.document(schema_document)
# parse xml document to be validated
instance = XML:
ocument.file('instance.xml')
# validate
instance.validate_schema(schema)
"""
...but there is something wrong about installation because I can't use
the validation method. I don't have it. I was looking around and I can't
see the method anywhere.
Do you have any idea??
P.S. I'm using Leopard as SO and I haven't changed anything about
libxml2.
Thanks in advance,
Raul.