用XmlSerializer删除xsd和xsi前缀
来源:互联网 发布:linux手游服务器搭建 编辑:程序博客网 时间:2024/05/22 11:39
The easiest way to do this is to use an overload of the Serialize method.
-- StringWriter sw=new StringWriter();
XmlTextWriter tw=new XmlTextWriter(sw);
XmlSerializerNamespcace xsn=new XmlSerializerNamespaces();
xsn.Add(String.Empty,String.Empty);
XmlSerializer serializer=new XmlSerializer(typeof(MyObject));
serializer.Serializer(tw,myObject,xsn);
According to Reflector,the main Serialize method checks if the XmlSerializerNamespace instance is null or has a zero length.If either are true,it uses a default XmlSerializerNampspaces instance which includes the xsd and xsi namespaces.
Happy programming~
from:http://www.cnblogs.com/linhengboy/archive/2005/04/10/135013.html
--------------------------------------------------------------------------------------
另一篇文章http://www.cnblogs.com/Gildor/archive/2010/03/03/1676860.html
- 用XmlSerializer删除xsd和xsi前缀
- xsi xsd
- 在XML序列化时去除默认命名空间xmlns:xsd和xmlns:xsi
- 在XML序列化时去除默认命名空间xmlns:xsd和xmlns:xsi
- 在XML序列化时去除默认命名空间xmlns:xsd和xmlns:xsi
- xml文件参照XSD时开始部分中的xmlns:和xsi:schemaLocation
- XML中xsd,xsi的解释
- 用JDOM创建XML完整实例(包括定义xmlns:xsi和xsi:type)
- 每日学习心得:未定义的命名空间前缀"xsd"问题和<%%>、<%=%>、<%$%>、<%@%>的区别
- shell批量添加和删除前缀
- XSI
- XSI
- sharepoint 未定义的命名空间前缀 "xsd"
- POSIX标准和XSI扩展
- POSIX标准和XSI扩展
- POSIX标准和XSI扩展
- 关于XML文档的xmlns、xmlns:xsi和xsi:schemaLocation
- 关于XML文档的xmlns、xmlns:xsi和xsi:schemaLocation
- 设计模式之 简单工厂模式
- [教程] HTC Incredible S新手教程之:手机刷机前需要知道的一些基础知识
- android 使用系统的 search
- xsd验证允许空值
- WebService生成XML文档时出错。不应是类型XXXX。使用XmlInclude或SoapInclude属性静态指定非已知的类型。
- 用XmlSerializer删除xsd和xsi前缀
- VC6+DDK编译环境配置
- spring 入门
- Difference between release and dealloc in objective-c
- 第十章 jdbc中的数据类型与日期问题
- ios 深浅拷贝学习
- 我害怕了吗?
- myeclipse恢复删除的文件
- 第十一章 用jdbc访问大段文本数据