【问题标题】:Xsd.exe generating unusable code with SubstitutionGroup/anytypeXsd.exe 使用 SubstitutionGroup/anytype 生成不可用的代码
【发布时间】:2013-04-12 10:29:10
【问题描述】:

好的。我正在尝试从以下位置生成 c# 类: http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd (基本上是 xbrl 模式)。

我的元组和项目有问题。

这是 xsd 的样子:

  <element name="tuple" type="anyType" abstract="true">
    <annotation>
      <documentation>
      Abstract tuple element used as head of tuple substitution group
      </documentation>
    </annotation>
  </element>

  <element name="xbrl">
    <annotation>
      <documentation>
      XBRL instance root element.
      </documentation>
    </annotation>
    <complexType>
      <sequence>
        <element ref="link:schemaRef" minOccurs="1" maxOccurs="unbounded" />
        <element ref="link:linkbaseRef" minOccurs="0" maxOccurs="unbounded" />
        <element ref="link:roleRef" minOccurs="0" maxOccurs="unbounded" />
        <element ref="link:arcroleRef" minOccurs="0" maxOccurs="unbounded" />
        <choice minOccurs="0" maxOccurs="unbounded">
          <element ref="xbrli:item"/>
          <element ref="xbrli:tuple"/>
          <element ref="xbrli:context"/>
          <element ref="xbrli:unit"/>
          <element ref="link:footnoteLink"/>
        </choice>
      </sequence>
      <attribute name="id" type="ID" use="optional" />
      <anyAttribute namespace="http://www.w3.org/XML/1998/namespace"
                    processContents="lax" />
    </complexType>
  </element>

序列的生成属性如下所示:

[System.Xml.Serialization.XmlElementAttribute("context", typeof(context))]
[System.Xml.Serialization.XmlElementAttribute("item", typeof(object))]
[System.Xml.Serialization.XmlElementAttribute("tuple", typeof(object))]
[System.Xml.Serialization.XmlElementAttribute("unit", typeof(unit))]
[System.Xml.Serialization.XmlElementAttribute("footnoteLink", typeof(footnoteLink),
                             Namespace="http://www.xbrl.org/2003/linkbase")]
public object[] Items {
  get {
    return this.itemsField;
  }
  set {
    this.itemsField = value;
  }
}

基本上不会生成元组和项抽象基类。因此,即使其他模式具有替代组 =“元组”,我也无法将其放入。(我可以,但它不会序列化)。

【问题讨论】:

    标签: c# xml xsd xsd.exe xbrl


    【解决方案1】:

    Xsd.exe 无法处理 W3C XSD 标准中的一些更复杂的结构。因此,您可能不得不寻找第三方数据绑定产品。

    可以在此处找到产品列表(但它们都有些过时了)

    Liquid XML Data Binder 取得了不错的效果。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-30
      • 1970-01-01
      • 2015-01-20
      • 2010-12-27
      • 2011-11-08
      相关资源
      最近更新 更多