JTidy to tidy migration question

View: New views
2 Messages — Rating Filter:   Alert me  

JTidy to tidy migration question

by Eugene Dzhurinsky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello there!

Can somebody please advice, what is the best way to achieve the same results
of the conversion of the HTML documents to XHTML Strict as the following Java
code does:

final Tidy tidy = new Tidy();
tidy.setXHTML(true);
tidy.setDocType("strict");
tidy.setXmlOut(true);
tidy.setQuiet(true);
tidy.setEncloseText(true);
tidy.setFixBackslash(true);
tidy.setFixComments(true);
tidy.setHideEndTags(true);
tidy.setMakeClean(true);
tidy.setErrout(pwErr);
tidy.setCharEncoding(Configuration.UTF8);
tidy.setTidyMark(false);
tidy.setSmartIndent(true);
tidy.setSpaces(1);
tidy.setWraplen(80);
tidy.setWord2000(true);
tidy.setWrapSection(true);
tidy.setLogicalEmphasis(true);

We tried to do the same thing with the following settings in the configuration file,
passed to the tidy - but with no luck.

output-xhtml: yes
add-xml-decl: yes
doctype: strict
input-encoding: utf8
output-encoding: utf8
indent: no
wrap-section: no
force-output: yes
markup: yes
indent: no
break-before-br: yes
show-errors: 0
word-2000: yes
repeated-attributes: keep-last
quiet: yes
tidy-mark: no
drop-font-tags: yes
drop-proprietary-attributes: yes
drop-empty-paras: yes
bare: yes
clean: yes
logical-emphasis: yes
quote-marks: yes
enclose-text: yes
enclose-block-text: yes
literal-attributes: yes
join-classes: yes

The produced document looks different - the inline styles are moved to the document
head, the CDATA sections wraps the code within the <script> tags and so on.

So are these libraries interchangeable among self? Is it possible to safely
replace the JTidy with native Tidy and visa versa with getting the same
conversion results for same documents?

Thank you in advance!

--
Best regards
Eugene Dzhurinsky


attachment0 (202 bytes) Download Attachment

Re: JTidy to tidy migration question

by aditsu () :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[resending after subscribing]

Eugeny N Dzhurinsky-2 wrote:
So are these libraries interchangeable among self? Is it possible to safely
replace the JTidy with native Tidy and visa versa with getting the same
conversion results for same documents?
Hi, JTidy is currently based on some very old tidy code, and has a bunch of bugs. I've just joined the project and my plan is to bring it up to the latest tidy code and make various other enhancements.
So until I (or somebody else) manage to do that, you can expect different results in many cases. One important question is whether the results from one (or both?) of the libraries are wrong.

Adrian