Reputation: 1009
I'm trying to generate Java code from the *.xsd files delivered by EurID.
Currently I'm receiving several exceptions:
Error while parsing schema(s).Location [ file:~/src/main/resources/epp-1.0.xsd{375,32}].
org.xml.sax.SAXParseException; systemId: file:~/src/main/resources/epp-1.0.xsd; lineNumber: 375; columnNumber: 32; src-resolve: Cannot resolve the name 'eppcom:minTokenType' to a(n) 'type definition' component.
[ERROR] Error while parsing schema(s).Location [ file:~/src/main/resources/nsgroup-1.0.xsd{86,42}].
org.xml.sax.SAXParseException; systemId: file:~/src/main/resources/nsgroup-1.0.xsd; lineNumber: 86; columnNumber: 42; src-resolve: Cannot resolve the name 'euridcom:nsgType' to a(n) 'type definition' component.
[ERROR] Error while parsing schema(s).Location [ file:~/src/main/resources/domain-1.0.xsd{94,53}].
org.xml.sax.SAXParseException; systemId: file:~/src/main/resources/domain-1.0.xsd; lineNumber: 94; columnNumber: 53; src-resolve: Cannot resolve the name 'host:addrType' to a(n) 'type definition' component.
The Maven plugin configuration looks like following:
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.8.3</version>
<configuration>
<schemaDirectory>src/main/resources</schemaDirectory>
<bindingDirectory>src/main/resources</bindingDirectory>
<bindingIncludes>
<include>bindings.xml</include>
</bindingIncludes>
<extension>true</extension>
<debug>true</debug>
<args>
<arg>-extension</arg>
<arg>-Xnamespace-prefix</arg>
</args>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-namespace-prefix</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</plugin>
And the bindings.xml file:
<?xml version="1.0"?>
<jxb:bindings version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:namespace="http://jaxb2-commons.dev.java.net/namespace-prefix"
xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd
http://jaxb2-commons.dev.java.net/namespace-prefix http://java.net/projects/jaxb2-commons/sources/svn/content/namespace-prefix/trunk/src/main/resources/prefix-namespace-schema.xsd">
<jxb:bindings schemaLocation="authInfo-1.0.xsd">
<jxb:schemaBindings>
<jxb:package name="eu.eurid.xml.epp.authInfo"/>
</jxb:schemaBindings>
<jxb:bindings>
<namespace:prefix name="authInfo"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings schemaLocation="epp-1.0.xsd">
<jxb:schemaBindings>
<jxb:package name="eu.eurid.xml.epp.epp"/>
</jxb:schemaBindings>
<jxb:bindings>
<namespace:prefix name="epp"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings schemaLocation="eppcom-1.0.xsd">
<jxb:schemaBindings>
<jxb:package name="eu.eurid.xml.epp.eppcom"/>
</jxb:schemaBindings>
<jxb:bindings>
<namespace:prefix name="eppcom"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings schemaLocation="contact-1.0.xsd">
<jxb:schemaBindings>
<jxb:package name="eu.eurid.xml.epp.contact"/>
</jxb:schemaBindings>
<jxb:bindings>
<namespace:prefix name="contact"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings schemaLocation="contact-ext-1.0.xsd">
<jxb:schemaBindings>
<jxb:package name="eu.eurid.xml.epp.contact.ext"/>
</jxb:schemaBindings>
<jxb:bindings>
<namespace:prefix name="contact-ext"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings schemaLocation="domain-1.0.xsd">
<jxb:schemaBindings>
<jxb:package name="eu.eurid.xml.epp.domain"/>
</jxb:schemaBindings>
<jxb:bindings>
<namespace:prefix name="domain"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings schemaLocation="domain-ext-1.0.xsd">
<jxb:schemaBindings>
<jxb:package name="eu.eurid.xml.epp.domain.ext"/>
</jxb:schemaBindings>
<jxb:bindings>
<namespace:prefix name="domain-ext"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings schemaLocation="dss-1.0.xsd">
<jxb:schemaBindings>
<jxb:package name="eu.eurid.xml.epp.dss"/>
</jxb:schemaBindings>
<jxb:bindings>
<namespace:prefix name="dss"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings schemaLocation="dynUpdate-1.0.xsd">
<jxb:schemaBindings>
<jxb:package name="eu.eurid.xml.epp.dynupdate"/>
</jxb:schemaBindings>
<jxb:bindings>
<namespace:prefix name="dynupdate"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings schemaLocation="euridcom-1.0.xsd">
<jxb:schemaBindings>
<jxb:package name="eu.eurid.xml.epp.euridcom"/>
</jxb:schemaBindings>
<jxb:bindings>
<namespace:prefix name="euridcom"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings schemaLocation="host-1.0.xsd">
<jxb:schemaBindings>
<jxb:package name="eu.eurid.xml.epp.host"/>
</jxb:schemaBindings>
<jxb:bindings>
<namespace:prefix name="host"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings schemaLocation="idn-1.0.xsd">
<jxb:schemaBindings>
<jxb:package name="eu.eurid.xml.epp.idn"/>
</jxb:schemaBindings>
<jxb:bindings>
<namespace:prefix name="idn"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings schemaLocation="keygroup-1.1.xsd">
<jxb:schemaBindings>
<jxb:package name="eu.eurid.xml.epp.keygroup"/>
</jxb:schemaBindings>
<jxb:bindings>
<namespace:prefix name="keygroup"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings schemaLocation="nsgroup-1.0.xsd">
<jxb:schemaBindings>
<jxb:package name="eu.eurid.xml.epp.nsgroup"/>
</jxb:schemaBindings>
<jxb:bindings>
<namespace:prefix name="nsgroup"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings schemaLocation="poll-1.0.xsd">
<jxb:schemaBindings>
<jxb:package name="eu.eurid.xml.epp.poll"/>
</jxb:schemaBindings>
<jxb:bindings>
<namespace:prefix name="poll"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings schemaLocation="secDNS-1.1.xsd">
<jxb:schemaBindings>
<jxb:package name="eu.eurid.xml.epp.secdns"/>
</jxb:schemaBindings>
<jxb:bindings>
<namespace:prefix name="secdns"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings schemaLocation="registrar-1.0.xsd">
<jxb:schemaBindings>
<jxb:package name="eu.eurid.xml.epp.registrar"/>
</jxb:schemaBindings>
<jxb:bindings>
<namespace:prefix name="registrar"/>
</jxb:bindings>
</jxb:bindings>
</jxb:bindings>
For the reference host.xsd file contents is here: http://pastebin.com/ZdAGrNXF and eppcom.xsd is here: http://pastebin.com/hYSwXQ11
I've already spent like 5 days trying to figure out what is wrong - trying different combinations of maven plugin options etc. The SO's community is my last chance now. Thank you in advance for the tips.
Upvotes: 1
Views: 839
Reputation: 768
I had the same problem trying to validate xml with epp-1.0.xsd (http://www.iana.org/assignments/xml-registry/schema/epp-1.0.xsd) and replacing
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"/>
in epp-1.0.xsd file with
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0" schemaLocation="http://www.iana.org/assignments/xml-registry/schema/eppcom-1.0.xsd"/>
solved the problem.
Upvotes: 0
Reputation: 1009
The JRE/JDK I've used was not complete somehow. Installation of JDK with Java EE solved the problem of JaxB.
Upvotes: 0
Reputation: 51
I am changed xsd. Add attribute schemaLocation to import elements in all xsd schemas. Then generating of class was ok.
If I use catalog for resolving namespaces, then I have problems with duplicit definition of some elements.
Upvotes: 1