[Htmlparser-user] Parser inserts extra characters in Javascript
Brought to you by:
derrickoswald
From: Pandian A. <pan...@ya...> - 2007-05-24 08:34:39
|
Hi, I have used the HTMLParser on HTML files before and it used to work fine. But when I used it to parse the Javascript which has embedded HTML like below, the parser adds up '>' closing tags for any matching '<'. for e.g I have asked the parser to rewrite the img tag source url, Input: ------ for (g=0; g <recursedNodes.length; g++) { if (recursedNodes[g] == 1) document.write("<img src=\"images/en_US/line.gif\" align=\"absbottom\" alt=\"\" />"); else document.write("<img src=\"images/en_US/empty.gif\" align=\"absbottom\" alt=\"\" />"); } ouput: ------ for (g=0; g <recursedNodes.length; g++) { if (recursedNodes[g] == 1) document.write("><img src=\"\root\mages/en_US/line.gif\" align=\"absbottom\" alt=\"\" />"); else document.write("<img src=\"\root\mages/en_US/line.gif\" align=\"absbottom\" alt=\"\" />"); } Everything looks fine except the extra '>' before <img.... This is because the "<recursedNodes " in for loop is considered as a HTML tag and parser is adding '>' to close the tag. Any help on how the parser can be made to ignore this.. ? Regards, Pandian ____________________________________________________________________________________Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. http://mobile.yahoo.com/go?refer=1GNXIC |