eyedol 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
<snip>
> 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.
You didn't indicate where the exception occurred. That would be useful
information for us folk out here, to better help you out.
Off the cuff, I don't see a problem in your for() loop.
The only thing that seems strange is your thumbnail logic. With String t
presumably declared well outside the loop, and the use of t+=, you are
calling a static setThumbnail() function with one thumbnail on the first
job, two thumbnails on the second job, three thumbnails on the third
job, etc. So, I'm guessing perhaps the exception is occurring somewhere
inside setThumbnail(). But that's just a guess.
--
Mark Murphy (a Commons Guy)
http://commonsware.com
Android Training on the Ranch! -- Mar 16-20, 2009
http://www.bignerdranch.com/schedule.shtml
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---