title: Read link of xml file within and xml file and keep parsing
body: <p>I am parsing an xml file using sax parser. The xml file contains link to another xml file in link tag with next attribute. I have to keep on reading until the last xml file that do not have next attribute.
  Following is the xml file:<br/></p>
  
  <pre><code>   &lt;link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/EokUNzGJBI8/comments" /&gt;
     &lt;link rel="http://schemas.google.com/g/2005#batch" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/EokUNzGJBI8/comments/batch" /&gt;
     &lt;link rel="self" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/EokUNzGJBI8/comments?start-index=1&amp;amp;max-results=25" /&gt;
     &lt;link rel="next" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/EokUNzGJBI8/comments?start-index=26&amp;amp;max-results=25" /&gt;
  </code></pre>
  
  <p>I have tried the following:</p>
  
  <pre><code>SAXParserFactory factory = SAXParserFactory.newInstance();
  SAXParser saxParser = factory.newSAXParser();
  DefaultHandler handler = new DefaultHandler() {
  boolean content=false;   
  int i=0;
  public void startElement(String uri, String localName,String qName, 
              Attributes attributes) throws SAXException {
      if (qName.equalsIgnoreCase("Content")) {
          content = true;
          i+=1;
      }
      if(qName.equalsIgnoreCase("Link") &amp;&amp; attributes.getValue("rel").equalsIgnoreCase("next")){
          l=attributes.getValue("href");
  
          u=true;
      }   
  }
  </code></pre>
  
  <p>To recursively read the url returned above in <code>l</code> i do the follwoing:</p>
  
  <pre><code>saxParser2.parse(new InputSource(ur.openStream()), handler);//to read original url
   while(l!=null)
   {
       urs=new URL(l); //successive urls
   saxParser.parse(new InputSource(urs.openStream()), handler);
   }
  </code></pre>
  
  <p>The above keeps on printing the last response after it cannot find next in last xml.</p>