| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628 |
- //
- // MonoTests.System.Xml.XPathNavigatorReaderTests
- //
- // Author:
- // Atsushi Enomoto <[email protected]>
- //
- // Copyright (C) 2005 Novell, Inc. http://www.novell.com
- //
- #if NET_2_0
- using System;
- using System.Xml;
- using System.Xml.XPath;
- using NUnit.Framework;
- using MonoTests.System.Xml; // XmlAssert
- namespace MonoTests.System.Xml.XPath
- {
- [TestFixture]
- public class XPathNavigatorReaderTests
- {
- XmlDocument document;
- XPathNavigator nav;
- XPathDocument xpathDocument;
- [SetUp]
- public void GetReady ()
- {
- document = new XmlDocument ();
- }
- private XPathNavigator GetXmlDocumentNavigator (string xml)
- {
- document.LoadXml (xml);
- return document.CreateNavigator ();
- }
-
- private XPathNavigator GetXPathDocumentNavigator (XmlNode node)
- {
- XmlNodeReader xr = new XmlNodeReader (node);
- xpathDocument = new XPathDocument (xr);
- return xpathDocument.CreateNavigator ();
- }
- [Test]
- public void ReadSubtree1 ()
- {
- string xml = "<root/>";
- nav = GetXmlDocumentNavigator (xml);
- ReadSubtree1 (nav, "#1.");
- nav.MoveToRoot ();
- nav.MoveToFirstChild ();
- ReadSubtree1 (nav, "#2.");
- nav = GetXPathDocumentNavigator (document);
- ReadSubtree1 (nav, "#3.");
- nav.MoveToRoot ();
- nav.MoveToFirstChild ();
- ReadSubtree1 (nav, "#4.");
- }
- void ReadSubtree1 (XPathNavigator nav, string label)
- {
- XmlReader r = nav.ReadSubtree ();
- XmlAssert.AssertNode (label + "#1", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.None, 0, false,
- // Name, Prefix, LocalName, NamespaceURI
- String.Empty, String.Empty, String.Empty, String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- Assert.IsTrue (r.Read (), label + "#2");
- XmlAssert.AssertNode (label + "#3", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Element, 0, true,
- // Name, Prefix, LocalName, NamespaceURI
- "root", String.Empty, "root", String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- Assert.IsFalse (r.Read (), label + "#4");
- }
- [Test]
- public void ReadSubtree2 ()
- {
- string xml = "<root></root>";
- nav = GetXmlDocumentNavigator (xml);
- ReadSubtree2 (nav, "#1.");
- nav.MoveToRoot ();
- nav.MoveToFirstChild ();
- ReadSubtree2 (nav, "#2.");
- nav = GetXPathDocumentNavigator (document);
- ReadSubtree2 (nav, "#3.");
- nav.MoveToRoot ();
- nav.MoveToFirstChild ();
- ReadSubtree2 (nav, "#4.");
- }
- void ReadSubtree2 (XPathNavigator nav, string label)
- {
- XmlReader r = nav.ReadSubtree ();
- XmlAssert.AssertNode (label + "#1", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.None, 0, false,
- // Name, Prefix, LocalName, NamespaceURI
- String.Empty, String.Empty, String.Empty, String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- Assert.IsTrue (r.Read (), label + "#2");
- XmlAssert.AssertNode (label + "#3", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Element, 0, false,
- // Name, Prefix, LocalName, NamespaceURI
- "root", String.Empty, "root", String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- Assert.IsTrue (r.Read (), label + "#4");
- XmlAssert.AssertNode (label + "#5", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.EndElement, 0, false,
- // Name, Prefix, LocalName, NamespaceURI
- "root", String.Empty, "root", String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- Assert.IsFalse (r.Read (), label + "#6");
- }
- [Test]
- public void ReadSubtree3 ()
- {
- string xml = "<root attr='value'/>";
- nav = GetXmlDocumentNavigator (xml);
- ReadSubtree3 (nav, "#1.");
- nav.MoveToRoot ();
- nav.MoveToFirstChild ();
- ReadSubtree3 (nav, "#2.");
- nav = GetXPathDocumentNavigator (document);
- ReadSubtree3 (nav, "#3.");
- nav.MoveToRoot ();
- nav.MoveToFirstChild ();
- ReadSubtree3 (nav, "#4.");
- }
- void ReadSubtree3 (XPathNavigator nav, string label)
- {
- XmlReader r = nav.ReadSubtree ();
- XmlAssert.AssertNode (label + "#1", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.None, 0, false,
- // Name, Prefix, LocalName, NamespaceURI
- String.Empty, String.Empty, String.Empty, String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- Assert.IsTrue (r.Read (), label + "#2");
- XmlAssert.AssertNode (label + "#3", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Element, 0, true,
- // Name, Prefix, LocalName, NamespaceURI
- "root", String.Empty, "root", String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 1, true);
- Assert.IsTrue (r.MoveToFirstAttribute (), label + "#4");
- XmlAssert.AssertNode (label + "#5", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Attribute, 1, false,
- // Name, Prefix, LocalName, NamespaceURI
- "attr", String.Empty, "attr", String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- "value", true, 1, true);
- Assert.IsTrue (r.ReadAttributeValue (), label + "#6");
- XmlAssert.AssertNode (label + "#7", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Text, 2, false,
- // Name, Prefix, LocalName, NamespaceURI
- String.Empty, String.Empty, String.Empty, String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- "value", true, 1, true);
- Assert.IsFalse (r.ReadAttributeValue (), label + "#8");
- Assert.IsFalse (r.MoveToNextAttribute (), label + "#9");
- Assert.IsTrue (r.MoveToElement (), label + "#10");
- Assert.IsFalse (r.Read (), label + "#11");
- }
- [Test]
- public void DocElem_OpenClose_Attribute ()
- {
- string xml = "<root attr='value'></root>";
- nav = GetXmlDocumentNavigator (xml);
- DocElem_OpenClose_Attribute (nav, "#1.");
- nav.MoveToRoot ();
- nav.MoveToFirstChild ();
- DocElem_OpenClose_Attribute (nav, "#2.");
- nav = GetXPathDocumentNavigator (document);
- DocElem_OpenClose_Attribute (nav, "#3.");
- nav.MoveToRoot ();
- nav.MoveToFirstChild ();
- DocElem_OpenClose_Attribute (nav, "#4.");
- }
- void DocElem_OpenClose_Attribute (XPathNavigator nav, string label)
- {
- XmlReader r = nav.ReadSubtree ();
- XmlAssert.AssertNode (label + "#1", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.None, 0, false,
- // Name, Prefix, LocalName, NamespaceURI
- String.Empty, String.Empty, String.Empty, String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- Assert.IsTrue (r.Read (), label + "#2");
- XmlAssert.AssertNode (label + "#3", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Element, 0, false,
- // Name, Prefix, LocalName, NamespaceURI
- "root", String.Empty, "root", String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 1, true);
- Assert.IsTrue (r.MoveToFirstAttribute (), label + "#4");
- XmlAssert.AssertNode (label + "#5", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Attribute, 1, false,
- // Name, Prefix, LocalName, NamespaceURI
- "attr", String.Empty, "attr", String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- "value", true, 1, true);
- Assert.IsTrue (r.ReadAttributeValue (), label + "#6");
- XmlAssert.AssertNode (label + "#7", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Text, 2, false,
- // Name, Prefix, LocalName, NamespaceURI
- String.Empty, String.Empty, String.Empty, String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- "value", true, 1, true);
- Assert.IsFalse (r.ReadAttributeValue (), label + "#8");
- Assert.IsFalse (r.MoveToNextAttribute (), label + "#9");
- Assert.IsTrue (r.MoveToElement (), label + "#10");
- Assert.IsTrue (r.Read (), label + "#11");
- XmlAssert.AssertNode (label + "#12", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.EndElement, 0, false,
- // Name, Prefix, LocalName, NamespaceURI
- "root", String.Empty, "root", String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- Assert.IsFalse (r.Read (), label + "#13");
- }
- [Test]
- public void FromChildElement ()
- {
- string xml = "<root><foo attr='value'>test</foo><bar/></root>";
- nav = GetXmlDocumentNavigator (xml);
- nav.MoveToFirstChild ();
- nav.MoveToFirstChild (); // foo
- FromChildElement (nav, "#1.");
- nav = GetXPathDocumentNavigator (document);
- nav.MoveToFirstChild ();
- nav.MoveToFirstChild (); // foo
- FromChildElement (nav, "#2.");
- }
- void FromChildElement (XPathNavigator nav, string label)
- {
- XmlReader r = nav.ReadSubtree ();
- XmlAssert.AssertNode (label + "#1", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.None, 0, false,
- // Name, Prefix, LocalName, NamespaceURI
- String.Empty, String.Empty, String.Empty, String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- Assert.IsTrue (r.Read (), label + "#2");
- XmlAssert.AssertNode (label + "#3", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Element, 0, false,
- // Name, Prefix, LocalName, NamespaceURI
- "foo", String.Empty, "foo", String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 1, true);
- Assert.IsTrue (r.Read (), label + "#4");
- XmlAssert.AssertNode (label + "#5", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Text, 1, false,
- // Name, Prefix, LocalName, NamespaceURI
- String.Empty, String.Empty, String.Empty, String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- "test", true, 0, false);
- Assert.IsTrue (r.Read (), label + "#6");
- XmlAssert.AssertNode (label + "#7", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.EndElement, 0, false,
- // Name, Prefix, LocalName, NamespaceURI
- "foo", String.Empty, "foo", String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- // end at </foo>, without moving toward <bar>.
- Assert.IsFalse (r.Read (), label + "#8");
- }
- [Test]
- [Category ("NotDotNet")] // MS bug
- public void AttributesAndNamespaces ()
- {
- string xml = "<root attr='value' x:a2='v2' xmlns:x='urn:foo' xmlns='urn:default'></root>";
- nav = GetXmlDocumentNavigator (xml);
- AttributesAndNamespaces (nav, "#1.");
- nav.MoveToRoot ();
- nav.MoveToFirstChild ();
- AttributesAndNamespaces (nav, "#2.");
- nav = GetXPathDocumentNavigator (document);
- AttributesAndNamespaces (nav, "#3.");
- nav.MoveToRoot ();
- nav.MoveToFirstChild ();
- AttributesAndNamespaces (nav, "#4.");
- }
- void AttributesAndNamespaces (XPathNavigator nav, string label)
- {
- XmlReader r = nav.ReadSubtree ();
- XmlAssert.AssertNode (label + "#1", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.None, 0, false,
- // Name, Prefix, LocalName, NamespaceURI
- String.Empty, String.Empty, String.Empty, String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- Assert.IsTrue (r.Read (), label + "#2");
- XmlAssert.AssertNode (label + "#3", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Element, 0, false,
- // Name, Prefix, LocalName, NamespaceURI
- "root", String.Empty, "root", "urn:default",
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 4, true);
- // Namespaces
- Assert.IsTrue (r.MoveToAttribute ("xmlns:x"), label + "#4");
- XmlAssert.AssertNode (label + "#5", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Attribute, 1, false,
- // Name, Prefix, LocalName, NamespaceURI
- "xmlns:x", "xmlns", "x",
- "http://www.w3.org/2000/xmlns/",
- // Value, HasValue, AttributeCount, HasAttributes
- "urn:foo", true, 4, true);
- Assert.IsTrue (r.ReadAttributeValue (), label + "#6");
- ///* MS.NET has a bug here
- XmlAssert.AssertNode (label + "#7", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Text, 2, false,
- // Name, Prefix, LocalName, NamespaceURI
- String.Empty, String.Empty, String.Empty, String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- "urn:foo", true, 4, true);
- //*/
- Assert.IsFalse (r.ReadAttributeValue (), label + "#8");
- Assert.IsTrue (r.MoveToAttribute ("xmlns"), label + "#9");
- XmlAssert.AssertNode (label + "#10", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Attribute, 1, false,
- // Name, Prefix, LocalName, NamespaceURI
- "xmlns", String.Empty, "xmlns",
- "http://www.w3.org/2000/xmlns/",
- // Value, HasValue, AttributeCount, HasAttributes
- "urn:default", true, 4, true);
- Assert.IsTrue (r.ReadAttributeValue (), label + "#11");
- ///* MS.NET has a bug here
- XmlAssert.AssertNode (label + "#12", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Text, 2, false,
- // Name, Prefix, LocalName, NamespaceURI
- String.Empty, String.Empty, String.Empty, String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- "urn:default", true, 4, true);
- //*/
- Assert.IsFalse (r.ReadAttributeValue (), label + "#13");
- // Attributes
- Assert.IsTrue (r.MoveToAttribute ("attr"), label + "#14");
- XmlAssert.AssertNode (label + "#15", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Attribute, 1, false,
- // Name, Prefix, LocalName, NamespaceURI
- "attr", String.Empty, "attr", String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- "value", true, 4, true);
- Assert.IsTrue (r.ReadAttributeValue (), label + "#16");
- XmlAssert.AssertNode (label + "#17", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Text, 2, false,
- // Name, Prefix, LocalName, NamespaceURI
- String.Empty, String.Empty, String.Empty, String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- "value", true, 4, true);
- Assert.IsFalse (r.ReadAttributeValue (), label + "#18");
- Assert.IsTrue (r.MoveToAttribute ("x:a2"), label + "#19");
- XmlAssert.AssertNode (label + "#20", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Attribute, 1, false,
- // Name, Prefix, LocalName, NamespaceURI
- "x:a2", "x", "a2", "urn:foo",
- // Value, HasValue, AttributeCount, HasAttributes
- "v2", true, 4, true);
- Assert.IsTrue (r.ReadAttributeValue (), label + "#21");
- XmlAssert.AssertNode (label + "#22", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Text, 2, false,
- // Name, Prefix, LocalName, NamespaceURI
- String.Empty, String.Empty, String.Empty, String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- "v2", true, 4, true);
- Assert.IsTrue (r.MoveToElement (), label + "#24");
- Assert.IsTrue (r.Read (), label + "#25");
- XmlAssert.AssertNode (label + "#26", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.EndElement, 0, false,
- // Name, Prefix, LocalName, NamespaceURI
- "root", String.Empty, "root", "urn:default",
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- Assert.IsFalse (r.Read (), label + "#27");
- }
- [Test]
- public void MixedContentAndDepth ()
- {
- string xml = @"<one> <two>Some data.<three>more</three> done.</two> </one>";
- nav = GetXmlDocumentNavigator (xml);
- MixedContentAndDepth (nav, "#1.");
- nav.MoveToRoot ();
- nav.MoveToFirstChild ();
- MixedContentAndDepth (nav, "#2.");
- nav = GetXPathDocumentNavigator (document);
- MixedContentAndDepth (nav, "#3.");
- nav.MoveToRoot ();
- nav.MoveToFirstChild ();
- MixedContentAndDepth (nav, "#4.");
- }
- void MixedContentAndDepth (XPathNavigator nav, string label)
- {
- XmlReader r = nav.ReadSubtree ();
- r.Read ();
- XmlAssert.AssertNode (label + "#1", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Element, 0, false,
- // Name, Prefix, LocalName, NamespaceURI
- "one", String.Empty, "one", String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- r.Read ();
- XmlAssert.AssertNode (label + "#2", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Element, 1, false,
- // Name, Prefix, LocalName, NamespaceURI
- "two", String.Empty, "two", String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- r.Read ();
- XmlAssert.AssertNode (label + "#3", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Text, 2, false,
- // Name, Prefix, LocalName, NamespaceURI
- String.Empty, String.Empty, String.Empty, String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- "Some data.", true, 0, false);
- r.Read ();
- XmlAssert.AssertNode (label + "#4", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Element, 2, false,
- // Name, Prefix, LocalName, NamespaceURI
- "three", String.Empty, "three", String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- r.Read ();
- XmlAssert.AssertNode (label + "#5", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Text, 3, false,
- // Name, Prefix, LocalName, NamespaceURI
- String.Empty, String.Empty, String.Empty, String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- "more", true, 0, false);
- r.Read ();
- XmlAssert.AssertNode (label + "#6", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.EndElement, 2, false,
- // Name, Prefix, LocalName, NamespaceURI
- "three", String.Empty, "three", String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- r.Read ();
- XmlAssert.AssertNode (label + "#7", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.Text, 2, false,
- // Name, Prefix, LocalName, NamespaceURI
- String.Empty, String.Empty, String.Empty, String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- " done.", true, 0, false);
- r.Read ();
- XmlAssert.AssertNode (label + "#8", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.EndElement, 1, false,
- // Name, Prefix, LocalName, NamespaceURI
- "two", String.Empty, "two", String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- r.Read ();
- XmlAssert.AssertNode (label + "#9", r,
- // NodeType, Depth, IsEmptyElement
- XmlNodeType.EndElement, 0, false,
- // Name, Prefix, LocalName, NamespaceURI
- "one", String.Empty, "one", String.Empty,
- // Value, HasValue, AttributeCount, HasAttributes
- String.Empty, false, 0, false);
- Assert.IsFalse (r.Read (), label + "#10");
- }
- [Test]
- public void MoveToFirstAttributeFromAttribute ()
- {
- string xml = @"<one xmlns:foo='urn:foo' a='v' />";
- nav = GetXmlDocumentNavigator (xml);
- MoveToFirstAttributeFromAttribute (nav, "#1.");
- nav.MoveToRoot ();
- nav.MoveToFirstChild ();
- MoveToFirstAttributeFromAttribute (nav, "#2.");
- nav = GetXPathDocumentNavigator (document);
- MoveToFirstAttributeFromAttribute (nav, "#3.");
- nav.MoveToRoot ();
- nav.MoveToFirstChild ();
- MoveToFirstAttributeFromAttribute (nav, "#4.");
- }
- void MoveToFirstAttributeFromAttribute (XPathNavigator nav, string label)
- {
- XmlReader r = nav.ReadSubtree ();
- r.MoveToContent ();
- Assert.IsTrue (r.MoveToFirstAttribute (), label + "#1");
- Assert.IsTrue (r.MoveToFirstAttribute (), label + "#2");
- r.ReadAttributeValue ();
- Assert.IsTrue (r.MoveToFirstAttribute (), label + "#3");
- Assert.IsTrue (r.MoveToNextAttribute (), label + "#4");
- Assert.IsTrue (r.MoveToFirstAttribute (), label + "#5");
- }
- }
- }
- #endif
|