Forum Bugs

Annoying errors "ID foo already defined"

phihag
Princing
<!DOCTYPE html>
<html><body>
<a href="#somename">Down</a>
<a name="somename" id="somename">test</a>
</body></html>

results in the warning

prince: princetest.html:4: error: ID somename already defined


Although <a name=".." is deprecated, it's still valid and needed for older browsers. In pages with lots of such constructs (http://en.wikipedia.org/wiki/Glossary_of_cue_sports_terms), prince spews out hundreds or thousands of error messages. Prince should ignore the name attribute when id is present.
jim_albright
Did you verify that "somename" really is unique?

Jim Albright
Wycliffe Bible Translators

mikeday
This is an issue with the HTML parser that we are using, we will try to resolve it in a future release.
mikeday
We have now released Prince 9, with a new HTML parser that does not complain about duplicate name/id attributes.
trevordevore
@mikeday - I'm seeing this error again in Prince 10. I have existing documents that used to export without any problems. Now, with Prince 10, I get errors like <ID THE_ID already defined>. Can the Prince 9 behavior be reinstated?

Trevor DeVore
Blue Mango Learning Systems
http://www.screensteps.com - http://www.clarify-it.com

mikeday
Are you specifying -i html4 or calling SetInputType() in the server wrappers? Because by default you should not get these error messages.
trevordevore
I'm calling from the command line and I'm not specifying an input type. Here is what I call from the command line (with long paths removed):

"./prince" --server --baseurl=file:///article-layout.html --javascript -s "pdf_styles.css" "layout.html" -o "output.pdf"


And here is the header of the HTML file which I've been using since Prince 7 or 8 I believe:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>

  <meta charset="utf-8"/>

Trevor DeVore
Blue Mango Learning Systems
http://www.screensteps.com - http://www.clarify-it.com

trevordevore
Oh, and here is the HTML with matching div ids:

<div id="Step-Test" class="step-container">
</div>
<div id="Step-Test" class="step-container">


What happens is that multiple documents which can stand on their own can be combined into a single PDF. While the documents themselves don't have conflicting ids, sometimes different documents will.

Trevor DeVore
Blue Mango Learning Systems
http://www.screensteps.com - http://www.clarify-it.com

mikeday
Because you have specified an XHTML DTD, Prince will be treating the document as XML, which has stricter syntax rules. You can override this by specifying "-i html" on the command-line.

For the next release of Prince we are changing this behaviour so that files with a .html extension will be treated as HTML by default, and the XHTML DOCTYPE will be ignored (it is useless anyway).
trevordevore
Thanks,
-i html
worked @mikeday.

Trevor DeVore
Blue Mango Learning Systems
http://www.screensteps.com - http://www.clarify-it.com