I'm willing to do the work (adding unit tests and fixing the bug if I can) if you don't mind :-)
2007/11/27, keisuke fukuda <[EMAIL PROTECTED]>: > Hi, > > How to specify namespace on xpath in version 5.2.0 ? > > Someone told me that you can do it like this in version 3.8.4 : > --- > require "rubygems" > require "xml/libxml" # 3.8.4 > > doc = XML::Parser.string(<<EOS).parse > <?xml version="1.0" encoding='utf-8'?> > <service xmlns="http://www.w3.org/2007/app" > xmlns:atom="http://www.w3.org/2005/Atom"> > <workspace> > <collection href="http://example.org/blog/main"> > <atom:title>My Blog Entries</atom:title> > </collection> > </workspace> > </service> > EOS > > namespaces = { > "app" => "http://www.w3.org/2007/app", > "atom" => "http://www.w3.org/2005/Atom" > }.to_a > > p doc.find('/app:service/app:workspace/app:collection/atom:title', namespaces) > __END__ > > => <atom:title>My Blog Entries</atom:title> > > --- > > But, in 5.2.0, it saids > " in `find': nested array must be an array of strings, prefix and > href/uri (ArgumentError) " > > ( in Addition, it SEGVs sometimes in normal interpreter and always in irb ) > > Is this a bug ? (Or, is there any other way to do this in 5.2.0) ? > I took a look at the source code and found that there is almost no > unit test about namespace on XPath. > > -- > FUKUDA, Keisuke > -- FUKUDA, Keisuke <福田圭祐> http://d.hatena.ne.jp/keisukefukuda/
_______________________________________________ libxml-devel mailing list libxml-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/libxml-devel