REXML XPath question


#1

Can anyone explain these result to me (see bottom)?

require ‘rexml//document’
d = REXML::Document.new %{

test

3

4

5

6

}

REXML::XPath.match d, “/html/body/p[@id=‘foo’]”
#-> []

REXML::XPath.match d, “/html/body/p[@id]”
#-> []

REXML::XPath.match d, “/html/body/p[@*]”
#-> [

… </>,

… </>]


#2

OK I just removed xmlns=“http://www.w3.org/1999/xhtml” from the
tag (the default namespace) and now it works.

Is this a bug?


#3

Wow, 2 replies from myself…

I just found out that XPath 1.0 does not work correctly with a default
namespace. So this is “correct” behavior.