I am new to tidy, so please excuse me if this is not a
valid bug..I was trying to tidy up html and make a
valid xhtml (strict) file. Here is a testcase that
doesnt seem to pass the w3 validator.
public static void main(String[] args) throws Exception {
String s = "<Html><body><![if test]><![endif]></body>";
ByteArrayInputStream tidyIn = new
ByteArrayInputStream(s.getBytes());
ByteArrayOutputStream tidyOut = new
ByteArrayOutputStream();
Tidy t = new Tidy();
t.setXHTML(true);
t.parse(tidyIn,tidyOut);
System.out.println(tidyOut.toString());
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy for Java (vers. 26 Sep 2004), see
www.w3.org"/>
Tidy (vers Sep 26, 2004) Parsing "InputStream"
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 1 column 7 - Warning: inserting missing 'title'
element
InputStream: Document content looks like HTML 2.0
2 warnings, no errors were found!
However, if I validate this against
http://validator.w3.org/
I get:
Result: Failed validation, 3 errors
File: upload://Form Submission
Encoding: utf-8
Doctype: XHTML 1.0 Strict
Root Namespace: http://www.w3.org/1999/xhtml
Note: The Validator XML support has some limitations.
This page is not Valid XHTML 1.0 Strict!
Below are the results of checking this document for XML
well-formedness and validity.
Error Line 10 column 3: "if" is not a reserved name.
<![if xtest]><![endif]>
Error Line 10 column 6: character data is not
allowed here.
<![if xtest]><![endif]>
You have used character data somewhere it is not
permitted to appear. Mistakes that can cause this error
include putting text directly in the body of the
document without wrapping it in a container element
(such as a
aragraph
) or forgetting to quote anError Line 10 column 16: "endif" is not a
reserved name.
<![if xtest]><![endif]>