System.Xml.XPath.XPathNavigator.MoveToNext C# (CSharp) Method

MoveToNext() public abstract method

public abstract MoveToNext ( ) : bool
return bool
        public abstract bool MoveToNext();

Same methods

XPathNavigator::MoveToNext ( XPathNodeType type ) : bool
XPathNavigator::MoveToNext ( string localName, string namespaceURI ) : bool

Usage Example

Example #1
0
        [Test] //ExSkip
        public void NodeXPathNavigator()
        {
            // Create a blank document
            Document doc = new Document();

            // A document is a composite node so we can make a navigator straight away
            System.Xml.XPath.XPathNavigator navigator = doc.CreateNavigator();

            // Our root is the document node with 1 child, which is the first section
            Assert.AreEqual("Document", navigator.Name);
            Assert.AreEqual(false, navigator.MoveToNext());
            Assert.AreEqual(1, navigator.SelectChildren(XPathNodeType.All).Count);

            // The document tree has the document, first section, body and first paragraph as nodes, with each being an only child of the previous
            // We can add a few more to give the tree some branches for the navigator to traverse
            DocumentBuilder docBuilder = new DocumentBuilder(doc);

            docBuilder.Write("Section 1, Paragraph 1. ");
            docBuilder.InsertParagraph();
            docBuilder.Write("Section 1, Paragraph 2. ");
            doc.AppendChild(new Section(doc));
            docBuilder.MoveToSection(1);
            docBuilder.Write("Section 2, Paragraph 1. ");

            // Use our navigator to print a map of all the nodes in the document to the console
            StringBuilder stringBuilder = new StringBuilder();

            MapDocument(navigator, stringBuilder, 0);
            Console.Write(stringBuilder.ToString());
        }
All Usage Examples Of System.Xml.XPath.XPathNavigator::MoveToNext