Returns the root element
Syntax
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.NET | Copy 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