Menu

How to add a link

Help
2003-03-21
2003-04-02
  • Danilo Ercoli

    Danilo Ercoli - 2003-03-21

    Ii need to add another link every time to retrieve  a link in html page.
    Thank's  a lot

    this is my code
    String newUrlString = "/htmlparser/action/DiscoveryUrl?url=";
    boolean inTag = false;
       for (NodeIterator e = parser.elements(); e.hasMoreNodes();) {
          node = e.nextNode();
          if (inTag){
           if (node instanceof Tag ) {
             tag = (Tag)node;
            // here i wat to define a new link, how to?
           }

          }
          inTag = false;
          if (node instanceof LinkTag ) {
           intag = true;
           linkTag = (LinkTag)node;
           linkTag.setAttribute("HREF",  newUrlString + linkTag.getLink());
        
         }

     
    • Somik Raha

      Somik Raha - 2003-03-31

      I am not sure what you are trying to do. Could you explain some more ?

      Regards,
      Somik

       
    • Danilo Ercoli

      Danilo Ercoli - 2003-04-01

      I need to add a link near the previous link present in the page,  example:

      <a href="myServletUrl?url= perviousUrl"> original text </a> // this is a link fount in page and modify by me
      <a href="myServletB"> my text</a> //this is a new link to want  add

      I already perform this by save the link in a Vector and rebuild a page with only links, the answer is:
      It's possible to add this link when parsing a page, without work directly on buffer?

      Many Thanks
      Danilo

       
    • Somik Raha

      Somik Raha - 2003-04-02

      I think you could do this, you will need to play around with the visitors. Check http://htmlparser.sourceforge.net/docs/index.php/LinkExtraction

      Regards,
      Somik

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.