-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default namespace declaration with empty string as prefix should not break attribute selection #46
Comments
Just an observation: |
Also note that the original XPath does also not work: [Fact]
public void XPath2SelectNodesWithDefaultNamespace()
{
var namespaceManager = new XmlNamespaceManager(new NameTable());
namespaceManager.AddNamespace(string.Empty, "http://www.w3.org/1999/xhtml");
var nodeListXPath1 = GetXHTMLSampleDoc().SelectNodes("//p", namespaceManager);
var nodeListXPath2 = GetXHTMLSampleDoc().XPath2SelectNodes("//p", namespaceManager);
nodeListXPath1.Should().HaveCount(2);
nodeListXPath2.Should().HaveCount(2);
} |
Well, that is how XPath 1.0 works, no surprise there. |
I don't get through to that page, it wants me to confirm with too many captchas that I am not a robot. Is that tool using XPath 1, 2 or 3? Or is it using the XPath2 library? I am not sure what the observation is supposed to tell me or explain me. |
I don't know exactly the difference between v1 en v2 in regard to this specific query, So I assumed that this If that is not the case, then I don't know yet how to solve this. Question: |
In XPath 1
Using The fix achieved that but is currently flawed as attribute selection also is subjected to the namespace supposed to be only the default element namespace declaration. |
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
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.The text was updated successfully, but these errors were encountered: