JAXB "unknown location" when using a directory

I am having difficulty using JAXB 2.2 to generate Java classes when references to imported schemas are referenced. I believe that directories are being used to accomplish what I want.

I have two XSD files:


ProductsCommonTypes.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.com/ProductsCommonTypes"
   xmlns="http://www.example.com/ProductsCommonTypes" elementFormDefault="qualified">
   <xs:simpleType name="nonEmptyString">
      <xs:annotation>
         <xs:documentation>A type that will require a non-empty string value be present
         </xs:documentation>
      </xs:annotation>
      <xs:restriction base="xs:string">
         <xs:pattern value="(\s*[^\s]\s*)+"></xs:pattern>
      </xs:restriction>
   </xs:simpleType>
</xs:schema>

      


Products.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:p="http://www.example.com/Products"
   targetNamespace="http://www.example.com/Products" xmlns:common="http://www.example.com/ProductsCommonTypes"
   elementFormDefault="qualified">
   <xs:import schemaLocation="http://www.example.com/ProductsCommonTypes" namespace="http://www.example.com/ProductsCommonTypes"/>
   <xs:element name="products">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="name" type="common:nonEmptyString" minOccurs="1" maxOccurs="unbounded"/>
         </xs:sequence>
      </xs:complexType>
   </xs:element>
</xs:schema>

      


ProductsSchemaCatalog.xml

<!DOCTYPE catalog
    PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
           "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
    <public publicId="http://www.example.com/ProductsCommonTypes" uri="ProductsCommonTypes.xsd"/>
</catalog>

      

When I generate the classes using JAXB-Generate Classes ... I provide the path to the ProductsSchemaCatalog.xml file for the Catalog.

The output I get is:

parsing a schema...
compiling a schema...
[INFO] generating code
unknown location

com\example\xml\products\ObjectFactory.java
com\example\xml\products\Products.java
com\example\xml\products\package-info.java

      

Not sure if this matters or not, but Eclipse validates all files correctly.

Both of my XSD files were added to my Eclipse XML directory using the namespace name for the key type and the NameSpace for the key.

What is causing the unknown location message on the exit?

+3


source to share





All Articles