users@jaxb.java.net

Problem generating Java classes from XSD's

From: Nussbaum Daniel, Bedag <Daniel.Nussbaum_at_bedag.ch>
Date: Fri, 16 Apr 2010 14:14:43 +0200

Hi @all

I have following two XSD's:

1) Request:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.bedag.ch/evn/mofis"
targetNamespace="http://www.bedag.ch/evn/mofis"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="getEvnByNumber">.
.
.


2) Response:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.bedag.ch/evn/mofis"
targetNamespace="http://www.bedag.ch/evn/mofis"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="mofis-datentypen.xsd"/>
<xs:element name="getEvnByNumber">
.
.

The element "getEvnByNumber" is defined in two different XSD's, using
the same Namespace, but having a different structure.

By using binding-files I try to create two different classes
(GetEvnByNumberRequest and GetEvnByNumberResponse) inside the same
package.

Using the maven-jaxb2-plugin I get following error message during code
generation:
[ERROR] Error while parsing schema(s).Location [
file:...../mofis-ws1-getEvnByNumber-request.xsd{60,14}].
org.xml.sax.SAXParseException: 'getEvnByNumber' is already defined
at
com.sun.xml.xsom.impl.parser.ParserContext$1.reportError(ParserContext.j
ava:176)
at
com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.reportError(NGCCRuntimeEx.jav
a:170)
at
com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.reportError(NGCCRuntimeEx.jav
a:173)
at
com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.checkDoubleDefError(NGCCRunti
meEx.java:145)


Btw, editing the XSD's and defining two different namespaces (or a
different element name) is not an option, because these files are
defined on the customer side and they won't change them.

Is there a way to solve this problem?

Regards,
Daniel