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?
}
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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());
}
I am not sure what you are trying to do. Could you explain some more ?
Regards,
Somik
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
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