CSharpTest.Net
PrevSibling Property
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Html Namespace > XmlLightElement Class : PrevSibling Property

Glossary Item Box

Returns the previous sibling element

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property PrevSibling As XmlLightElement
C# 
public XmlLightElement PrevSibling {get;}

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.NETCopy 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

Generated with Document! X 2011 by Innovasys