public void PerformsXpathCalculations()
        {
            IXML xml = new XMLCursor("<x><a/><a/><a/></x>");

            Assert.Single(
                xml.Values("count(//x/a)")
                );


            Assert.Equal(
                "3",
                xml.Values("count(//a)")[0]
                );
        }
        public void ValueRejectsWrongSelection()
        {
            IXML doc =
                new XMLCursor(
                    new InputOf(
                        "<root><a><x attr='test'>1</x></a><a><x>2</x></a></root>"
                        )
                    );

            Assert.Throws <ArgumentException>(
                () => doc.Values("//a") //illegal because a is a TAG and not a VALUE
                );
        }
        public void FindsNodesWithCustomNamespace()
        {
            IXML doc =
                new XMLCursor(
                    "<a xmlns='urn:foo'><b>\u0433!</b></a>"
                    );


            doc = doc.WithNamespace("f", "urn:foo");

            Assert.Single(
                doc.Nodes("/f:a/f:b[.='\u0433!']")
                );

            Assert.Equal(
                "\u0433!",
                doc.Values("//f:b/text()")[0]
                );
        }