xml生成cs文件
2011-12-20 15:47
225 查看
首先
写一个xml文件;
操作:
1、VS2010-----Visual Studio Tools----Visual Studio 命令提示
F: //进入F盘
xsd test.xml //生成xsd文件
xsd /c test.xsd //生成cs类实体
2、实体类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FlightInterAPI.Model.Merchant
{
//
// This source code was auto-generated by xsd, Version=4.0.30319.1.
//
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://flight.17u.com/tc_getmerchatid_request")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "http://flight.17u.com/tc_getmerchatid_request", IsNullable = false,
ElementName = "Message")]
public partial class GetMerchantIdRequest
{
private HeadType headerField;
private MerchantIdReqContentType contentField;
/// <remarks/>
public HeadType Header
{
get
{
return this.headerField;
}
set
{
this.headerField = value;
}
}
/// <remarks/>
public MerchantIdReqContentType Content
{
get
{
return this.contentField;
}
set
{
this.contentField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://flight.17u.com/tc_getmerchatid_request", TypeName = "ContentType")]
public partial class MerchantIdReqContentType
{
//六合一id
private string accountIdField;
public string AccountId
{
get { return accountIdField; }
set { accountIdField = value; }
}
}
}
ElementName = "Message"属性。序列化为xml时节点就是“Message”。
写一个xml文件;
操作:
1、VS2010-----Visual Studio Tools----Visual Studio 命令提示
F: //进入F盘
xsd test.xml //生成xsd文件
xsd /c test.xsd //生成cs类实体
2、实体类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FlightInterAPI.Model.Merchant
{
//
// This source code was auto-generated by xsd, Version=4.0.30319.1.
//
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://flight.17u.com/tc_getmerchatid_request")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "http://flight.17u.com/tc_getmerchatid_request", IsNullable = false,
ElementName = "Message")]
public partial class GetMerchantIdRequest
{
private HeadType headerField;
private MerchantIdReqContentType contentField;
/// <remarks/>
public HeadType Header
{
get
{
return this.headerField;
}
set
{
this.headerField = value;
}
}
/// <remarks/>
public MerchantIdReqContentType Content
{
get
{
return this.contentField;
}
set
{
this.contentField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://flight.17u.com/tc_getmerchatid_request", TypeName = "ContentType")]
public partial class MerchantIdReqContentType
{
//六合一id
private string accountIdField;
public string AccountId
{
get { return accountIdField; }
set { accountIdField = value; }
}
}
}
ElementName = "Message"属性。序列化为xml时节点就是“Message”。
相关文章推荐
- 包含DataSet类的XML架构怎么不自动生成CS文件了?(Fix一个小问题)
- [C#]包含DataSet类的XML架构怎么不自动生成CS文件了(XSD和CS文件不能合并)
- xml、Json生成cs代码文件
- silverlight 生成图表 WCF 解析XML代码.svc.cs 文件
- MyEclipse反向生成XML和JAVA文件
- Java读取一个xml文件并生成相应的类
- Android利用dimens.xml进行适配,使用代码生成不同的dimens.xml文件
- VS 如何自动生成 aspx.designer.cs文件内容(解决"The base class includes the field ''"错误)
- Mybatis 如何自动生成bean dao xml 配置文件 generatorconfig.xml (main()方法自动生成更快捷)
- hibernate数据表逆向生成有xml文件问题
- hibernate tool连接oracle生成pojo和xml文件无法查询表解决办法
- Dom4j解析、生成XML文件
- intellij配置hibernate自动生成hbm.xml文件
- Mybatis根据数据库表自动生成实体类和xml映射文件
- 使用CodeDom来生成.cs文件
- Android程序调试时生成main.out.xml文件,报错: Resource entry main is already defined
- 如何将关系数据库(sql sever2005)中的表结构转化为XML架构进而生成XML文件???
- 生成hbm.xml文件问题
- asp在服务器端获取网页生成的xml文件,并解析
- xml动态文件如何生成