You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by worms <wo...@gmail.com> on 2007/12/11 00:09:46 UTC

Problems with same class names in different packages.

Hello,

I am trying to pull back Aviation weather information from: http://weather.aero

There are two types of data I am trying to get back; METARs and TAFs.

http://weather.aero/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&stationString=KSLC,KHDC,KRSN,KMSY&mostRecentForEachStation=true&hoursBeforeNow=4
http://weather.aero/dataserver_current/httpparam?dataSource=tafs&requestType=retrieve&format=xml&stationString=KSLC,KHDC,KRSN,KMSY&mostRecentForEachStation=true&hoursBeforeNow=4

So I used XML beans to generate some jars from the following XSDs:
http://weather.aero/schema/metar1_2.xsd
http://weather.aero/schema/taf1_2.xsd

with the following config:
<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config">
 <xb:namespace uri="##any">
	<xb:package>aero.weather.schema.taf</xb:package>
 </xb:namespace>
</xb:config>

However, when i call

aero.weather.schema.metar.ResponseDocument xmlResponse =
aero.weather.schema.metar.ResponseDocument.Factory.parse(metarXmlUrl);
aero.weather.schema.taf.ResponseDocument xmlResponse =
aero.weather.schema.taf.ResponseDocument.Factory.parse(tafXmlUrl);

whichever one is call second will error out with:

Exception in thread "main" java.lang.ClassCastException:
aero.weather.schema.metar.impl.ResponseDocumentImpl
	at aero.weather.schema.taf.ResponseDocument$Factory.parse(Unknown Source)
	at htmltorss.TafRetriever.getTAFs(TafRetriever.java:29)
	at htmltorss.TafFeedGenerator.getRssFeed(TafFeedGenerator.java:85)
	at htmltorss.Main.main(Main.java:31)

It looks like there is some sort of problem with ResponseDocumentImpl
existing in two different packages and it uses whichever one is called
first all subsequent calls to prase.

Any help would be appreciated.
I am just getting into Java programming so I hope that I'm doing
something that is fairly obviously wrong.

Thanks,
Lance

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