Returns a new System.Xml.XPath.XPathNavigator object.
Syntax
Visual Basic (Declaration) | |
---|
Public Function CreateNavigator() As XPathNavigator |
Example
Library/Library.Test/TestHtmlParser.cs
C# | Copy Code |
---|
XPathNavigator nav = new HtmlLightDocument(document).CreateNavigator().SelectSingleNode("/html/body//p[@class='1']");
XPathNavigator pos = nav.Clone();
Assert.IsFalse(nav.MoveToPrevious());
Assert.IsTrue(nav.MoveToNext());
Assert.IsTrue(nav.MoveToPrevious());
Assert.IsTrue(nav.IsSamePosition(pos));
Assert.IsFalse(nav.MoveToFirstNamespace());
Assert.IsFalse(nav.MoveToNextNamespace());
Assert.IsTrue(Object.ReferenceEquals(nav.NameTable, pos.NameTable));
Assert.IsNotNull(nav.BaseURI);
Assert.AreEqual(nav.BaseURI, pos.BaseURI);
Assert.IsTrue(nav.MoveToId("one"));
Assert.AreEqual("body", nav.Name);
Assert.IsFalse(nav.MoveToId("none-exists"));
Assert.AreEqual("body", nav.Name); |
VB.NET | Copy Code |
---|
Dim nav As XPathNavigator = New HtmlLightDocument(document).CreateNavigator().SelectSingleNode("/html/body//p[@class='1']")
Dim pos As XPathNavigator = nav.Clone()
Assert.IsFalse(nav.MoveToPrevious())
Assert.IsTrue(nav.MoveToNext())
Assert.IsTrue(nav.MoveToPrevious())
Assert.IsTrue(nav.IsSamePosition(pos))
Assert.IsFalse(nav.MoveToFirstNamespace())
Assert.IsFalse(nav.MoveToNextNamespace())
Assert.IsTrue([Object].ReferenceEquals(nav.NameTable, pos.NameTable))
Assert.IsNotNull(nav.BaseURI)
Assert.AreEqual(nav.BaseURI, pos.BaseURI)
Assert.IsTrue(nav.MoveToId("one"))
Assert.AreEqual("body", nav.Name)
Assert.IsFalse(nav.MoveToId("none-exists"))
Assert.AreEqual("body", nav.Name) |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also