Skip to content

Default namespace declaration with empty string as prefix should not break attribute selection #46

@martin-honnen

Description

@martin-honnen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions