我正在尝试使用sbt-scalaxb
来为FixRepository.xsd
生成绑定,它不喜欢SUBJ。
作为最后的选择,我可以稍微更改架构,但是也许有一种方法可以调整sbt-scalaxb
来理解原始文件吗?
sbt-scalaxb
不喜欢的XSD片段是:
xml
<xs:element name="component">
<xs:complexType>
<xs:sequence>
<xs:element ref="messageEntity" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attributeGroup ref="entityAttribGrp"/>
<xs:attribute name="id" type="id_t" use="required"/>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="type" type="ComponentType_t" use="required"/>
<xs:attribute name="repeating" type="BOOL_t" use="optional"/>
<xs:attribute name="category" type="xs:string" use="optional"/>
<xs:attribute name="abbrName" type="xs:string" use="optional"/>
<xs:attribute name="notReqXML" type="BOOL_t" use="optional"/>
<!-- would like to force a description of the component -->
</xs:complexType>
</xs:element>
答案 0 :(得分:0)
弄清楚自己:scalaxbAttributePrefix
设置为属性属性添加了前缀。
scalaxbAttributePrefix in (Compile, scalaxb) := Some("attr")
case class Fix(
...,
components: ...fixrepo.Components,
...,
attributes: Map[String, scalaxb.DataRecord[Any]] = Map()
) {
...
lazy val attrComponents = attributes("@components").as[BOOL_t]
...
}