Topic: LibXML-Ruby find with namespace

I would greatly appreciate any help with this noob question...

I'm using LibXML-Ruby to make a very small xml doc and then search for a node. The document is correctly generated, but I'm evidently missing something very basic because the search is not yielding any result. I have:

require 'rubygems'
require 'xml'
tmp_doc = XML::Document.new()
tmp_doc.root = XML::Node.new('a:frame')
tmp_doc.root["xmlns:a"]='http://bar/baz'
tmp_doc.root << XML::Node.new('a:table')
puts tmp_doc
puts tmp_doc.find("//a:table","a:http://bar/baz").length

The doc is printed but search result is 0

Can you help with the "find" statement, please? Thanks in advance.

Re: LibXML-Ruby find with namespace

use allways Parser and Xml document.to_s

require 'rubygems'
require 'xml/libxml'
tmp_doc = XML::Document.new()
tmp_doc.root = XML::Node.new('a:frame')
tmp_doc.root.attributes["xmlns:a"]="http://bar/baz"
tmp_doc.root << XML::Node.new('a:table')
puts tmp_doc.to_s
document1 = XML::Parser.string(tmp_doc.to_s).parse
namespace='a:http://bar/baz'
document2 =document1.find('//a:table', namespace)
print document2[0],"\n"
print document1.find('//a:table', namespace).length