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

wtr

Glossary Item Box

Writes the modified document in it's original formatting

Syntax

Visual Basic (Declaration) 
Public Overridable Sub WriteUnformatted( _
   ByVal wtr As TextWriter _
) 
C# 
public virtual void WriteUnformatted( 
   TextWriter wtr
)

Parameters

wtr

Example

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 &amp; &lt;Encoded&gt; Text<!-- This is just a <simple> comment. --></root>", sw.ToString());
VB.NETCopy 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 &amp; &lt;Encoded&gt; Text<!-- This is just a <simple> comment. --></root>", sw.ToString())

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys