Hi,
in my humble opinion, this might not be sufficient. I would definitely
encourage you to generate those classes into more than one package,
where the XML schema's target namespace will be used to drive the
generation.
Why not create a very small (read minimal) test case and attach it to a
Jira issue so that we could try things ?
Regards
Werner
On 04.08.2010 17:58, Kim, John Y. [Tech] wrote:
Hi,
Sorry for the confusion.
I meant the classes are built into a separate jar file, not separate packages.
Given this example,
A.xsd
<xsd:schema targetNamespace="A_namespace"
<xsd:element name="name01" type="fpml:name01"/>
[OTHER ELEMENTS]
B.xsd
<xsd:schema targetNamespace="B_namespace"
<xsd:element name="name01" type="fpml:name01"/>
[OTHER ELEMENTS]
Both of [OTHER ELEMENT]'s in A.xsd& B.xsd goes into the same package
(xxxx.autogen.messaging.DTCCmsgschema).
Note that "name01" is a type declaration, which refers to the same type
(org.fpml.cfm.fpml_4_7.name01)
Will Castor have problems with this?
How can I avoid it?
We can't really change the schemas (A.xsd B.xsd) that were given to us.
Maybe there might be a trick in generating these files, so that they go to
different packages?
Thanks
John
-----Original Message-----
From: Werner Guttmann [mailto:[email protected]]
Sent: Tuesday, August 03, 2010 4:17 PM
To: Kim, John Y. [Tech]
Cc: [email protected]
Subject: Re: [castor-user] multiple declarations of substitute types of the
same name
Hi,
now that answer puzzles me, to be honest. I thought the answer would be
along the lines that you generate Java classes from the XML schemas, and
in such a way that each class generated will end up in separate packages
to be able to distinguish them.
Have I misunderstood your reply ?
Regards
Werner
On 03.08.2010 16:04, Kim, John Y. [Tech] wrote:
Hi, Werner
Thanks for your response.
Yes, we auto-generate java classes from the same schema files.
And they are packaged into a separate jar file.
-----Original Message-----
From: Werner Guttmann [mailto:[email protected]]
Sent: Tuesday, August 03, 2010 8:48 AM
To: [email protected]
Cc: Kim, John Y. [Tech]
Subject: Re: [castor-user] multiple declarations of substitute types of the
same name
Hi,
can I safely assume that you are generating the Java classes for those
XML schemas into separate packages ?
Regards
Werner
On 02.08.2010 19:08, Kim, John Y. [Tech] wrote:
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
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email