You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by madhu1 <sa...@infosys.com> on 2008/06/09 06:30:14 UTC

ClassCastException: Classes with same name but different packages

We are using XMLBeans to parse XML documents. Getting a ClassCastException
when using classes with the same name but in different packages.

envDoc2 = com.oms.corpactin.EnvelopeDocument.Factory.parse(new
File(bean.getInputFilePath()));
envDoc1 = com.oms.securitiesin.emi.EnvelopeDocument.Factory.parse(new
File(bean
					.getInputFilePath()));

whichever one is call second will error out with:
Exception in thread "main" java.lang.ClassCastException:
com.oms.corpactin.impl.EnvelopeDocumentImpl
	at com.oms.securitiesin.emi.EnvelopeDocument$Factory.parse(Unknown Source)

There seems to be problem with EnvelopeDocumentImpl existing in two
different packages 

I have securities1.xsd, securities2.xsd, corpact1.xsd, corpact2.xsd.  The
securities2.xsd and corpact2.xsd have some common part. They have a tag in
common which has ref element that refer to securities1.xsd and corpact1.xsd
respectively. I tried using sfactor but it looks like its picking up any one
of the ref element. either securities's or corpact's.

How can this be handled?
-- 
View this message in context: http://www.nabble.com/ClassCastException%3A-Classes-with-same-name-but-different-packages-tp17726165p17726165.html
Sent from the Xml Beans - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org