Converts Xml document to string

Default.aspx :

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" >
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">
        <asp:Literal ID="Literal1" runat="server" Mode="Encode"></asp:Literal></div>

Default.aspx.cs :

using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using System.IO;

public partial class _Default : System.Web.UI.Page 
    protected void Page_Load(object sender, EventArgs e)
        XmlDocument doc = new XmlDocument();
        #region just to remind myself something
        XmlNode node = doc.CreateElement("serkan");
        StringWriter sw = new StringWriter();
        XmlTextWriter tx = new XmlTextWriter(sw);
        // i use literal control because when you set its mode to "encode", you can write xml tags to browser window as they are
        Literal1.Text = sw.ToString();
The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.