conversion of html to txt problem

hi everybody,

import java.io.*;

import javax.swing.*;

import javax.swing.text.*;

import javax.swing.text.html.*;

import javax.swing.text.html.parser.*;

public class TextFromHtml extends HTMLEditorKit.ParserCallback{

private PrintWriter pw;

private boolean furtherCalls = false;

public TextFromHtml(File outputFile) throws IOException {

pw = new PrintWriter(new BufferedWriter(new FileWriter(outputFile, false)));

}

public void handleText(char[] data, int pos){

//place ' ' between calls to handlText

if (furtherCalls) {

pw.write(' ');

}

furtherCalls = true;

boolean printSpace = false;

for(int i=0; i<data.length; ++i) {

char ch = data;

boolean notSpace = !Character.isSpaceChar(ch);

if (notSpace || printSpace) {

pw.write(ch);

}

printSpace = notSpace;

}

}

public void flush() {

pw.close();

}

public static void main(String args[]) throws IOException {

ParserDelegator parser = new ParserDelegator();

TextFromHtml app = new TextFromHtml(new File("2.txt"));

parser.parse(new FileReader("MyApplet.html"), app, true);

app.flush();

}

}

i am trying to use the above given code to convert html document to pure text....

but i hv a problem...

><style type="text/css">

.petstore {

font-family: Helvetica, Arial, sans-serif;

font-size: small;

}

.petstore_title {

font-family: Helvetica, Arial, sans-serif;

font-weight: bold;

}

.petstore_footer {

font-family: Helvetica, Arial, sans-serif;

font-size: x-small;

}

.petstore_listing {

font-family: Helvetica, Arial, sans-serif;

font-size: x-small;

}

.petstore_form {

font-family: Helvetica, Arial, sans-serif;

font-size: x-small;

}

</style>

the text between <style> and </style> is not getting removed ...but i want it also to be eliminated....anybody help me.....

[2129 byte] By [nishmi_balana] at [2007-10-2 10:57:18]
# 1
Hi,Yawmark gave you an answer in this thread: http://forum.java.sun.com/thread.jspa?threadID=573268&messageID=4078415#4078415Kaj
kajbja at 2007-7-13 3:23:31 > top of Java-index,Java Essentials,Java Programming...