Dear Soumya,
Your assumption that this has something to do with the Java typesystem may
be wrong, but since you haven't given us the actual text of the error
message we have no way of knowing.
You have also given us very little information about how you have written
your schemae, but one thing occurs to me: do they both have the same target
namespace? If they do, there may be a conflict between the definitions of
the root elements, and the problem is with the XML type system rather than
the Java one (see the XMLBeans javadoc for org.apache.xmlbeans.SchemaType).
If this is the problem, and you need to keep a single target namespace, you
could design your way out of this problem by merging the two schemae into a
single one: use either <xsd:choice> or derivation from a common supertype to
allow the new single schema to describe both types of document.
Regards,
Peter.
On Thu, 29 Apr 2010, Soumya wrote:
Date: Thu, 29 Apr 2010 16:39:42 +0530 (IST)
From: Soumya <soumya_...@yahoo.co.in>
Reply-To: user@xmlbeans.apache.org
To: user@xmlbeans.apache.org
Subject: XmlBean object confusion
Hi guys,
I came across a strange issue today for which I am having serious doubts about
my Java skills!!..
if this is something very obvious and I am posing a blind eye to it please do
open my eyes!
I have an xsd say type1.xsd which has an element <xml_element> at the top level.
xml from it would look like
<xml_element>
<request>
<customer>
.....
</xml_element>
Now I have another xsd which has the same top level elements xml_element and
request but different
inside. xml complying to it would look like
<xml_element>
<request>
<transaction>
.....
</xml_element>
So you can see above that the 2 top level elements <xml_element> and <request>
are the same.
Now I use Xmlbeans to generate 2 different jars out of it -
type1.xsd has the following document object -
com.company.type.one.XmlElementDocument
type2.xsd has the following document object -
com.company.type.two.XmlElementDocument
Kindly note the packages are different and so are fully qualified classnames.
Also they are in 2
different jars type1.jar and type2.jar
Now when I load my Application and try to use
com.company.type.one.XmlElementDocument.Factory.parse("somexml") - where
"somexml" is actually of
type type1.xsd it errors out telling xml not of type <xml_element> - shocking!!
it works fine
standalone. But when I put both jars together it errors out!!
if i remove type2.jar from the application it works fine happily again.
Ideally since the package names are different shouldnt the 2 XmlElementDocument
s be identifiable
separately.. after all that's why java is so good with fully qualified
classnames.
Please suggest if you have faced similar issue.
thanks in advance.
Soumya
--
Peter Keller Tel.: +44 (0)1223 353033
Global Phasing Ltd., Fax.: +44 (0)1223 366889
Sheraton House,
Castle Park,
Cambridge CB3 0AX
United Kingdom
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: user-h...@xmlbeans.apache.org