kavai77
kavai77

Reputation: 6616

XJC multiple XSD -> Class generation using "episode"

I have two most simple xsd files.

a.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:a="A" targetNamespace="A">
  <complexType name="myType"/>
  <element name="root" type="a:myType"/>
</schema>

b.xsd:

<?xml version="1.0" encoding="UTF-8"?>

<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="B" xmlns:a="A">
  <import namespace="A"/>
  <complexType name="extendedType">
    <complexContent>
      <extension base="a:myType"/>
    </complexContent>
  </complexType>
</schema>

We use the myType in b.xsd which is defined in a.xsd. The generation process consists of two steps using the "episode" feature.

> xjc -episode a.episode a.xsd
parsing a schema...
compiling a schema...
a\MyType.java
a\ObjectFactory.java
a\package-info.java

> xjc b.xsd -b a.episode
parsing a schema...
[ERROR] src-resolve: Cannot resolve the name 'a:myType' to a(n) 'type definition' component.
  line 7 of file:/b.xsd

Failed to parse a schema.

The first generation succeeds with a valid a.episode file, but the second fails. What is wrong here?

Upvotes: 1

Views: 2226

Answers (1)

jabal
jabal

Reputation: 12337

I tried your example with Apache XMLBeans 2.5.0 and it worked with this command:

scomp -srconly a.xsd b.xsd

Upvotes: 1

Related Questions