为什么xjc告诉我未知的位置?

时间:2012-12-06 03:07:21

标签: java jaxb xsd

我使用xjc 2.2.4-2生成java类。 我有2个xsd文件,message.xsd和typeDef.xsd,绑定文件是schema.xjb 但是当我执行下面的命令时,只生成了message.xsd。

  

bash-3.2 $ xjc -d jaxb -b schemas / schemas / * .xsd -verbose
  解析模式...
  编译模式......

     

[INFO]生成代码
      未知的位置
  组织/ openuri / ChangeOfferingStateType.java
  组织/ openuri / ObjectFactory.java
  组织/ openuri / package-info.java

为什么还没有生成typeDef.xsd?

这是我的xsd和xjb文件。

bash-3.2 $ cat schemas / message.xsd

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:gsta="http://gsta.com/neva2/externalService" 
    targetNamespace="http://www.openuri.org/"
    elementFormDefault="qualified" 
    attributeFormDefault="unqualified">
    <xs:import namespace="http://gsta.com/neva2/externalService" schemaLocation="typeDef.xsd" />
    <xs:complexType name="ChangeOfferingStateType">
        <xs:sequence>
            <xs:element name="workFlowNo" type="xs:string" minOccurs="0" />
            <xs:element name="externalNumber" type="gsta:ExternalNumberType" />
            <xs:choice>
                <xs:element name="offeringSpecId" type="gsta:SpecIdType" />
                <xs:element name="productSpecId" type="gsta:SpecIdType" />
            </xs:choice>
            <xs:element name="state" type="gsta:SetStateCode" />
            <xs:element name="openTime" type="xs:date" minOccurs="0" />
            <xs:element name="recentModifyReason" type="gsta:RecentModifyReasonType" />
        </xs:sequence>
    </xs:complexType>
</xs:schema>

bash-3.2 $ cat schemas / typeDef.xsd

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:gsta="http://gsta.com/neva2/externalService" 
    targetNamespace="http://gsta.com/neva2/externalService"
    elementFormDefault="qualified" 
    attributeFormDefault="unqualified">

    <xs:simpleType name="ExternalNumberType">
        <xs:restriction base="xs:string">
            <xs:maxLength value="20"></xs:maxLength>
            <xs:minLength value="1"></xs:minLength>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="SpecIdType">
        <xs:restriction base="xs:long">
            <xs:minInclusive value="0"></xs:minInclusive>
            <xs:maxInclusive value="999999"></xs:maxInclusive>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="SetStateCode">
        <xs:restriction base="xs:int">
            <xs:enumeration value="0" />
            <xs:enumeration value="1" />
            <xs:enumeration value="2" />
            <xs:enumeration value="3" />
            <xs:enumeration value="4" />
            <xs:enumeration value="5" />
            <xs:enumeration value="7" />
            <xs:enumeration value="8" />
            <xs:enumeration value="11"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="RecentModifyReasonType">
        <xs:restriction base="xs:string">
            <xs:maxLength value="64"></xs:maxLength>
            <xs:minLength value="1"></xs:minLength>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>

bash-3.2 $ cat schemas / schemas.xjb

<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" jaxb:version="2.0">
    <jaxb:bindings schemaLocation="message.xsd" node="/xs:schema">
        <jaxb:schemaBindings>
            <jaxb:package name="org.openuri"/>
        </jaxb:schemaBindings>
    </jaxb:bindings>
    <jaxb:bindings schemaLocation="typeDef.xsd" node="/xs:schema">
        <jaxb:schemaBindings>
            <jaxb:package name="com.gsta.neva2.externalservice"/>
        </jaxb:schemaBindings>
    </jaxb:bindings>
</jaxb:bindings>

0 个答案:

没有答案