- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在让 JAXB 绑定(bind)文件与 annox 和 SCD 元素选择一起使用时遇到困难。该模式是一个简单的基本模式,具有名为 SongType 的 ComplexType。我尝试了正常的方法做如下的事情,一切都很顺利,类被命名为 Song 而不是 SongType 并且还有 Deprecated 注释。
<jaxb:bindings node="/xsd:schema" schemaLocation="example.xsd">
<jaxb:bindings node="xsd:complexType[@name='SongType']">
<jaxb:class name="Song"/>
<annox:annotateClass>
<annox:annotate annox:class="java.lang.Deprecated"/>
</annox:annotateClass>
</jaxb:bindings>
</jaxb:bindings>
但是当我尝试对 jaxb scd 引用执行相同操作时,XJC 只是失败并出现 xerces 异常,提示它不知道存在的 annox 元素。谁能对这里的问题提出建议?
<jaxb:bindings scd="x-schema::tns" xmlns:tns="http://www.fleurida.com/blueprint">
<jaxb:bindings scd="~tns:SongType">
<jaxb:class name="Song"/>
<annox:annotateClass>
<annox:annotate annox:class="java.lang.Deprecated"/>
</annox:annotateClass>
</jaxb:bindings>
</jaxb:bindings>
错误跟踪:
[INFO] Parsing input schema(s)...[ERROR] Error while parsing schema(s).Location [ file:/dev/oss/jaxb-scd-annox-problem/src/main/resources/scd.annox.jaxb.xml{8,25}].org.xml.sax.SAXParseException; systemId: file:/dev/oss/jaxb-scd-annox-problem/src/main/resources/scd.annox.jaxb.xml; lineNumber: 8; columnNumber: 25; cvc-elt.1: Cannot find the declaration of element 'annox:annotateClass'. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1906) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:746) at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:570) at com.sun.tools.xjc.util.ForkContentHandler.startElement(ForkContentHandler.java:114) at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:551) at com.sun.tools.xjc.reader.internalizer.DOMForestScanner$LocationResolver.startElement(DOMForestScanner.java:147) at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:244) at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:127) at com.sun.tools.xjc.reader.internalizer.DOMForestScanner.scan(DOMForestScanner.java:92) at com.sun.tools.xjc.reader.internalizer.SCDBasedBindingSet$Target.apply(SCDBasedBindingSet.java:184) at com.sun.tools.xjc.reader.internalizer.SCDBasedBindingSet$Target.applyAll(SCDBasedBindingSet.java:142) at com.sun.tools.xjc.reader.internalizer.SCDBasedBindingSet$Target.apply(SCDBasedBindingSet.java:163) at com.sun.tools.xjc.reader.internalizer.SCDBasedBindingSet$Target.applyAll(SCDBasedBindingSet.java:142) at com.sun.tools.xjc.reader.internalizer.SCDBasedBindingSet$Target.access$700(SCDBasedBindingSet.java:86) at com.sun.tools.xjc.reader.internalizer.SCDBasedBindingSet.apply(SCDBasedBindingSet.java:241) at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:541) at com.sun.tools.xjc.ModelLoader.loadXMLSchema(ModelLoader.java:378) at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:174) at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:119) at org.jvnet.mjiip.v_2_2.XJC22Mojo.loadModel(XJC22Mojo.java:58) at org.jvnet.mjiip.v_2_2.XJC22Mojo.doExecute(XJC22Mojo.java:44) at org.jvnet.mjiip.v_2_2.XJC22Mojo.doExecute(XJC22Mojo.java:29) at org.jvnet.jaxb2.maven2.RawXJC2Mojo.doExecute(RawXJC2Mojo.java:364) at org.jvnet.jaxb2.maven2.RawXJC2Mojo.execute(RawXJC2Mojo.java:161) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213) at org.apache.maven.cli.MavenCli.main(MavenCli.java:157) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
github 上的完整记录且可运行的示例
最佳答案
这是由于 XJC 中的问题造成的,据报道 here .
简而言之,Annox 使用供应商扩展(即特殊配置元素,如 annox:annotate
),目前基于 SCD 的绑定(bind)不支持这些扩展。
不幸的是,我不相信这个问题会很快得到解决。请改用 node
Bindigs。
顺便说一句,我也将 Annox 移至 GitHub:
您现在可以使用 Java 语法进行注释:
<xsd:complexType name="FooType">
<xsd:annotation>
<xsd:appinfo>
<annox:annotate>@java.lang.SuppressWarnings({"unchecked","rawtypes"})</annox:annotate>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence> ...</xsd:sequence>
</xsd:complexType>
关于java - JAXB SCD 无法与 annox 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23570003/
我在用于 jaxb 生成的 annox 插件上收到以下错误 [ERROR] file:/Users/dhiller/Space/ifp-core/framework/src/main/resource
我在 JAXB 生成的类中有以下注释 @XmlType(name = "MessageInfoType", propOrder = { "debugTraceBoolean", "cl
我在让 JAXB 绑定(bind)文件与 annox 和 SCD 元素选择一起使用时遇到困难。该模式是一个简单的基本模式,具有名为 SongType 的 ComplexType。我尝试了正常的方法做如
我对注释的使用场景有点困惑,我希望得到您的意见。 给定以下注释(与 ExistingCustomerValidator 类在同一项目中定义)包 com.tktserver.constraints; @
我正在尝试通过 hyperjaxb 运行一个真实的模式。我已经使用 jaxb 反复测试了模式,并且 jaxb 每次都正确地导入了模式。但是,当我尝试让 hyperjaxb 从同一模式生成带 hiber
当我将 jxb:class 与 annox:annotate 一起使用时,出现此异常: com.sun.istack.SAXParseException2; systemId: file:/usr/w
我正在尝试使用 jaxb2 maven 插件从 xsd 生成 Java 类。 生成类时出现以下异常: SAXParseException Binding declaration namespace "
我是一名优秀的程序员,十分优秀!