hi all

I have to deal with an XML which contains in certain tags two different 
namespaces:

<ns1:SuperTag>
    <ns1:tag1>bla</ns1.tag1>
    <ns2:tag2>
        <ns2:subtag2>bla</ns2:subtag2>
    </ns2:tag2>
</ns1:SuperTag>

I had to divide the schema into two parts (two files), each one with the 
respective TargetNamespace-Declaration:

Schema1.xsd:

<xs:schema ....
    targetNamespace="Namespace1"
    xmlns:ns1="Namespace1"
    xmlns:ns2="Namespace2"
    elementFormDefault="qualified">
    ....
    <xs:import namespace="Namespace2"
        schemaLocation="Schema2.xsd"/>

    <xs:simpleType name="tag1Type>
        <xs:restriction base="xs:int">
        </xs:restriction>
    </xs:simpleType>    

    <xs:complexType name="SuperTag">
        <xs:all>
            <xs:element name="tag1" type="ns1:tag1Type"/>
            <xs:element name="tag2" type="ns2:tag2Type"/>
        </xs:all>
    </xs:complexType>
    ...

Schema2.xsd:

<xs:schema ...
    targetNamespace="Namespace2"
    xmlns:ns2="Namespace2"
    elementFormDefault="qualified">
    
    <xs:simpleType name="tag2TypeBase>
        <xs:restriction base="xs:String">
        </xs:restriction>
    </xs:simpleType>    

    <xs:complexType name="tag2Type">
        <xs:all>
            <xs:element name="subtag2" type="ns2:tag2TypeBase"/>
            ....
        </xs:all>
    </xs:complexType>

    ....


The problem is, that the unmarshalling works fine, but the marshalling produces:

<ns1:SuperTag>
    <ns1:tag1>bla</ns1.tag1>
    <ns1:tag2>                     <<<<< instead of <ns2:tag2>
        <ns2:subtag2>bla</ns2:subtag2>
    </ns1:tag2>
</ns1:SuperTag>


The Descriptors generated by the SourceGenerator:

- Tag2TypeDescriptor contains the member nsURI = "Namspace2"; as expected.
- SuperTagDescriptor contains the fieldDescriptor for tag2 (which is of type 
Tag2Type). This fieldDescriptor defines the namespace wrong:
     desc.setNameSpaceURI("Namespace1")    <<<<< instead of "Namespace2"


How can I write the schema, in order that it defines the first XML-example 
above correct? Or is this a known Castor-Bug, which is solved in a later 
version?

I still work with version 0.9.5.2


Any suggestions?

Heri

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

Reply via email to