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.

doc = '<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://
earth.google.com/kml/2.0"><Response><name>1600 Pennsylvania Ave NW,
Washington, DC 20500</name><Status><code>200</code><request>geocode</
request></Status><Placemark id="p1"><address>1600 Pennsylvania Ave NW,
Washington, DC 20006, USA</address><AddressDetails Accuracy="8"
xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:
2.0"><Country><CountryNameCode>US</
CountryNameCode><AdministrativeArea><AdministrativeAreaName>DC</
AdministrativeAreaName><Locality><LocalityName>Washington</
LocalityName><Thoroughfare><ThoroughfareName>1600 Pennsylvania Ave NW</
ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>20006</
PostalCodeNumber></PostalCode></Locality></AdministrativeArea></
Country></AddressDetails><Point><coordinates>-77.036698,38.897102,0</
coordinates></Point></Placemark></Response></kml>'

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?



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

Reply via email to