Re: struct of array of structs

John Wilson <[email protected]> Thu, 28 Sep 2006 15:50:45 +0100
Newsgroups gmane.text.xml.rpc.specification
Message-ID <[email protected]>
On 28 Sep 2006, at 08:00, Manuel Fernández Campos wrote:

>
>
> I use the apache's Xmlprc library.
>
> Certainly, the struct is return as a HashMap but the array is return
> as java.lang.object and if  i try to turn in an array or a vector, one
> CastException is thrown.


Every object in Java is an instance of java.lang.Object :)

Older versions of the Apache library returned XML-RPC arrays as  
Vector. Newer versions return objects which implement the  
java.util.List interface (the object is probably an instance of  
java.util.arrayList). If you cast these objects to Vector or array  
you will certainly get an Exception.

Why not try what I suggested in my first message and cast it to a  
List and call toArray on it to get an array of Object (or use the  
version which takes an array parameter to get an array for some other  
type)?

If that fails call getClass().getName() on the object and print the  
result out. That will tell you what the type of the object is.


John Wilson
The Wilson Partnership
web http://www.wilson.co.uk
blog http://eek.ook.org




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/xml-rpc/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/xml-rpc/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/