You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Jürgen Hoffmann <me...@web.de> on 2006/04/05 18:11:04 UTC
too generic Object returned
Hello,
get an "incompatible types" error which I am now hunting for a few hours, but can't resolve.
I installed xmlbeans-2.1.0 and tried the SchemaEnum sample. It works perfectly.
Then I copied the SchemaEnum sample to a new folder in the samples folder and started modifying it piece by piece.
And now I get this "incompatible types" error.
[javac] C:\Programme\ApacheSoftwareFoundation\xmlbeans-2.1.0\samples\BookonTravelIt\src\de\bookon\travelit\BookonTravelItTest.java:50: incompatible types
found : org.apache.xmlbeans.XmlObject[]
required: de.bookon.lmweb.regionlist.ZIEL[]
ZIEL[] ziele = root.getZIELArray();
I looked in the created sources folder and found that the method getZIELArray() is indeed created returning such a generic object: org.apache.xmlbeans.XmlObject[].
When I compare this to the enumeration sample there a comparable method is the getLineItemArray() which returns a org.apache.xmlbeans.samples.enumeration.schemaenum.easypo.LineItem[] and not such a generic object like org.apache.xmlbeans.XmlObject[]
Where can I influence this?
The getZIELArray() method should return an object of type de.bookon.lmweb.regionlist.ZIEL[] as the compiler rightful says.
The Schema starts with
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema targetNamespace="http://bookon.de/lmweb/regionlist"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
Thanks for your help,
Jürgen
_______________________________________________________________
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
Re: too generic Object returned
Posted by "Dr. Jürgen Hoffmann" <me...@web.de>.
Hello,
I resolved this problem.
In the Schema I had to change the schema tag to
<xs:schema targetNamespace="http://bookon.de/lmweb/regionlist"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:bo="http://bookon.de/lmweb/regionlist">
adding the namespace http://bookon.de/lmweb/regionlist
And originally I did not specify any type for the element ZIEL
I changed this to
<xs:element name="ZIEL" type="bo:ZIEL" minOccurs="0" maxOccurs="unbounded"/>
and now this is as expected. The 'ant test' goal runs without any error
message.
But... the next problem is at hand.
The testprogramm (modfied SchemaEnumTest started through 'ant test')
reads in a sample xml File with the right namespace.
And all getter methods return null. Trying to access the very first
element in the document does not throw an exception, but returns a null
reference.
The 'ant run' goal works perfectly reading in the sample xml File and
passing it back out via tostring().
So I assume that the sample xml file is ok.
Has anybody encountered something similar?
I suspect it to be something really simple, but can't see it.
Thanks for your help,
Jürgen
Jürgen Hoffmann schrieb:
> Hello,
>
> get an "incompatible types" error which I am now hunting for a few hours, but can't resolve.
> I installed xmlbeans-2.1.0 and tried the SchemaEnum sample. It works perfectly.
> Then I copied the SchemaEnum sample to a new folder in the samples folder and started modifying it piece by piece.
> And now I get this "incompatible types" error.
>
> [javac] C:\Programme\ApacheSoftwareFoundation\xmlbeans-2.1.0\samples\BookonTravelIt\src\de\bookon\travelit\BookonTravelItTest.java:50: incompatible types
>
> found : org.apache.xmlbeans.XmlObject[]
> required: de.bookon.lmweb.regionlist.ZIEL[]
> ZIEL[] ziele = root.getZIELArray();
>
> I looked in the created sources folder and found that the method getZIELArray() is indeed created returning such a generic object: org.apache.xmlbeans.XmlObject[].
> When I compare this to the enumeration sample there a comparable method is the getLineItemArray() which returns a org.apache.xmlbeans.samples.enumeration.schemaenum.easypo.LineItem[] and not such a generic object like org.apache.xmlbeans.XmlObject[]
>
> Where can I influence this?
> The getZIELArray() method should return an object of type de.bookon.lmweb.regionlist.ZIEL[] as the compiler rightful says.
>
> The Schema starts with
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xs:schema targetNamespace="http://bookon.de/lmweb/regionlist"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>
> Thanks for your help,
>
> Jürgen
> _______________________________________________________________
> SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
> kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org