Thank you for visiting the BlackBerry Support Community Forums.
BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)
BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.
"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."
- Kevin Michaluk, Founder, CrackBerry.com
Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.
10-11-2011 10:11 AM
You code looks a little confused to me. have you reviewed any of the online documentation on using a SAX parser?
Anyway, your start element should be called, And generally if I am looking for a tag, I look for it in there, comparing the localname. Assuming I have fond the localname I want, then I go through the attributes, much as you have done. Again I typically use the local name, and when I have fond the attribute I want, I process the value.
Now the bad news here is that the XML you actually want is packaged inside some XML. So the processing I think you have to do is
a) Invoke a parser on the whole XML,
b) Once you have found your element (looking for "description" in startElement), set a flag, turn flag off if not your element
c) In characters() check the flag, and when you find the flag set, extract those characters.
d) Now you have the characters you have to parse, so you need to start another XML parser (actually I would not do this recursively, I would save the characters and let the first parser complete. But you can do it recursively if you wish.
e) In this XML parser you have to look for the img element, and then use code like we have already discussed to find the attribute you want.
If this is all the data you are getting I would be seriously tempted to just use indexOf to find the img=, then extract the URL from between the following quotation marks. Having to run two parsers to find this out seems like over kill. But my suggestion is grubby.....
10-12-2011 04:39 AM
No, it doesn't work like that.
With the SAX parser you get notified as it parses the String, so it has to parse it.
If you use the DOM parser, then you can use something like that to get the CDATA for <description>, then you will have to call the DOM parser again to extract the <img> tag and from there get the attribute.
10-12-2011 08:21 AM
10-13-2011 03:35 AM
10-13-2011 05:14 AM
10-13-2011 05:32 AM