You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<xs:complexTypename="part-list">
<xs:annotation>
<xs:documentation>The part-list identifies the different musical parts in this document. Each part has an ID that is used later within the musical data. Since parts may be encoded separately and combined later, identification elements are present at both the score and score-part levels. There must be at least one score-part, combined as desired with part-group elements that indicate braces and brackets. Parts are ordered from top to bottom in a score based on the order in which they appear in the part-list.</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:groupref="part-group"minOccurs="0"maxOccurs="unbounded"/>
<xs:groupref="score-part"/>
<xs:choiceminOccurs="0"maxOccurs="unbounded">
<xs:groupref="part-group"/>
<xs:groupref="score-part"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
I used command arguments-o out/ --collectionSettersMode=Public --nc --nu -n "=MusicXml" <pathto>/musicxml.xsd.
This generated collections Part_Group and Part_Group_2, which throws this when trying to deserialize:
...
---> System.InvalidOperationException: There was an error reflecting property 'Part_Group_2'.
---> System.InvalidOperationException: The XML element 'part-group' from namespace '' is already present in the current scope. Use XML attributes to specify another XML name or namespace for the element.
at System.Xml.Serialization.XmlReflectionImporter.AddUniqueAccessor(INameScope scope, Accessor accessor)
at System.Xml.Serialization.XmlReflectionImporter.AddUniqueAccessor(MemberMapping member, INameScope elements, INameScope attributes, Boolean isSequence)
at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter)
--- End of inner exception stack trace ---
...
This does indeed occur because of the way choice elements are supported. See here: https://github.com/mganss/XmlSchemaClassGenerator#choice-elements
I've created a workaround for these cases where multiple properties would be generated for the same element. This is in 2.0.662. Feel free to reopen or create a new issue if you still encounter problems.
This is part of musicxml.xsd from here:
I used command arguments
-o out/ --collectionSettersMode=Public --nc --nu -n "=MusicXml" <pathto>/musicxml.xsd
.This generated collections
Part_Group
andPart_Group_2
, which throws this when trying to deserialize:using
I'm rather new to this so I have no idea how to resolve this problem.
The text was updated successfully, but these errors were encountered: