Reputation: 91
I am a rookie in using jaxb2. I get this error:"xpath: prefix must resolve to a namespace:xsd" and I have no clue how to fix it. This appen because I have two xsd files that trying to design the same class but in different packages of my java application
<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>
I already tried to run the plugin, but I don't know how to fix the error.
Upvotes: 2
Views: 4129
Reputation: 91
How I fix the problem? Simple! In the name space of my xjb file I was using:
<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: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.
Upvotes: 6