title: html parser to search and replace the some values using java
body: <p>i am looking for an html parser that can search and replace the anchor tags like</p>
  
  <pre><code>ex
  &lt;a href="/ima/index.php"&gt;example&lt;/a&gt;
  to
  &lt;a href="http://www.example.com/ima/index.php"&gt;example&lt;/a&gt;
  </code></pre>
  
  <p>UPDATED:</p>
  
  <p>my code with jsoup but not working </p>
  
  <pre><code>import org.jsoup.Jsoup;
  import org.jsoup.nodes.Document;
  import org.jsoup.nodes.Element;
  import org.jsoup.select.Elements;
  
  import com.google.common.collect.ImmutableList;
  import com.google.common.net.InternetDomainName;
  
  public class test {
      public static void main(String args[]) throws IOException {
  
            Document doc = Jsoup.connect("http://www.google.com").get();
  
            String html =doc.outerHtml().toString();
  
           // System.out.println(html);
  
             Elements links = doc.select("a");
  
  
  
              for (Element link : links) {
               String href=link.attr("href");
               if(href.startsWith("http://"))
               {
  
               }
               else
               {
                   html.replaceAll(href,"http://www.google.com"+href);
               }
              }
              System.out.println(html);
      }
  
  }
  </code></pre>