welcome to Qijie's Blog 薛其杰
        static void CreateXML(string outputPath)
        {
            XmlDocument _xmlDoc = new XmlDocument();
            string _xmlNode = @"<books type='ITP' language='english'><metadata></metadata></books>";
            _xmlDoc.LoadXml(_xmlNode);
            XmlDeclaration _xmlDeclar = _xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", "no");
            XmlElement _root = _xmlDoc.DocumentElement;
            _xmlDoc.InsertBefore(_xmlDeclar, _root);
            if (!string.IsNullOrWhiteSpace(outputPath))
            {
                _xmlDoc.Save(outputPath);
            }
        }

 

 

文档预览

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<books type="ITP" language="english">
<metadata>
</metadata>
</books>

 

posted on 2014-06-18 12:34  零点零一  阅读(157)  评论(0)    收藏  举报