【发布时间】:2014-02-08 09:24:04
【问题描述】:
在 MusicXML (http://www.musicxml.com/for-developers/) 上使用 scalaxb 1.1.2 (http://scalaxb.org),我得到了以下 sn-p:
<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>
这会导致非法继承:
trait DefaultGeneratedPartu45listFormat extends scalaxb.ElemNameParser[generated.Partu45list]
with GeneratedPartu45groupGroupFormat
with GeneratedScoreu45partGroupFormat
with GeneratedPartu45groupGroupFormat {
...
}
如你所见,GeneratedPartu45groupGroupFormat 的双重继承会使编译不愉快。
所以我有两个问题:
有没有办法通过将 XSD 更改为 scalaxb 理解的等价物?
有没有办法配置 scalaxb 来处理这个问题 感激不尽?
【问题讨论】:
-
Scalaxb 绝不应该产生不可编译的代码。我看到您通过在 GitHub 上为该项目打开一个问题已经做了正确的事情。 Eugene 提供了一个建议来纠正您的问题。这个问题与您在这里提到的问题不同吗?同时尝试使用 scalaxb 用户组 (groups.google.com/forum/#!forum/scalaxb)。尤金通常与社区中的其他人一样反应迅速。在那里解决问题的机会更高。
-
我还没有为这个问题打开一个问题,因为我认为它是一个复杂的问题(需要修复一个小例子)。我目前有兴趣让 XML 解析器工作,所以我对一些允许我这样做的 XSD hack 感兴趣;)。一旦我来提供一小段触发这个错误的 XML,我肯定会打开一个问题。