I Believe This Is In The Archives.
On 12/02/2008, eyedol <[EMAIL PROTECTED]> wrote:
>
> Can't figure out how to achieve this. I was to get the values for the
> tag "thumb" it works fine if the "thumb" tag shows once, but if it
> increases, I get an exception thrown. Exception
> java.lang.IndexOutOfBoundsException: Invalid location 1, size is 1
>
> Sample xml
> <response>
>
> <payload>
>
> <jobs>
>
> <job0>
>
> <job>
> <jobid>1</jobid>
> <jobtitle>The book</jobtitle>
>
> <jobdescription>
> An enterprise or desktop gateway that connects data sources to mobile
> networks. Intelligent routing can map messages via GSM modems or SMPP
> connections to the lowest-cost delivery channel. Routing by service
> and content provider is also configurable. Offline versions for off-
> net delivery via modems is available.
> </jobdescription>
> <locationid>1</locationid>
> <locationname>Addis</locationname>
> <categoryid>2</categoryid>
> <categorytitle>White Color</categorytitle>
> </job>
>
> <media>
>
> <mediaitem0>
> <id>1</id>
> <title/>
> <type>1</type>
> <thumb>1_1_12277.jpg</thumb>
> </mediaitem0>
>
> <mediaitem1>
> <id>8</id>
> <title/>
> <type>1</type>
> <thumb>1_1_12282.jpg</thumb>
> </mediaitem1>
> </media>
> </job0>
> </jobs>
> </payload>
>
> <error>
> <code>0</code>
> <message>No Error</message>
> </error>
> </response>
>
> The Java code to fetch the values
> ...
> NodeList thumbnails = doc.getElementsByTagName("thumb");
>
> for (int i=0;i< thumbnails.getLength();i++) {
>
> Element thumbnail= (Element) thumbnails.item(i);
> Job job = jobs.get(i);
> t +=thumbnail.getFirstChild().getNodeValue()+",";
> Job.setThumbnail(t);
> }
> ...
>
> All I want to achieve is get the values for the thumb tag. What am I
> doing wrong and how do I achieve that.
> >
>
--
Xavier A. Mathews
Student/Browser Specialist/Developer/Web-Master
Google Group Client Based Tech Support Specialist
Hazel Crest Illinois
[EMAIL PROTECTED]@[EMAIL PROTECTED]
"Fear of a name, only increases fear of the thing itself."
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---