Ok following is the peice of code how it should be.
qName and localName are the arguments which you place in startElement and
endElement.
Code :-
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
// reset
tempVal = "";
if (qName.equals("track")) {
track = new Track();
} else if (qName.equals("musicalbum")) {
album = new Album();
}
}
public void characters(char[] ch, int start, int length)
throws SAXException {
tempVal = new String(ch, start, length);
}
public void endElement(String uri, String localName, String qName)
throws SAXException {
if (qName.equals("track")) {
tracks.add(track);
} else if (qName.equals("title")) {
track.setTitle(tempVal);
} else if (qName.equals("image")) {
track.setImageUrl(tempVal);
} else if (qName.equals("content_id")) {
track.setContentId(tempVal);
} else if (qName.equals("musictitle")) {
album.setAlbumName(tempVal);
} else if (qName.equals("musicimage")) {
album.setImageUrl(tempVal);
} else if (qName.equals("preview")){
track.setTrackPreviewUrl(tempVal);
}
}
I dont exactly know the reason but m pretty sure you just have to exchange
the variables qName and localName bla bla
hit and trial....
Plus i googled and i also found that you have to remove some overrides as
well to get it working
On Fri, Mar 11, 2011 at 5:29 AM, Adam <[email protected]> wrote:
> Thanks for your reply.
>
> qName? local name?? How would I go about doing this with the SAXBuilder? I
> can't see any documentation on changing my URL to use qualified names and
> such.
>
> --
> 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
>
--
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