Forum How do I...?

getting the details for "failed to parse all CSS rules&

mischor
I'm using the Java interface. It's giving back the message "failed to parse all CSS rules". Is there a way to get more details, such as which rule it could not parse, etc?

Also - I noticed that an example CSS used the syntax "::before", while the CSS 2.0 book I have shows only one ":". Does Prince accept the one colon version?

-Marshall Schor
mikeday
I'm using the Java interface. It's giving back the message "failed to parse all CSS rules". Is there a way to get more details, such as which rule it could not parse, etc?

At the moment you have to use trial and error, eg. by commenting out half the style sheet and seeing if the error goes away, and proceeding in that manner until you have identified exactly what is causing the problem.

You could also try the W3C CSS validator, which may be able to identify any invalid syntax in your style sheet, unless the problem is Prince-specific.

The other option is to post your CSS here or email it to us and we'll take a look at it, as we would like to improve the error reporting from Prince in these situations.

Also - I noticed that an example CSS used the syntax "::before", while the CSS 2.0 book I have shows only one ":". Does Prince accept the one colon version?

CSS 3 distinguishes between pseudo-classes such as :hover and :first-child that select existing elements, and pseudo-elements such as ::before, ::after and ::marker that actually generate new elements that were not in the original document.

CSS 2 however uses the same syntax for both. Don't worry though, Prince accepts both variants, so :before and ::before are equally acceptable! :)
mischor
Thanks for the quick response. I found the problem using the W3C CSS validator - I had "commented out" blocks of css using the /* ... */, and had accidently included a /* */ within the section I was commenting out.

It would be useful, perhaps, to change the error message "failed to parse all CSS rules" to include the suggestion to use the W3C CSS validator, at least until the parser can be improved to say what's wrong.

Marshall Schor