[prev in list] [next in list] [prev in thread] [next in thread]
List: castor-user
Subject: [castor-user] [XML] two namespaces in one tag
From: "Bender Heri" <HBender () Ergonomics ! ch>
Date: 2005-03-17 17:47:04
Message-ID: 3FE38194C8A3334A959B64B7D9A1E27B03E66A () plejaden ! seychelles ! ergo
[Download RAW message or body]
This is a multi-part message in MIME format.
--MML_1111081594_12468@5450.exolab.org
Content-Class: urn:content-classes:message
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
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
--MML_1111081594_12468@5450.exolab.org
Content-Type: text/plain; charset=us-ascii; name="footer"
Content-Transfer-Encoding: 8bit
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
minimalist@exolab.org with a subject of:
unsubscribe castor-user
--MML_1111081594_12468@5450.exolab.org--
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic