How to set Tidy configuration to not replace <br> tags?

400 views Asked by At
    File file = new File("xxxxxxx");
    String y1 = "<html><body><table><tr><td><textarea>Hello <br /> world1</textarea></td></tr></table></body></html>";
    FileWriter fw = new FileWriter(file);
    fw.write(y1);
    fw.close();

    FileReader r = new FileReader(file);
    Tidy tidy = new Tidy(); 
    tidy.setXHTML(true); 
    tidy.setShowWarnings(false);
    tidy.setQuiet(true);
    tidy.setHideComments(true);
    String tempFile = file + ".tmpPdf";
    FileWriter w = new FileWriter(tempFile); 
    tidy.parse(r, w);
    r.close();
    w.close();

I want the output in .tmpPdf file to be "Hello
world1". Here, "Hello world" should have
in between literally in my output.

1

There are 1 answers

0
Elliott Frisch On

Where you have this line

 String y1 = "<html><body><table><tr><td><textarea>Hello <br /> world1</textarea></td></tr></table></body></html>";

I think you want to have this

 String y1 = "<html><body><table><tr><td><textarea>Hello\nworld1</textarea></td></tr></table></body></html>";

You want a new-line (and it's within a textarea tag).