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

wtr

Glossary Item Box

Writes the re-constructed innerHTML in a well-formed Xml format

Syntax

Visual Basic (Declaration) 
Public Overloads Sub WriteXml( _
   ByVal wtr As TextWriter _
) 
C# 
public void WriteXml( 
   TextWriter wtr
)

Parameters

wtr

Example

Library/Library.Test/TestHtmlParser.cs

C#Copy Code
XmlLightDocument doc = new HtmlLightDocument(document);
XmlLightDocument doc2;
using (TempFile t = new TempFile())
{
    using (TextWriter tw = new StreamWriter(t.Open()))
        doc.WriteXml(tw);
    new XhtmlValidation(XhtmlDTDSpecification.XhtmlTransitional_10).Validate(t.TempPath);
    doc2 = new XmlLightDocument(t.ReadAllText());

    Assert.AreEqual(doc.InnerXml, doc2.InnerXml);
}
VB.NETCopy Code
Dim doc As XmlLightDocument = New HtmlLightDocument(document)
Dim doc2 As XmlLightDocument
Using t As New TempFile()
    Using tw As TextWriter = New StreamWriter(t.Open())
        doc.WriteXml(tw)
    End Using
    New XhtmlValidation(XhtmlDTDSpecification.XhtmlTransitional_10).Validate(t.TempPath)
    doc2 = New XmlLightDocument(t.ReadAllText())

    Assert.AreEqual(doc.InnerXml, doc2.InnerXml)
End Using

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys