I am trying to import one schema into another and generate code for it
(schema extracts below). Source for each schema will be packaged
differently. I have already generated the source for schema2, but when I try
to generate the source for schema1 it doesn't generate the correct reference
to DeviceType which is a simpleType imported from schema2.
Rather than referencing DeviceType in the package for schema2 it creates a
reference to a non-existant DeviceType in the package for schema1.

My castorbuilder.properties looks like:

        org.exolab.castor.builder.javaclassmapping=type
        org.exolab.castor.builder.nspackages=\
          http://www.me.com/schema2=com.me.xml

Commands executed:
C:\tmp\castortest>java org.exolab.castor.builder.SourceGenerator -i
schema2.xsd -package com.me.xml
C:\tmp\castortest>java org.exolab.castor.builder.SourceGenerator -i
schema1.xsd -package com.me.app

I know that imports should work as I can see plenty of references in the
list archives, so I'm sure it's a real simple mistake on my part, however I
am lost, so any help would be much appreciated,

Thanks,

Scott.


schema1.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
  xmlns="http://www.me.com/schema1";
  xmlns:s2="http://www.me.com/schema2";
  elementFormDefault="qualified"
  targetNamespace="http://www.me.com/schema1";>

  <xsd:import namespace="http://www.me.com/schema2";
        schemaLocation="schema2.xsd"/>

  <xsd:complexType name="DeviceDescr">
    <xsd:sequence>
        <xsd:element name="name" type="s2:DeviceType"
          minOccurs="1" maxOccurs="1">
        </xsd:element>
    </xsd:sequence>
  </xsd:complexType>
</xsd:schema>

schema2.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
  xmlns="http://www.me.com/schema2";
  elementFormDefault="qualified"
  targetNamespace="http://www.me.com/schema2";>

  <xsd:simpleType name="DeviceType">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="TYPE1" />
      <xsd:enumeration value="TYPE2" />
    </xsd:restriction>
  </xsd:simpleType>
</xsd:schema>

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to