XPath2.Net
XPath2.Net copied to clipboard
Default namespace declaration with empty string as prefix should not break attribute selection
The fix suggested some months ago to allow using an empty string as the prefix to select e.g. HTML element in the XHTML namespace unfortunately breaks attribute selection, i.e. a test like
[Fact]
public void BindingEmptyPrefixShouldNotBreakAttributeSelection()
{
var namespaceManager = new XmlNamespaceManager(new NameTable());
namespaceManager.AddNamespace("", "http://www.w3.org/1999/xhtml");
var nodeList = GetXHTMLSampleDoc().XPath2SelectNodes("//@lang", namespaceManager);
Assert.Equal(1, nodeList.Count);
}
fails as the XPath2 code now looks for attributes named lang
in XHTML namespace. I am currently not sure how to fix the NameTest/QName production in XPath.y to only use the context.NamespaceManager.DefaultNamespace if the node name is of an element node.