Returns the previous sibling element
Syntax
Visual Basic (Declaration) | |
---|
Public ReadOnly Property PrevSibling As XmlLightElement |
Example
Library/Library.Test/TestHtmlParser.cs
C# | Copy Code |
---|
XmlLightDocument doc = new HtmlLightDocument(document);
Assert.IsNull(doc.PrevSibling);
Assert.IsNull(doc.Children[0].PrevSibling);
Assert.IsNull(doc.NextSibling);
Assert.IsNull(doc.Children[doc.Children.Count - 1].NextSibling);
XmlLightElement e = doc.SelectSingleNode("/html/body//*[@class='2']");
Assert.IsNotNull(e);
Assert.AreEqual("p", e.TagName);
Assert.IsNotNull(e.PrevSibling);
Assert.AreEqual("p", e.PrevSibling.TagName);
Assert.AreEqual("", e.Namespace);
Assert.AreEqual("p", e.LocalName);
e = new XmlLightElement(null, "a:b");
Assert.AreEqual("a", e.Namespace);
Assert.AreEqual("b", e.LocalName); |
VB.NET | Copy Code |
---|
Dim doc As XmlLightDocument = New HtmlLightDocument(document)
Assert.IsNull(doc.PrevSibling)
Assert.IsNull(doc.Children(0).PrevSibling)
Assert.IsNull(doc.NextSibling)
Assert.IsNull(doc.Children(doc.Children.Count - 1).NextSibling)
Dim e As XmlLightElement = doc.SelectSingleNode("/html/body//*[@class='2']")
Assert.IsNotNull(e)
Assert.AreEqual("p", e.TagName)
Assert.IsNotNull(e.PrevSibling)
Assert.AreEqual("p", e.PrevSibling.TagName)
Assert.AreEqual("", e.[Namespace])
Assert.AreEqual("p", e.LocalName)
e = New XmlLightElement(Nothing, "a:b")
Assert.AreEqual("a", e.[Namespace])
Assert.AreEqual("b", e.LocalName) |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also