Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
validate xml
jney
6/10/2008 3:39:00 PM
anyone knows how to validate an xml string a schema using with libxml-
ruby?
validate_schema method is only available for XML::Document but not for
XML::Reader.
regards.
2 Answers
Tiago Macedo
7/14/2008 3:47:00 AM
0
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
You can create a document from your string:
xp = XML::Parser.new
xp.string = your_string
xml_doc = xp.parse
Tiago Macedo
jney wrote:
| anyone knows how to validate an xml string a schema using with libxml-
| ruby?
| validate_schema method is only available for XML::Document but not for
| XML::Reader.
| regards.
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla -
http://enigmail....
iEYEARECAAYFAkh6zSUACgkQxFuRTtCTMvLnhwCeJtDOWw1tra3z9oBxH9Syo8HE
MToAnixT8tQJyB/pAPQ7r8kcUalPGin5
=bbEL
-----END PGP SIGNATURE-----
Raul Martinez
4/20/2009 5:45:00 PM
0
Jean-sébastien Jney wrote:
> anyone knows how to validate an xml string a schema using with libxml-
> ruby?
> validate_schema method is only available for XML::Document 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/S...
"""
# parse schema as xml document
schema_document = XML::Document.file('schema.rng')
# prepare schema for validation
schema = XML::Schema.document(schema_document)
# parse xml document to be validated
instance = XML::Document.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.
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
validate xml
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password