From: Peter Fitzgibbons Date: 2005-10-22T01:17:12+09:00 Subject: Re: REXML::XPath results out of sort order ? ------=_Part_1159_30386941.1129911430342 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 10/21/05, daz wrote: > > > Peter Fitzgibbons wrote: > > Hello, > > I need a reality check here, > > given this xml : http://rafb.net/paste/results/iziEQI77.html > > > > this test : > > mi =3D XPath.match(@xml, > '//HomesiteTree/Builder/Division/Workflow/Milestone') > > assert_equal '10', mi[0].elements['MsMilestoneId'].text > > > > fails with : > > 2) Failure: > > test_enrollmentMilestones(EnrollmentTest) > > [C:/ruby/dev/BuildviewExtractor/test/functional/enrollment_test.rb:64]: > > <"10"> expected but was <"80">. > > > > > > Is XPath.match returning results out of order ? > > > > Am I missing something ? > > > > Sean has made lots of changes in the later version (see this post): > > http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-talk/154866?1547= 14-156516 > > > My quick test came up empty using this snippet on your data - > (maybe I got something wrong): > > require 'rexml/document' > p REXML::Version #-> "3.1.3" > xml =3D REXML::Document.new('D:\ruby\DfB\TEMP\clruby\___test.xml') > mi =3D REXML::XPath.match(xml, > '//HomesiteTree/Builder/Division/Workflow/Milestone') > > p mi #-> [] > > > > Thanks for your advice. > > > > Peter Fitzgibbons > > > Hope it's useful ... > > daz > > > > > You have to File.open the file... Document.new doesn't know how to open the stream.. only how to read it. please try : xml =3D REXML::Document.new(File.open('D:\ruby\DfB\TEMP\clruby\__ > > _test.xml') ) ------=_Part_1159_30386941.1129911430342--