title: How to parse XML using Jericho HTML Parser
body: <p>I'm new to java and servlet and currently trying to parse XML using Jericho XML Parser.
  For instance, i want to get links from each link tag, but it dose not show anything,and total number says 27(can get only correct total number without string).
  Anyone who knows how to, please teach me.</p>
  
  <pre><code>import java.io.IOException;
  import java.io.PrintWriter;
  import javax.servlet.ServletException;
  import javax.servlet.annotation.WebServlet;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import java.net.MalformedURLException;
  import java.net.URL;
  import java.util.*;
  
  import net.htmlparser.jericho.Element;
  import net.htmlparser.jericho.Source;
  
  @WebServlet(urlPatterns = { "/HelloServlet"})
  
  public class HelloServlet extends HttpServlet {
  private static final long serialVersionUID = 1L;
  
  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException,MalformedURLException{
  
      resp.setContentType("text/html; charset=UTF-8");
      PrintWriter out = resp.getWriter();
      out.println("&lt;html&gt;");
      out.println("&lt;head&gt;&lt;meta http-equiv='content-type' content='text/html; charset=UTF-8'&gt;&lt;/head&gt;");
      out.println("&lt;body&gt;");
      Source source = new Source(new URL("http://news.yahoo.com/rss/"));
      source.fullSequentialParse();
  
  
      List&lt;Element&gt; Linklist = source.getAllElements("link");
  
  
      if(Linklist!=null){
          out.println("&lt;p&gt;total："+Linklist.size()+"&lt;/p&gt;");
          for(Element link: Linklist){
              out.println("&lt;p&gt;"+link.getContent().toString()+"&lt;/p&gt;");
          }
      }
  
  
      out.println("&lt;/body&gt;");
      out.println("&lt;/html&gt;");
  }
  
  
  }
  </code></pre>