Saturday, April 17, 2010

Jtidy

- DOM parser
 : Node node = tidy.parser(IS/reader, OS/writer);
- pretty printer
 : tidy.pprint(dom_Doc/node, OS)
- HTML cleaner, makes well formed HTML

CONFIGURATION
    // make well formed
    tidy.setXHTML(true);
    tidy.setHideComments(true);
    tidy.setIndentContent(true);
    // space for indentation
    tidy.setSpaces(4);
    // whether to add tidy meta content tag
    tidy.setTidyMark(false);

    if (ERROR_PRINT_MODE)
      tidy.setOnlyErrors(true);
    else
      tidy.setQuiet(true);

Other config
    // tidy.setShowWarnings(false);
    //  tidy.setErrout(new PrintWriter(new StringWriter()));
    // shows only <body> tag
    // tidy.setPrintBodyOnly(true);

No comments:

Post a Comment