Forum How do I...?

Error: "Unexpected token unknown('\\") ??

jimbrooking
Does anyone know what this means? There is no "\\" in the file I'm trying to convert! The error is in line 2 of my file. Lines 1-2 are:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" > 

dauwhe
I just made a simple HTML document that started with the above code. No errors from Prince 9.
mikeday
This error is coming from your CSS.
jimbrooking
Mike-

There was a <table class='xyz'> declaration but no such class was defined. Thanks for your hint but I wish the error message could have been a little less cryptic. I have defined the class and the file seems to produce the correct output, but is still throwing the same messages (two of the same).

Jim Brooking

mikeday
Can you attach the CSS, or email it to me (mikeday@yeslogic.com)? There is probably a \ character where there should not be. Undeclared classes will not cause any problems.
mikeday
Actually, I may be mistaken, I think this is coming from JavaScript, not CSS.
mikeday
The issue is that although the document claims to be XHTML, it isn't really, and it should just be treated as HTML in order to work.

Specifically, the <script> element content is wrapped up inside an XML comment <!-- like this --> however if the document was truly XHTML, this would make the scripts not apply at all, and the \n that has been (incorrectly) added after the XML comment is causing the error message from Prince.

Basically the XML comment in <script> is unnecessary, and has not been necessary for about 15 years, since all the browsers support JavaScript.

And in order to be well-formed XHTML, the less-than characters inside the <script> would need to be escaped as &lt; entities.

But the simplest solution is to just treat it as regular HTML, by specifying "-i html" to Prince or replacing the unnecessary XHTML DOCTYPE declaration with a simpler <!DOCTYPE html>.