1 2 Previous Next 16 Replies Latest reply on Aug 1, 2010 7:42 AM by YoungWinston

    Extraction of parts of an html file

    794113
      Hi, I am trying to extract some parts of an html page like this:
      <tr >
       <td width="20%"><a href="/products?q=lunch+bags&sampleq=1&hl=en">lunch bags</a></td>
       <td width="20%"><a href="*/products?q=aeron+chair&sampleq=1&hl=en*">aeron chair</a></td>
       <td width="20%"><a href="/products?q=gatorade&sampleq=1&hl=en">gatorade</a></td>
       <td width="20%"><a href="/products?q=emerald+ring&sampleq=1&hl=en">emerald ring</a></td>
       <td width="20%"><a href="/products?q=mini+bar&sampleq=1&hl=en">mini bar</a></td>
      I want to extract everything between the quotes inside . For the first part like this: */products?q=lunch+bags&sampleq=1&hl=en*.

      I am trying like this:
      String data = null;
               
               while((data= br2.readLine())!=null){
                    String links1[] = null;
                     //links1 = data.split("\\<a href\\=\"");
                    //links1 = data.split("<a href=\"");
                    
                    links1 = data.split("\\<a href=\".*\">");
                    
                     
                     pr1.println(links1[0]);
                     String links2[] = links1[0].split("\">"); {code}
      
      But I am getting nowhere. Is split going to help in this case??
      
      Any suggestions or corrections to my code to extract the stuff is required from you guys...
      
      Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
        1 2 Previous Next