gpt4 book ai didi

java - EAD xsd 生成的 JAXBException

转载 作者:行者123 更新时间:2023-12-04 02:53:14 26 4
gpt4 key购买 nike

  1. 来自那里的 XSD:http://www.loc.gov/ead/ead.xsd
  2. JAXB 命令:xjc ead.xsd -b ead.xjb
  3. ead.xjb :
    < bindings xmlns="http://java.sun.com/xml/ns/jaxb"
    xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    version="2.1" >
    < bindings schemaLocation="ead.xsd" version="1.0">
    < bindings node="//xs:complexType[@name='title']">
    < bindings node=".//xs:attribute[@name='type']">
    < property name="TAttribute"/>
    < /bindings>
    < /bindings>
    < /bindings>
    < /bindings>
  4. 异常
    parsing a schema...
    Exception in thread "main" java.lang.AssertionError: javax.xml.bind.JAXBException

    • with linked exception:
      [com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
      com.sun.xml.bind.api.impl.NameConverter is an interface, and JAXB can't handle interfaces.
      this problem is related to the following location:
      at com.sun.xml.bind.api.impl.NameConverter
      at public com.sun.xml.bind.api.impl.NameConverter com.sun.tools.xjc.reader.xmlschema.bindinfo.BIGlobalBinding.nameConverter
      at com.sun.tools.xjc.reader.xmlschema.bindinfo.BIGlobalBinding
      ]
      at com.sun.tools.xjc.reader.xmlschema.bindinfo.BindInfo.getCustomizationContext(BindInfo.java:356)
      at com.sun.tools.xjc.reader.xmlschema.bindinfo.BindInfo.getCustomizationUnmarshaller(BindInfo.java:362)

有什么问题吗?

最佳答案

你用的是哪个xjc?我建议使用 jdk1.6 内置的 xjc 来生成所需的绑定(bind)。

关于java - EAD xsd 生成的 JAXBException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17173280/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com