R
Ronald Fischer
I need to parse a fragment of HTML code for containing errors.
On this ng, JTidy was suggested to me as a solution.
The problem seems to be that the Tidy.parse() writes its errors and
warnings to standard error, but I need to catch them before presenting
them to the user, in order to filter out certain errors which we don't
regard as errors. I thought that Tidy.setErrfile could do the job.
Assuming that the name of the file containing the HTML code to parse
is stored in variable fn, I tried the following code:
Tidy tidy=new Tidy();
tidy.setErrfile("errout.txt");
tidy.setXHTML(false);
tidy.setDocType("strict");
tidy.setShowWarnings(true);
tidy.parse(new FileInputStream(new File(fn)),null);
But Tidy still writes to standard error, and the file errout.txt is
not created. What am I doing wrong?
Ronald
On this ng, JTidy was suggested to me as a solution.
The problem seems to be that the Tidy.parse() writes its errors and
warnings to standard error, but I need to catch them before presenting
them to the user, in order to filter out certain errors which we don't
regard as errors. I thought that Tidy.setErrfile could do the job.
Assuming that the name of the file containing the HTML code to parse
is stored in variable fn, I tried the following code:
Tidy tidy=new Tidy();
tidy.setErrfile("errout.txt");
tidy.setXHTML(false);
tidy.setDocType("strict");
tidy.setShowWarnings(true);
tidy.parse(new FileInputStream(new File(fn)),null);
But Tidy still writes to standard error, and the file errout.txt is
not created. What am I doing wrong?
Ronald