我不知道在你的情况下会发生什么-我把你的代码复制到
enum.xsd
然然
xsd.exe
上面-结果如下:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4016
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Xml.Serialization;
//
// This source code was auto-generated by xsd, Version=2.0.50727.3038.
//
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
public partial class ItemList {
private ItemType[] itemField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Item", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ItemType[] Item {
get {
return this.itemField;
}
set {
this.itemField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class ItemType {
private MarketType marketField;
private CategoryType categoryField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public MarketType Market {
get {
return this.marketField;
}
set {
this.marketField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public CategoryType Category {
get {
return this.categoryField;
}
set {
this.categoryField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
public enum MarketType {
/// <remarks/>
Weak,
/// <remarks/>
Strong,
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
public enum CategoryType {
/// <remarks/>
Mild,
/// <remarks/>
Hot,
}
我肯定有两个枚举
CategoryType
和
MarketType
.
我所做的就是把你的XSD代码放到
<xsl:schema>
标签:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="TheParentNode" xmlns:xs="http://www.w3.org/2001/XMLSchema">
..... (inserted your code here) .......
</xs:schema>
然后我在上面运行xsd.exe:
xsd.exe enum.xsd /c
创造了
enum.cs
文件如上图所示。
您有什么版本的xsd.exe?您使用的是.NET的哪个版本?
马克