Library/Library.Test/TestHtmlParser.cs
C# | Copy Code |
---|---|
XmlLightElement root = new XmlLightElement(null, "root"); new XmlLightElement(root, "a").Attributes["b"] = "c"; new XmlLightElement(root, XmlLightElement.TEXT).Value = "Normal & <Encoded> Text"; new XmlLightElement(root, XmlLightElement.COMMENT).OriginalTag = "<!-- This is just a <simple> comment. -->"; new XmlLightElement(root, XmlLightElement.CONTROL){ OriginalTag = "<? Hey, that isn't valid !>" }.Remove(); StringWriter sw = new StringWriter(); root.WriteUnformatted(sw); Assert.AreEqual("<root><a b=\"c\"/>Normal & <Encoded> Text<!-- This is just a <simple> comment. --></root>", sw.ToString()); |
VB.NET | Copy Code |
---|---|
Dim root As New XmlLightElement(Nothing, "root") New XmlLightElement(root, "a").Attributes("b") = "c" New XmlLightElement(root, XmlLightElement.TEXT).Value = "Normal & <Encoded> Text" New XmlLightElement(root, XmlLightElement.COMMENT).OriginalTag = "<!-- This is just a <simple> comment. -->" New XmlLightElement(root, XmlLightElement.CONTROL) With { _ Key .OriginalTag = "<? Hey, that isn't valid !>" _ }.Remove() Dim sw As New StringWriter() root.WriteUnformatted(sw) Assert.AreEqual("<root><a b=""c""/>Normal & <Encoded> Text<!-- This is just a <simple> comment. --></root>", sw.ToString()) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
XmlLightElement ClassXmlLightElement Members