XJC multiple XSD -> Class generation using “episode”

自古美人都是妖i 提交于 2019-12-08 06:35:35

问题


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?


回答1:


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

scomp -srconly a.xsd b.xsd


来源:https://stackoverflow.com/questions/10532780/xjc-multiple-xsd-class-generation-using-episode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!