Forum Bugs

prince errors 85 and 112

Anonymous
I have a dynamically generated prince report that is based on a certain ID. It is called from a per l cgi script that takes the dynamically generated XHTML as input and writes to the standard output (ie the browser). Most IDs work but some produce the following errors in the server error log
prince: -:85: error: xmlParseEntityRef: no name,
prince: -:120: error: xmlParseEntityRef: no name,
prince: -: error: could not load input file,
Error: Failed to open PDF file: ,
,
-,
Errors encountered. No output created.,
Done. Input errors, so no output created.,

Why would it have this error for some and not for others?

And btw a bug with your forum - if i try to write per l as one word it gives me an error and won't let me post (i have tried from multiple computers)
mikeday
From the error message it sounds like you have an invalid entity reference in your XHTML file. Remember that in XML/XHTML documents, the ampersand & is used to introduce entities, such as the standard entities &lt; &gt; &amp; for < > & or other character entities defined in XHTML such as &copy; and &alpha;.

This means that you need to be careful with ampersands that occur in query parameters in links. The following is invalid XHTML:
<a href="http://example.com?x=1&y=2">This won't work</a>

This is how it needs to be written:
<a href="http://example.com?x=1&amp;y=2">This will work</a>

Alternatively, you can always switch from using XHTML to using "tag soup" HTML, which is much more lenient in what it accepts -- try passing "--input=html" to Prince if you want to give it a go -- but personally I recommend sticking with XHTML; it's strict syntax makes it easier to see what's wrong in situations like these.
mikeday
Oh and I forgot to mention that the numbers 85 and 120 are the line numbers of the input file on which the errors occurred, which should help to track down the problem! :D
Anonymous
Thanks! You're a legend!! :D