Hi.

I have been using Castor SourceGenerator for a while now and have find it a
great tool.

However I have encountered the following problem when using SourceGenerator
to
generate code from the following schema (BTW: I have no control over the
schema
I *must* use it as is):

<schema xmlns="http://www.w3.org/2001/XMLSchema"; 
  targetNamespace="http://www.qwest.com/XMLSchema"; 
  xmlns:qw="http://www.qwest.com/XMLSchema"; 
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
  elementFormDefault="qualified" 
  attributeFormDefault="unqualified">
<complexType name="IdentificationT"> 
 <simpleContent> 
  <restriction base="string"> 
         <enumeration value="GenericId" /> 
         <enumeration value="KeyCode" /> 
         <enumeration value="CompositeKey" /> 
  </restriction> 
</simpleContent> 
</complexType> 
</schema>

I get the following error:

java.lang.IllegalArgumentException: getSimpleType: the simple type 'string'
has not been declared in XML Schema namespace.

The error can be lifted if I use a namespace prefix in type="xsd:string" or
if I remove the xsd namespace declaration in the <schema > element.

I traced this error back to the getSimpleType method in the Schema class:

    result= simpleTypesFactory.getBuiltInType(name);
    //if we have a built-in type not declared in the good namespace ->
Exception
    if ( (result != null) && (_namespaces.contains(DEFAULT_SCHEMA_NS))) {
       String err = "getSimpleType: the simple type '"+name+
                    "' has not been declared in XML Schema namespace.";
       throw new IllegalArgumentException(err);
    }

I don't understand the reason behind this if statement. It doesn't seem
right. Even
if the NS declaration isn't needed it's allowed from the XML schema specs
and
hence shouldn't break anything. Am I missing something?. Does the block of
code overlook
the case where the default namespace is the XML schema namespace? I have
modified
the Schema and SchemaUnmarshaller classes to take the case mentioned above
into
account, but before I post a patch I wanted to check whether I am missing
something.

In advance thank you for your help.

Florian Kirchhoff

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

Reply via email to