CSS4J 3.7.0
New css4j version 3.7.0 is available from the usual places:
Includes a fix for two instances of a Java 11 method that was being accidentally used. Users on Java 8 must upgrade.
The issue was discovered thanks to a
new CI task aimed at detecting issues with the jar files at the Maven repository, and that task should be able to pin out hypothetical future issues.
Moreover, each
build CI task now runs the css4j tests with Java 8, in addition to Java 11 and 17.
CSS4J-DOM4J 3.6.1
And css4j-dom4j version 3.6.1 is available from:
With 3.6.1, I wanted to be able to use javax.xml.transform.Transformer with css4j-dom4j documents. This is indeed now possible, unfortunately it is not behaving in the same way as the JDK DOM.
When one configures a Transformer in the following way:
TransformerFactory tf = TransformerFactory.newInstance();
transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty(OutputKeys.INDENT, "no");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty(OutputKeys.CDATA_SECTION_ELEMENTS, "script style");
the JDK DOM converts the style sheets inside the STYLE elements to CDATA sections, effectively transforming HTML in XHTML. But for some reason DOM4J fails to do that.
That's bad news for embedded scripts and also for style sheets containing selectors like div>p.
Css4j's native DOM is recommended to process HTML.