Sle*_*ith 5 c# xml xsd xsd.exe xbrl
好的。我正在尝试从以下位置生成 c# 类:http : //www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd ://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>
Run Code Online (Sandbox Code Playgroud)
序列的生成属性如下所示:
[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;
}
}
Run Code Online (Sandbox Code Playgroud)
基本上不生成元组和项目抽象基类。因此,即使其他模式具有替换组 =“元组”,我也无法将其放入。(好吧,我可以,但它不会序列化)。
Xsd.exe 无法处理 W3C XSD 标准中的一些更复杂的结构。因此,您可能需要寻找第三方数据绑定产品。
可以在这里找到产品列表(但它们都有点过时了)
我们使用Liquid XML Data Binder取得了良好的效果。