Package io.sf.carte.doc.dom4j

package io.sf.carte.doc.dom4j
Built on top of the DOM4J package, provides XHTML parsing with built-in support for CSS style sheets.

DOM4J is an XML DOM-like software package with support for Java language constructs, like Collections. See for more information.

This implementation integrates DOM4J with the CSS DOM implementation found in the package and subpackages.

Short example

This is the easiest way to use this package:

 Reader re = ...  [reader for XHTML document]
 InputSource source = new InputSource(re);
 SAXReader reader = new SAXReader(XHTMLDocumentFactory.getInstance());
 reader.setEntityResolver(new DefaultEntityResolver());
 Document document =;

And once you got the element you want style for (see, for example, the DOM4J Quick Start Guide), just get it:

 CSSComputedProperties style = ((CSSStylableElement) element).getComputedStyle();
 String propertyValue = style.getPropertyValue("display");

Please read the documentation of the individual classes for information on additional capabilities, like caching or the use of customized style sheets.