How to use SAXParse to parse atom feed with java

I use the SAXParser to parse RSS feed that was prepared for iTunes podcast. It doesn't want work with these tags. If I remove all marked tags it will work. The mainly task to get info from item tags

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="" xmlns:cc=""      xmlns:itunes="" xmlns:media="" xmlns:rdf="">
            <!-- With this tags I get error -->
    <atom:link href="" rel="self" type="application/rss+xml"/>
    <itunes:image href="" />
    <!-- *************************************************** -->    
        <title>Title 1</title>
        <pubDate>Tue, 31 Dec 2013 14:24:00 +0000</pubDate>
        <guid isPermaLink="false"><![CDATA[7ef6ab037fe7f9e77a195b42fba84017]]></guid>
        <itunes:image href="" />
        <enclosure length="41999781" type="audio/mpeg" url="http://123.mp3" />

That's DefaultHandler:

public class StudyHandler extends DefaultHandler {
private List<Track> track;
private Track currentTrack;
private StringBuilder builder;

boolean isTitle = false;

public List<Track> getMessages() {
    return this.track;

public void characters(char[] ch, int start, int length)
        throws SAXException {
    super.characters(ch, start, length);
    builder.append(ch, start, length);
    if (isTitle) {
        currentTrack.title = builder.toString();

public void startDocument() throws SAXException {

    track = new ArrayList<Track>();
    builder = new StringBuilder();

public void startElement(String uri, String localName, String name,
        Attributes attributes) throws SAXException {
    super.startElement(uri, localName, name, attributes);
    String value = localName.trim();
    if (value.equalsIgnoreCase("ITEM")) {
        this.currentTrack = new Track();
    } else if (value.equalsIgnoreCase("TITLE")) {
        isTitle = true;


public void endElement(String uri, String localName, String name)
        throws SAXException {
    super.endElement(uri, localName, name);

    if (this.currentTrack != null) {
        if (localName.equalsIgnoreCase("TITLE")) {
            isTitle = false;
        } else if (localName.equalsIgnoreCase("ITEM")) {


When you try to trace each start/end tag operation or in debug mode, do you note that the parser is parsing the tags?


Need Your Help

Single-sign-on (social login) with QQ on iOS

ios parse-platform single-sign-on

I was able to impletement login with facebook, twitter and google plus. I want to implement login with QQ Social network and get users data.

Difference in number of lines in Editpad Lite and Windows notepad

c# notepad

I have a text file which when opened in Editpad Lite show the number of lines as 2754813 and when it is opened in Windows Notepad showing the number of lines as 2713520. When I read it with a C#