Open alexandru opened 2 years ago
We have an XML with an xs:choice that has only one element in it, like this:
xs:choice
<xs:complexType name="CreditorReferenceType1Choice"> <xs:sequence> <xs:choice> <xs:element name="Cd" type="DocumentType3Code"/> </xs:choice> </xs:sequence> </xs:complexType>
Unfortunately Scalaxb is throwing a compilation error on the generated code:
[error] .../target/scala-2.13/src_managed/main/sbt-scalaxb/.../generated/xmlprotocol.scala:3841:106: type mismatch; [error] DataRecord[String|DocumentType3Code] [error] ...generated.pacs28v1.CreditorReferenceType1Choice(p1) })
To fix it we just have to delete the choice declaration:
<xs:complexType name="CreditorReferenceType1Choice"> <xs:sequence> <xs:element name="Cd" type="DocumentType3Code"/> </xs:sequence> </xs:complexType>
But it would be nice if Scalaxb did this for us, as we'd like to use these XSDs without modification. This is a modified standard schema, originally that type had 2 choices, I guess the authors just deleted one of them 🤷♂️
choice element can also has not options as next
<xs:choice/>
I thinks we should not fail in this case.
We have an XML with an
xs:choice
that has only one element in it, like this:Unfortunately Scalaxb is throwing a compilation error on the generated code:
To fix it we just have to delete the choice declaration:
But it would be nice if Scalaxb did this for us, as we'd like to use these XSDs without modification. This is a modified standard schema, originally that type had 2 choices, I guess the authors just deleted one of them 🤷♂️