haysclark / as3-xpath

1 stars 0 forks source link

Wilcard operator should match any namespace #19

Closed haysclark closed 10 years ago

haysclark commented 10 years ago

From peterj...@gmail.com on April 11, 2009 09:35:21

The W3C XPath 1.0 Spec says:

A node test * is true for any node of the principal node type.

And it has examples like:

"@* selects all the attributes of the context node" "/para selects all para grandchildren of the context node" "attribute:: will select all attributes of the context node"

This suggests that * should actually be a synonym for :.

In the current implementation, * will only match a node if:

  1. The node is in no namespace, OR
  2. The node is in the default namespace and the useSourceNamespacePrefixes is set to true. What steps will reproduce the problem? 1. 2. 3. What is the expected output? What do you see instead? Please use labels and text to provide additional information.

Original issue: http://code.google.com/p/xpath-as3/issues/detail?id=19

haysclark commented 10 years ago

From peterj...@gmail.com on April 11, 2009 09:37:00

The spec seems to lean towards * <==> : but it's not 100% clear. I am going to check against other implementation first.

haysclark commented 10 years ago

From peterj...@gmail.com on April 11, 2009 14:40:12

Of other implementations that I found quickly online all of them treat "*" as meaning "any localName and any namespace".

I used the expression "/channel/title" in an rss document, that uses the rdf namespace in the root node, and all returned the correct node: http://www.mizar.dk/XPath/Default.aspx http://www.whitebeam.org/library/guide/TechNotes/xpathtestbed.rhtm http://ponderer.org/download/xpath/ http://www.zrinity.com/developers/xml/xpath/xpath.cfm (no support in the online tool for using namespaces, but "/[local-name()='channel']/[local-name()='title']" worked)

So... I've fixed this and it will be in the next release.

Status: Fixed