Skip to content

Commit f6c49c7

Browse files
committed
Usage: add more verbosity about xml-dtd
1 parent e84e65e commit f6c49c7

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

usage.html

+22-6
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,8 @@ <h2>Examples with DOM4J</h2>
285285
but you do not need the latter unless you plan to use the DOM4J agent.</p>
286286
<p>For example, with Gradle:</p>
287287
<pre class="code"><code class="language-groovy">dependencies {
288-
api "io.sf.carte:css4j-dom4j:${css4jDom4jVersion}"
288+
implementation "io.sf.carte:css4j-dom4j:${css4jDom4jVersion}"
289+
implementation "io.sf.carte:xml-dtd:4.2"
289290
}
290291
</code></pre>
291292
<p>But please remember that you have to set up css4j's repository, if you haven't already:</p>
@@ -305,11 +306,19 @@ <h2>Examples with DOM4J</h2>
305306
}
306307
</code></pre>
307308
<p>Same with Apache Maven:</p>
308-
<pre class="code"><code class="language-xml">&lt;dependency&gt;
309+
<pre class="code"><code class="language-xml">&lt;!-- This artifact requires the css4j Maven repository --&gt;
310+
&lt;dependency&gt;
309311
&lt;groupId&gt;io.sf.carte&lt;/groupId&gt;
310312
&lt;artifactId&gt;css4j-dom4j&lt;/artifactId&gt;
311313
&lt;version&gt;${css4jDom4j.version}&lt;/version&gt;
312314
&lt;/dependency&gt;
315+
316+
&lt;!-- This artifact requires the css4j Maven repository --&gt;
317+
&lt;dependency&gt;
318+
&lt;groupId&gt;io.sf.carte&lt;/groupId&gt;
319+
&lt;artifactId&gt;xml-dtd&lt;/artifactId&gt;
320+
&lt;version&gt;4.2&lt;/version&gt;
321+
&lt;/dependency&gt;
313322
</code></pre>
314323
<p>Again, please keep in mind adding css4j's Maven repository to your POM file:
315324
</p>
@@ -323,9 +332,13 @@ <h2>Examples with DOM4J</h2>
323332
</code></pre>
324333
<p>The <code>css4j-dom4j</code> artifact transitively implies the <code>css4j</code> core module, but since both artifacts have
325334
different release cycles you may want to add an explicit dependency for the core module, with the latest version.</p>
326-
<p>As explained in the <a href="#modules">modules section</a>, recent <code>css4j-dom4j</code> artifacts are compatible with <code>css4j</code>
327-
artifacts that have the same major version number, for example both <code>css4j-dom4j</code> 3.5.2 and 3.6.0 are compatible with
328-
<code>css4j</code> 3.9.1.</p>
335+
<p>As explained in the <a href="#modules">modules section</a>, recent <code>css4j-dom4j</code> artifacts are
336+
compatible with <code>css4j</code> artifacts that have the same major version number, for example both
337+
<code>css4j-dom4j</code> 3.5.2 and 3.6.0 are compatible with <code>css4j</code> 3.9.1.</p>
338+
<p>If your project is modular you will need this:</p>
339+
<pre class="code"><code class="language-java">requires io.sf.carte.css4j.dom4j;
340+
requires io.sf.carte.xml.dtd; // Only if you use DefaultEntityResolver
341+
</code></pre>
329342
<h3 class="subtema" id="dom4j-parsing">Loading and parsing an XML document</h3>
330343
<p>This is the easiest way to parse an XML document to use this package with DOM4J, using that library's <code>SAXReader</code>:</p>
331344
<pre class="code"><code class="language-java">SAXReader reader = new SAXReader(XHTMLDocumentFactory.getInstance());
@@ -334,7 +347,10 @@ <h3 class="subtema" id="dom4j-parsing">Loading and parsing an XML document</h3>
334347
XHTMLDocument document = (XHTMLDocument) reader.read(re);
335348
</code></pre>
336349
<p>As you see, a document factory called <a class="codeitem" href="api/latest/io.sf.carte.css4j.dom4j/io/sf/carte/doc/dom4j/XHTMLDocumentFactory.html">XHTMLDocumentFactory</a>
337-
is used.</p>
350+
is used. And as mentioned previously, the <a class="codeitem" href=
351+
"api/latest/io.sf.carte.xml.dtd/io/sf/carte/doc/xml/dtd/DefaultEntityResolver.html">DefaultEntityResolver</a>
352+
class is provided by the <a href="https://github.com/css4j/xml-dtd"><code>xml-dtd</code></a>
353+
project.</p>
338354
<p>Once you got the element you want the computed style for (see, for example, the
339355
<a href="https://github.com/dom4j/dom4j/wiki/Quick-Start-Guide" target="_blank">DOM4J Quick Start Guide</a>), just get it with a procedure analogous to the
340356
<a href="https://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.html#CSS-ViewCSS" target="_blank"><code>ViewCSS</code></a>

0 commit comments

Comments
 (0)