Пример #1
0
        public void TestParse2()
        {
            string xml = @"
<root>
 <name>masuda</name>
 <name>yamada</name>
 <name>yamasaki</name>
</root>";
            var    doc = new XmlDocument(xml);
            var    q   = new XmlNavigator(doc)
                         .Where(n => n.TagName == "name")
            ;

            Assert.AreEqual(3, q.Count());
            Assert.AreEqual("masuda", q.First().Value);
        }
Пример #2
0
        public void TestParse2()
        {
            string xml = @"
            <root>
             <name>masuda</name>
             <name>yamada</name>
             <name>yamasaki</name>
            </root>";
            var doc = new XmlDocument(xml);
            var q = new XmlNavigator(doc)
                .Where(n => n.TagName == "name")
                ;

            Assert.AreEqual(3, q.Count());
            Assert.AreEqual("masuda", q.First().Value);
        }
Пример #3
0
        public void TestNormal2()
        {
            var root = new XmlNode("root")
                       .Node("person")
                       .AddNode("name", "masuda")
                       .AddNode("name", "yamada")
                       .AddNode("name", "yamasaki")
                       .Root;

            // タグが検索できた場合
            var q = new XmlNavigator(root)
                    .Where(n => n.TagName == "name")
            ;

            Assert.AreEqual(3, q.Count());
            Assert.AreEqual("masuda", q.First().Value);
        }