Daniel L. - 2008-09-22

Hi,

***I accidentally posted this to the 'Open Discussion' forum -- can someone delete it as I am not able to do so***

I currently extract a list of nodes then modify the attribute. What I would like is to get all the nodes using "NodeList nodes = parser.parse (null);" and then modify the attributes.

I've tried iterating through all the nodes and using a visitor - but couldn't get my code working with either.

My current code as follows:

=========================================================

NodeList nodes = parser.extractAllNodesThatMatch(new TagNameFilter("link"));

for (int i = 0; i < nodes.size (); i++) { 
TagNode node = (TagNode)nodes.elementAt(i);
String relationship = node.getAttribute("rel");

if ("stylesheet".equalsIgnoreCase(relationship)) {
String link = node.getAttribute("href");

node.setAttribute("href", convertUrlToAbsolute(url, link));
}
}

System.out.println(node.toHtml());

=========================================================

Any help would be greatly appreciated.