java - xpath:前缀必须解析为命名空间:xsd
问题描述
我是使用 jaxb2 的新手。我收到此错误:“xpath:前缀必须解析为命名空间:xsd”,我不知道如何修复它。这是因为我有两个 xsd 文件试图设计同一个类但在我的 java 应用程序的不同包中
<jxb:bindings schemaLocation="../documentazione/xsd/Global/datatypes_global_v62.xsd">
<jxb:schemaBindings>
<jxb:package name="com.companyname.plugin.entities.global" />
</jxb:schemaBindings>
<jxb:bindings node="//xsd:complexType[@name='Contact']">
<jxb:class name="GlobalContact" />
</jxb:bindings>
</jxb:bindings>
<jxb:bindings schemaLocation="../documentazione/xsd/Global/pickupdatatypes_global-3.0.xsd">
<jxb:schemaBindings>
<jxb:package name="com.companyname.plugin.entities.pickup" />
</jxb:schemaBindings>
<jxb:bindings node="xsd://complexType[@name='contact']" >
<jxb:class name="Contact" />
</jxb:bindings>
</jxb:bindings>
我已经尝试运行该插件,但我不知道如何修复该错误。
解决方案
我如何解决问题?简单的!在我使用的 xjb 文件的名称空间中:
xmlns:xs="http://www.w3.org/2000/10/XMLSchema-instance"
xs:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd">```
And this was fine for most of my xjb files, but in my case I want to use complexType node. In this case I have to use:
```<jxb:bindings version="2.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xs="http://www.w3.org/2000/10/XMLSchema-instance"
xs:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd">```
the `xmlns:xsd="http://www.w3.org/2001/XMLSchema` help me to fix all my issue.
推荐阅读
- docker - 为什么 docker build 即使在我设置了时区后仍然询问我时区?
- html - 新页面未呈现 | 不能获取/
- macos - 在 macOS 上断开 Wifi 机场后重新连接?
- python - 如何将 NaN 转换为我的原始数据?
- ios - 如何在 SwiftUI 中制作无限的自定义轮子
- python - Python:检查时间是否在 1600-0900 之间
- python - 使用带有小时偏移量的 Pandas 日期时间对象转换时区
- firebase - forEach 访问 Firestore 文档
- c++ - 如何在opengl中更改圆柱体的颜色?
- mysql - SSIS 不理解何时在 MySQL 上完成 SP