XmlTextWriter writer = null;writer = new XmlTextWriter (filename, null); //Use indenting for readability writer.Formatting = Formatting.Indented;//Write an element (this one is the root) writer.WriteStartElement("XML");//Write the namespace declarations. writer.WriteAttributeString("xmlns", "x",null,"urn:schemas-microsoft-com:office:excel"); writer.WriteAttributeString("xmlns","dt",null,"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"); writer.WriteAttributeString("xmlns","s",null,"uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"); writer.WriteAttributeString("xmlns","rs",null,"urn:schemas-microsoft-com:rowset"); writer.WriteAttributeString("xmlns","z",null,"#RowsetSchema");//Write the close tag for the root element writer.WriteEndElement();//Write the XML to file and close the writer writer.Flush(); writer.Close(); - 微软全球技术中心 VC技术支持 本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款 (http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。 为了为您创建更好的讨论环境,请参加我们的用户满意度调查 (http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。
//Use indenting for readability
writer.Formatting = Formatting.Indented;//Write an element (this one is the root)
writer.WriteStartElement("XML");//Write the namespace declarations.
writer.WriteAttributeString("xmlns", "x",null,"urn:schemas-microsoft-com:office:excel");
writer.WriteAttributeString("xmlns","dt",null,"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882");
writer.WriteAttributeString("xmlns","s",null,"uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882");
writer.WriteAttributeString("xmlns","rs",null,"urn:schemas-microsoft-com:rowset");
writer.WriteAttributeString("xmlns","z",null,"#RowsetSchema");//Write the close tag for the root element
writer.WriteEndElement();//Write the XML to file and close the writer
writer.Flush();
writer.Close();
- 微软全球技术中心 VC技术支持 本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款
(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
为了为您创建更好的讨论环境,请参加我们的用户满意度调查
(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。