| <?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> and <i>Parser</i> objects: its goal is to parse a given source model |
| using a given parser, and emits Doxia events into the given sink.</p> |
| |
| <h2>Using Maven Doxia API</h2> |
| <p>The following snippet shows how to use the Doxia API:</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 inputFile = </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.apt" </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">Reader source = ReaderFactory.newReader</font><font color="#000000">( </font><font color="#000000">inputFile, </font><font color="#2a00ff">"UTF-8" </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="#000000">Doxia doxia = </font><font color="#000000">(</font><font color="#000000">Doxia</font><font color="#000000">) </font><font color="#000000">lookup</font><font color="#000000">( </font><font color="#000000">Doxia.ROLE </font><font color="#000000">)</font><font color="#000000">; </font><font color="#3f7f5f">// Plexus lookup</font><br /> |
| <font color="#ffffff"></font><br /> |
| <font color="#ffffff"> </font><font color="#000000">doxia.parse</font><font color="#000000">( </font><font color="#000000">source, </font><font color="#2a00ff">"apt"</font><font color="#000000">, sink </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> |