I'd like to suggest two new methods for LibXML::XML::XPath::Object.

The first is simply a #to_s method that returns a concat string of all
nodes. Eg.

  xml = XML::Document.string("<r><b>1</b><b>2</b></r>")
  bes = xml.find('b')
  bes.to_s  #=> "<b>1</b><b>2</b>"

Currently #to_s is the same as #inspect, which isn't useful.

The second is to add #find, so that we can do sub-searches on the
nodes. Eg.

  xml = XML::Document.string(%{<r><b>1</b><b id="q">2</b></r>})
  bes = xml.find('b')
  bes.to_s  #=> "<b>1</b><b id=\"q\">2</b>"
  qbs = bes.find("[...@id='q']")
  qbs.to_s  #=> "<b id=\"q\">2</b>"

Thanks,
Tom

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

Reply via email to