Create Default XML Writer - CSharp System.Xml

CSharp examples for System.Xml:XML Writer

Description

Create Default XML Writer

Demo Code

/*/* w  ww  .java 2 s  . co  m*/
* Copyright (c) 2005 Poderosa Project, All Rights Reserved.
* $Id: XMLUtil.cs,v 1.2 2005/04/20 08:45:48 okajima Exp $
*/
using System.Text;
using System.Xml;
using System.Collections;
using System;

public class Main{
        public static XmlWriter CreateDefaultWriter(string filename) {
         XmlTextWriter wr = new XmlTextWriter(filename, Encoding.Default);
         wr.Formatting = Formatting.Indented;
         wr.Indentation = 2;
         wr.IndentChar = ' ';
         wr.Namespaces = true;
         wr.WriteStartDocument(); //XML PI
         return wr;
      }
}

Related Tutorials