Xsd.exe generates unused code with SubstitutionGroup / anytype

Ok I am trying to create C # classes from: http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd (The xbrl schema is mostly).

I have a problem with a tuple and element.

Here is what xsd looks like:

<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> 

And the generated property for the sequence is as follows:

 [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; } } 

In principle, the base class of an abstract set of elements and elements is not generated. So even when the other scheme has substitutiongroup = "tuple", I cannot insert it. (Well, I can, but it will not be serialized).

+4
source share
1 answer

Xsd.exe cannot handle some of the more complex W3C XSD standard designs. Thus, you may have to turn to a third-party data binding product.

The list of products can be found here (but they are both a little outdated)

We had good results with Liquid XML Data Binder .

0
source

All Articles