CSharpTest.Net
Root Field
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Html Namespace > XmlLightDocument Class : Root Field

Glossary Item Box

Returns the root element

Syntax

Visual Basic (Declaration) 
Public Root As XmlLightElement
C# 
public XmlLightElement Root

Example

Library/Library.Test/TestHtmlParser.cs

C#Copy Code
string xml = "<root id='a'></root>";
XmlLightDocument doc = new XmlLightDocument(xml);
Assert.AreEqual("root", doc.Root.LocalName);
Assert.AreEqual(1, doc.Root.Attributes.Count);
Assert.IsTrue(doc.Root.Attributes.GetEnumerator().MoveNext());
Assert.IsTrue(((System.Collections.IEnumerable)doc.Root.Attributes).GetEnumerator().MoveNext());
Assert.IsTrue(doc.Root.Attributes.Remove("id"));
Assert.AreEqual(0, doc.Root.Attributes.Count);
VB.NETCopy Code
Dim xml As String = "<root id='a'></root>"
Dim doc As New XmlLightDocument(xml)
Assert.AreEqual("root", doc.Root.LocalName)
Assert.AreEqual(1, doc.Root.Attributes.Count)
Assert.IsTrue(doc.Root.Attributes.GetEnumerator().MoveNext())
Assert.IsTrue((DirectCast(doc.Root.Attributes, System.Collections.IEnumerable)).GetEnumerator().MoveNext())
Assert.IsTrue(doc.Root.Attributes.Remove("id"))
Assert.AreEqual(0, doc.Root.Attributes.Count)

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys