Hi Dusty

I'm having trouble with xpath on leopard, with ruby 1.8.7-p22 and
libxml-ruby (0.8.0).  I was wondering if someone could take a look at
my syntax and see how it looks here.

So it looks like you were able to successfully install and run libxml? That's good news, there was an issue with it last week.

Probably better to ask support question on RubyForge, but let's see what's the issue.

xp = LibXML::XML::Parser.string(doc)

xml = xp.parse

xml.class
=> LibXML::XML::Document

xml.root.name
=> "kml"

xml.root.child.name
=> "Response"

xml.root.find_first('//Response')
=> nil

xml.root.find_first('Response')
=> nil


I can't seem to find anything using find, except for just current node
with ('.').  Any suggestions?

Yes.  This is because the document has a default namespace.

root.find_first('//kml::Response', 'kml:http://earth.google.com/kml/2.0')

And you'll be good. For more examples, check out the RDocs for the XML::XPath class:

http://libxml.rubyforge.org/rdoc/classes/LibXML/XML/XPath.html

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