Hi,
I'm using Castor 1.3 for marshalling (generating XML file).
I'm having problem with validating the Castor-driven XML file.
I'm using javax.xml.parsers.DocumentBuilderFactory to validate the xml file (by
setValidating=true).
It occurs when you have two substitute types (of the same name) in two
different xsd files.
For example, let's say we have the following two schema files:
A.xsd
<xsd:schema targetNamespace="A_namespace"
<xsd:element name="name01" type="fpml:name01"/>
.....
B.xsd
<xsd:schema targetNamespace="B_namespace"
<xsd:element name="name01" type="fpml:name01"/>
.....
Then, if you have an object ZZZ (in A_namespace) that contains <name01>
element, Castor erroneously generates:
<ZZZ xmlns="A_namespace">
<ns1:name01 xmlns:ns1="B_namespace"> ... </ns1:name01>
</ZZZ>
I was expecting:
<ZZZ xmlns="A_namespace">
<ns1:name01 xmlns:ns1="A_namespace"> ... </ns1:name01>
</ZZZ>
And the validation fails afterwards.
I need help how to resolve this problem.
Thanks
John