Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

New Developer
Posts: 17
Registered: ‎07-16-2012
My Device: None
My Carrier: None

Looping through an object

Hi All,


In Java how would I go about looping the object MeterNumberInfo?






Electricity elec = new Electricity();
SoapObject object = elec.Connect(elec.GetMeterList(store.get(TOKEN_ID).toString()), webserviceurl, soapAction);
Object MeterNumberInfo = object.getProperty("MeterNumberInfo");




                  <c:Description>Cape Town</c:Description>
                  <c:Municipality>Cape Town</c:Municipality>
                  <c:Description>Test Account</c:Description>




Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: Looping through an object

[ Edited ]

Convert to String and use any XML parser you know. kXML2 is easy (http://kxml.sourceforge.net/kxml2/)

Posts: 17,019
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Looping through an object

if you want to do that manually you have to use SoapObject, not Object.
(as you do one line above)


you can use getPropertyCount to see how many properties are there, and getProperty(x) to retrieve a certain one.

Usually ksoap is used with mappings for complex data types that do this work for you.
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter