【问题标题】:ct-props-correct error when parsing schema解析模式时 ct-props-纠正错误
【发布时间】:2009-06-24 18:40:48
【问题描述】:

我正在使用 JAXB xjc 工具从 xsds 生成一些 Java 接口文件。我遇到了一个问题,我收到了大量的表单错误:

org.xml.sax.SAXParseException:ct-props-correct.4:“COCT_MT110200CA.PayeeRole”类型错误。指定了具有相同名称和目标命名空间的重复属性使用。重复属性使用的名称是'nullFlavor'。

架构的相关部分如下:

 <xs:complexType name="COCT_MT110200CA.Holder">
  <xs:sequence>
     <xs:group ref="InfrastructureRootElements"/>
     <xs:element name="payeeRole" type="COCT_MT110200CA.PayeeRole" minOccurs="1" maxOccurs="1">
     </xs:element>
  </xs:sequence>
  <xs:attributeGroup ref="InfrastructureRootAttributes"/>
  <xs:attribute name="nullFlavor" type="NullFlavor" use="optional"/>
  <xs:attribute name="typeCode" type="ParticipationType" use="optional" fixed="HLD"/>
</xs:complexType>

其中 COCT_MT110200CA.PayeeRole 定义为:

<xs:complexType name="COCT_MT110200CA.PayeeRole">
  <xs:sequence>
     <xs:group ref="InfrastructureRootElements"/>
     <xs:element name="id" type="II" minOccurs="0" maxOccurs="unbounded">
     </xs:element>
     <xs:choice>
        <xs:element name="payeePerson" type="COCT_MT110200CA.PayeePerson" nillable="true"
                    minOccurs="0"
                    maxOccurs="1">
        </xs:element>
        <xs:element name="payeeOrganization" type="COCT_MT110200CA.PayeeOrganization"
                    nillable="true"
                    minOccurs="0"
                    maxOccurs="1">
        </xs:element>
     </xs:choice>
  </xs:sequence>
  <xs:attributeGroup ref="InfrastructureRootAttributes"/>
  <xs:attribute name="nullFlavor" type="NullFlavor" use="optional"/>
  <xs:attribute name="classCode" type="RoleClass" use="optional" fixed="PAYEE"/>
</xs:complexType>

有什么想法吗?我自己也没觉得有什么问题……

【问题讨论】:

    标签: java xml xsd


    【解决方案1】:

    哦,我想我想通了,那里有一个讨厌的 attributeGroup (InfrastructureRootAttributes),而在那个 attributeGroup 中有 nullFlavor 重复...

    【讨论】:

    • 但是怎么解决这个问题呢?或者你是如何解决这个问题的,你能告诉我吗,因为我也面临同样的错误......请尽快回复
    • 我不记得具体了,已经有一段时间了,但我猜你是从 InfrastructureRootAttributes 中删除了 nullFlavour 属性,因为它是在架构中的其他地方提供的
    猜你喜欢
    • 2021-10-26
    • 2016-05-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多