1

Using scalaxb 1.1.2 (http://scalaxb.org) on MusicXML (http://www.musicxml.com/for-developers/), I got the following snippet:

<xs:complexType name="part-list">
    <xs:sequence>
        <xs:group ref="part-group" minOccurs="0" maxOccurs="unbounded"/>
        <xs:group ref="score-part"/>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:group ref="part-group"/>
            <xs:group ref="score-part"/>
        </xs:choice>
    </xs:sequence>
</xs:complexType>

This leads to a illegal inheritance:

  trait DefaultGeneratedPartu45listFormat extends scalaxb.ElemNameParser[generated.Partu45list] 
    with GeneratedPartu45groupGroupFormat 
    with GeneratedScoreu45partGroupFormat 
    with GeneratedPartu45groupGroupFormat {

    ...    
  }

As you can see, the double inheritance of GeneratedPartu45groupGroupFormat will make the compile unhappy.

So I have two questions:

  1. Is there a way to workaround this issue by changing the XSD to something equivalent that scalaxb understands?

  2. Is there a way to caonfigure scalaxb to handle that issue gratefully?

choeger
  • 3,562
  • 20
  • 33
  • Scalaxb should never produce uncompilable code. I see you've already done the right thing by opening an issue for the project on GitHub. Eugene has offered a suggestion to correct your issue. Is this problem different from the one you've mentioned here? In the meantime try the scalaxb user group (https://groups.google.com/forum/#!forum/scalaxb). Eugene is usually quite responsive along with others in the community. Your chances of resolving your issue are higher there. – joescii Feb 08 '14 at 13:03
  • I did not open an issue for this problem yet, since I expect it to be a complicated one (which requires a small example to be fixed). I am currently interested in getting the XML parser to work, so I was interested in some XSD hack that allows me to do so ;). Once I come to provide a small piece of XML that triggers this bug, I will open an issue for sure. – choeger Feb 08 '14 at 14:31

1 Answers1

1

I am currently interested in getting the XML parser to work, so I was interested in some XSD hack that allows me to do so ;).

Here's a simple substitution you could do to parse the grammar that compiles:

<xs:complexType name="part-list">
  <xs:choice maxOccurs="unbounded">
    <xs:group ref="part-group" />
    <xs:group ref="score-part" />
  </xs:choice>
</xs:complexType>

Once I come to provide a small piece of XML that triggers this bug, I will open an issue for sure.

Here's a quick sample XSD that can reproduce the issue:

<xs:schema targetNamespace="http://www.example.com/music"
        elementFormDefault="qualified"
        xmlns="http://www.example.com/music"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:music="http://www.example.com/music">
  <xs:complexType name="part-list">
      <xs:sequence>
          <xs:group ref="part-group" minOccurs="0" maxOccurs="unbounded"/>
          <xs:group ref="score-part"/>
          <xs:choice minOccurs="0" maxOccurs="unbounded">
              <xs:group ref="part-group"/>
              <xs:group ref="score-part"/>
          </xs:choice>
      </xs:sequence>
  </xs:complexType>

  <xs:group name="part-group">
    <xs:sequence>
      <xs:element name="part" type="xs:string"/>
    </xs:sequence>
  </xs:group>

  <xs:group name="score-part">
    <xs:sequence>
      <xs:element name="score" type="xs:string"/>
    </xs:sequence>
  </xs:group>
</xs:schema>

Please file an issue on Github.

Eugene Yokota
  • 94,654
  • 45
  • 215
  • 319