Код: Выделить всё
Код: Выделить всё
XmlSchemaClassGenerator.Console.exe test.xsd -o Output -n Order --ns=Direct --collectionType='System.Collections.Generic.List`1'
Код: Выделить всё
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
// This code was generated by XmlSchemaClassGenerator version 2.1.1164.0
namespace Order
{
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1164.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("SaleType", Namespace="")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SaleType : IanyAttribute
{
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1164.0")]
public partial interface IanyAttribute
{
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1164.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("OrderType", Namespace="")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class OrderType
{
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.Generic.List _anyAttribute;
[System.Xml.Serialization.XmlAnyAttributeAttribute()]
public System.Collections.Generic.List AnyAttribute
{
get
{
return _anyAttribute;
}
private set
{
_anyAttribute = value;
}
}
///
///
Gets a value indicating whether the AnyAttribute collection is empty.
///
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool AnyAttributeSpecified
{
get
{
return (this.AnyAttribute.Count != 0);
}
}
///
/// Initializes a new instance of the class.
///
public OrderType()
{
this._anyAttribute = new System.Collections.Generic.List();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1164.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("PurchaseType", Namespace="")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class PurchaseType : IanyAttribute
{
///
/// Gets or sets the text value.
///
[System.Xml.Serialization.XmlTextAttribute()]
public string Value { get; set; }
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.Generic.List _anyAttribute;
[System.Xml.Serialization.XmlAnyAttributeAttribute()]
public System.Collections.Generic.List AnyAttribute
{
get
{
return _anyAttribute;
}
private set
{
_anyAttribute = value;
}
}
///
/// Gets a value indicating whether the AnyAttribute collection is empty.
///
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool AnyAttributeSpecified
{
get
{
return (this.AnyAttribute.Count != 0);
}
}
///
/// Initializes a new instance of the class.
///
public PurchaseType()
{
this._anyAttribute = new System.Collections.Generic.List();
}
}
}
- : с группой атрибутов, содержащей любой атрибут
Код: Выделить всё
SaleType - : AnyAttribute добавляется напрямую без группы атрибутов.
Код: Выделить всё
OrderType - : группа атрибутов заключена в простой контент.
Код: Выделить всё
PurchaseType
Файл, который я получаю, имеет несколько вариантов SaleType и PurchaseType.
Итак, что я хочу знать, почему это происходит и как это исправить?
В качестве обходного пути я мог бы сам отредактировать файл xsd и заменить атрибутGroup в SaleType с помощью AnyAttribute, как я сделал с OrderType, хотя я хочу знать, есть ли лучший способ. Кроме того, существует еще много xsd, поэтому это будет хлопотно, особенно если я получу новую версию, поэтому я хотел бы избежать этого, если это возможно.
Мне также не совсем понятно, почему это работает с PurchaseType.
Может быть, есть другой инструмент, который лучше справится с этими вещами?
Подробнее здесь: https://stackoverflow.com/questions/791 ... ributegrou
Мобильная версия