| <?xml version="1.0" encoding="UTF-8"?> |
| |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| <body> |
| <h1>Maven Doxia API.</h1> |
| <p>The Doxia API is based on <i>Sinks</i> objects: each sink consumes Doxia events to produce a resultant output |
| format (eg Docbook, PDF, XHTML...).</p> |
| |
| <h2>Using Maven Doxia API</h2> |
| <p>The following snippet shows how to use a Doxia <code>Sink</code>:</p> |
| |
| <div align="left" class="java"> |
| <table border="0" cellpadding="3" cellspacing="0" bgcolor="#ffffff"> |
| <tr> |
| <!-- start source code --> |
| <td nowrap="nowrap" valign="top" align="left"><code> <font |
| color="#ffffff"> </font><font color="#000000">File userDir = </font><font |
| color="#7f0055"><b>new </b></font><font color="#000000">File</font><font |
| color="#000000">( </font><font color="#000000">System.getProperty </font><font |
| color="#000000">( </font><font color="#2a00ff">"user.dir" </font><font |
| color="#000000">) )</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"> </font><font color="#000000">File outputFile = </font><font |
| color="#7f0055"><b>new </b></font><font color="#000000">File</font><font |
| color="#000000">( </font><font color="#000000">userDir, </font><font |
| color="#2a00ff">"test.html" </font><font color="#000000">)</font><font |
| color="#000000">;</font><br /> |
| <font color="#ffffff"></font><br /> |
| <font color="#ffffff"> </font><font color="#000000">SinkFactory sinkFactory = </font><font |
| color="#000000">(</font><font color="#000000">SinkFactory</font><font |
| color="#000000">) </font><font color="#000000">lookup</font><font |
| color="#000000">( </font><font color="#000000">SinkFactory.ROLE, </font><font |
| color="#2a00ff">"html" </font><font color="#000000">)</font><font |
| color="#000000">; </font><font color="#3f7f5f">// Plexus lookup</font><br /> |
| <font color="#ffffff"> </font><font color="#000000">Sink sink = sinkFactory.createSink</font><font |
| color="#000000">( </font><font color="#000000">outputFile.getParentFile</font><font |
| color="#000000">()</font><font color="#000000">, outputFile.getName</font><font |
| color="#000000">() ) )</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"></font><br /> |
| <font color="#ffffff"> </font><font color="#3f7f5f">// Sink head</font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.head</font><font |
| color="#000000">()</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"></font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.title</font><font |
| color="#000000">()</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.text</font><font |
| color="#000000">( </font><font color="#2a00ff">"Title" </font><font |
| color="#000000">)</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.title_</font><font |
| color="#000000">()</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"></font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.author</font><font |
| color="#000000">()</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.text</font><font |
| color="#000000">( </font><font color="#2a00ff">"Author" </font><font |
| color="#000000">)</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.author_</font><font |
| color="#000000">()</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"></font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.date</font><font |
| color="#000000">()</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.text</font><font |
| color="#000000">( </font><font color="#2a00ff">"Date" </font><font |
| color="#000000">)</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.date_</font><font |
| color="#000000">()</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"></font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.head_</font><font |
| color="#000000">()</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"> </font><font color="#3f7f5f">// Sink head</font><br /> |
| <font color="#ffffff"></font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.body</font><font |
| color="#000000">()</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"></font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.paragraph</font><font |
| color="#000000">()</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.text</font><font |
| color="#000000">( </font><font color="#2a00ff">"Paragraph 1, line 1. Paragraph 1, line 2." </font><font |
| color="#000000">)</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.paragraph_</font><font |
| color="#000000">()</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"></font><br /> |
| <font color="#ffffff"> </font><font color="#000000">...</font><br /> |
| <font color="#ffffff"></font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.body_</font><font |
| color="#000000">()</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"></font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.flush</font><font |
| color="#000000">()</font><font color="#000000">;</font><br /> |
| <font color="#ffffff"></font><br /> |
| <font color="#ffffff"> </font><font color="#000000">sink.close</font><font |
| color="#000000">()</font><font color="#000000">;</font></code></td> |
| <!-- end source code --> |
| </tr> |
| </table> |
| </div> |
| |
| <h2>Resources</h2> |
| <ul> |
| <li><a href="https://maven.apache.org/doxia/">Maven Doxia Website</a></li> |
| <li><a href="https://codehaus-plexus.github.io/">Plexus</a></li> |
| </ul> |
| </body> |