Actually I have a response string containing html data. I want to parse this string and replace the body tag with some attributes. I know with the help of String Buffer it is easy task, but I want to know can we replace this tag through html parser (Swing html parser).
By the help swing html parser I am able to add the tag in html but not able to remove it
replace this tag through html parser (Swing html parser).
This is completely the wrong approach - Swing is for desktop applications with a single user. There are many toolkits for combining HTML template text with variable data, with JSP being the most widely used. Do a google search for "java servlet template" to find more.
Actually I have to trace the hit through webtrends at response time. I have a response html string and i want to parse that html response string add some meta -tags which is trace by sdc server.
Author and all-around good cowpoke
Joined: Mar 22, 2000
Two possibilities occur to me: 1. If you really need to parse the HTML into tags and content, look into the JTidy toolkit. 2. If you just need to locate certain tags and grab the text between them, use the Java standard library regular expression capabilities. Here is Sun's tutorial on regular expressions.