) - added by at

Roadmap Changed Wiki

Change History Keywords: By

"NCName:*" node test

rexml_test.rb 2 years (
Search: 1.9 kB a unit test: Note:
ago by changed from Opened 2 years RSS Feed
Owned by: 3.1.3 xpath parser NoMethodError node test namespace child wildcard NCName the XPath parser does not correctly implement
to rexml_test.rb Timeline
Operating system: Version:

Ticket #80

#80 (XPath parser does not correctly implement that "NCName:*" node test) – rexml – Trac the the node test "NCName:*" (aka "prefix:*") which selects all child nodes Help/Guide Yep. It"s broken, alright.

predicate test, as demonstrated below. a there is, however, a pretty simple workaround using

View Tickets

 of do |node| out.push node.value ; end     chk = [ "foo-01", "foo-02", "foo-03", "bar-01", "bar-02" ]     assert_equal out, chk   end  end  #------------------------------------------------------------------------------ # end for rexml_test.rb #------------------------------------------------------------------------------ ) #------------------------------------------------------------------------------ # file: rexml_test.rb # desc: test"s REXML"s XML/XPath implementation # auth: Philip J Grabner <grabner>at<uberdev>dot<org> # date: 2006/08/17 # copy: (C) CopyLoose 2006 Bib Development Team <bib-devel>at<uberdev>dot<org> #------------------------------------------------------------------------------  require "test/unit" require "rexml/document"  class TestRexml < Test::Unit::TestCase    @@xmlstr = "<?xml version="1.0"?> <root xmlns="urn:some-xml-ns" xmlns:other="urn:some-other-xml-ns">  <l1-foo>   <l2 value="foo-01"/>   <l2 value="foo-02"/>   <l2 value="foo-03"/>  </l1-foo>  <other:l1>   <l2 value="no-show"/>  </other:l1>  <l1-bar>   <l2 value="bar-01"/>   <l2 value="bar-02"/>  </l1-bar> </root>"    #----------------------------------------------------------------------------   def test_xpathNamespacedChildWildcard     # tests the "prefix:*" node test syntax     out = Array.new     REXML::XPath.each( REXML::Document.new(@@xmlstr),                        "/ns:root/*[namespace-uri()="urn:some-xml-ns"]/ns:l2/@value",                        { "ns" => "urn:some-xml-ns" } the "prefix:*" node test syntax     out = Array.new     REXML::XPath.each( REXML::Document.new(@@xmlstr),                        "/ns:root/ns:*/ns:l2/@value",                        { "ns" => "urn:some-xml-ns" } ) do |node| out.push node.value ; end     chk = [ "foo-01", "foo-02", "foo-03", "bar-01", "bar-02" ]     assert_equal out, chk   end    #----------------------------------------------------------------------------   def test_xpathNamespacedChildWildcardWorkaround     # tests a workaround 

" during the XPath parsing.

 assertions, 0 failures, 1 Loaded suite test/unit/rexml_test Started E. Finished in 0.008974 seconds.    1) Error: test_xpathNamespacedChildWildcard(TestRexml): NoMethodError: undefined method `node_type" for "urn:some-xml-ns":String     /usr/lib/ruby/1.8/rexml/xpath_parser.rb:373:in `expr"     /usr/lib/ruby/1.8/rexml/xpath_parser.rb:372:in `expr"     /usr/lib/ruby/1.8/rexml/xpath_parser.rb:125:in `match"     /usr/lib/ruby/1.8/rexml/xpath_parser.rb:56:in `parse"     /usr/lib/ruby/1.8/rexml/xpath.rb:53:in `each"     test/unit/rexml_test.rb:34:in `test_xpathNamespacedChildWildcard"  2 tests, 1 errors 

Milestone:

Ruby version: ago Severity: Component: XPath 2 years See
demonstrates XPath parser error

ago by ser

3.1.6 2 years changed from

unit test that demonstrates XPath parser error that unit test

added set to Browse Source

  • 3.1.7 Trac 0.11.1 grabner Cc: assigned

Changed normal ago by ser

  • Changed changed from ago. to 3.1.7

Download in other formats:

Priority: 2 years Reported by:

  • Fixed by About Trac Changed ago status
  • attachment normal 2 years

Linux Attachments excellent test case.

1.8.4 ser resolution for help on using tickets.