コード例 #1
0
        // doesn't match
        public void SelectNodesWithDefaultNSNoPrefix()
        {
            IXPathEngine e = Engine;

            source = InputBuilder.FromString("<d xmlns='urn:test:1'><e/></d>")
                     .Build();
            Dictionary <string, string> m = new Dictionary <string, string>();

            m[string.Empty]    = "urn:test:1";
            e.NamespaceContext = m;
            IEnumerable <XmlNode> it = e.SelectNodes("/d/e", source);

            Assert.IsTrue(it.GetEnumerator().MoveNext());
        }
コード例 #2
0
        [Test] public void SelectNodesWithNS()
        {
            IXPathEngine e = Engine;

            source = InputBuilder.FromString("<n:d xmlns:n='urn:test:1'><n:e/></n:d>")
                     .Build();
            Dictionary <string, string> m = new Dictionary <string, string>();

            m["x"]             = "urn:test:1";
            e.NamespaceContext = m;
            IEnumerable <XmlNode> it = e.SelectNodes("/x:d/x:e", source);

            Assert.IsTrue(it.GetEnumerator().MoveNext());
        }
コード例 #3
0
        [Test] public void SelectNodesWithNS_NodeVersion()
        {
            IXPathEngine e   = Engine;
            XmlDocument  doc = new XmlDocument();

            doc.Load(InputBuilder.FromString("<n:d xmlns:n='urn:test:1'><n:e/></n:d>").Build().Reader);
            sourceRootElement = doc.DocumentElement;
            Dictionary <string, string> m = new Dictionary <string, string>();

            m["x"]             = "urn:test:1";
            e.NamespaceContext = m;
            IEnumerable <XmlNode> it = e.SelectNodes("/x:d/x:e", sourceRootElement);

            Assert.IsTrue(it.GetEnumerator().MoveNext());
        }