| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <!DOCTYPE html
- SYSTEM "about:legacy-compat">
- <html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2018"><meta name="DC.rights.owner" content="(C) Copyright 2018"><meta name="DC.Type" content="concept"><meta name="description" content="DITA-OT includes a Java Application Programming Interface to allow developers to embed DITA-OT more easily into other Java programs."><meta name="DC.subject" content="Java API, API:Java"><meta name="keywords" content="Java API, API:Java"><meta name="DC.Relation" scheme="URI" content="../reference/index.html"><meta name="DC.Relation" scheme="URI" content="../api/index.html"><meta name="DC.Format" content="HTML5"><meta name="DC.Identifier" content="API"><link rel="stylesheet" type="text/css" href="../css/commonltr.css"><link rel="stylesheet" type="text/css" href="../css/dita-ot-doc.css"><title>Java API</title></head><body id="API"><header role="banner"><div class="header">
- <p>DITA Open Toolkit</p>
- <hr>
- </div></header><nav role="toc"><ul><li><a href="../index.html">DITA Open Toolkit 3.0</a></li><li><a href="../release-notes/index.html">Release Notes</a></li><li><a href="../topics/installing-client.html">Installing DITA-OT</a></li><li><a href="../topics/alternative-input-formats.html">Authoring formats</a></li><li><a href="../topics/building-output.html">Building output</a></li><li><a href="../parameters/index.html">Setting parameters</a></li><li><a href="../topics/extending-the-ot.html">Customizing DITA-OT</a></li><li><a href="../topics/troubleshooting-overview.html">Troubleshooting</a></li><li><a href="../reference/index.html">Reference</a><ul><li><a href="../reference/architecture.html">DITA-OT architecture</a></li><li><a href="../reference/DITA_spec-support.html">DITA specification support</a></li><li class="active"><a href="../reference/java-api.html">Java API</a></li><li><a href="../reference/license.html">License</a></li></ul></li><li><a href="../topics/dita-and-dita-ot-resources.html">Resources</a></li></ul></nav><main role="main"><article role="article" aria-labelledby="ariaid-title1">
- <h1 class="title topictitle1" id="ariaid-title1">Java API</h1>
-
-
- <div class="body conbody"><p class="shortdesc">DITA-OT includes a Java Application Programming Interface to allow developers to embed DITA-OT more easily
- into other Java programs.</p>
- <p class="p">When using the API, programmers don't need to know or care that DITA-OT uses Ant, they can just use Java. </p>
- <div class="note note note_note"><span class="note__title">Note:</span> When running DITA-OT via the <span class="keyword cmdname">dita</span> command, an <code class="ph codeph">ant</code> shell script handles the
- classpath setup, but when using the API the classpath should be set up as part of the normal classpath
- configuration for the Java application.</div>
- <div class="example"><h2 class="title sectiontitle">Example usage</h2>
-
- <pre class="pre codeblock language-java"><code>// Create a reusable processor factory with DITA-OT base directory and temporary directory
- ProcessorFactory pf = ProcessorFactory.newInstance(ditaDir);
- pf.setBaseTempDir(tempDir);
- // Create a processor using the factory and configure the processor
- Processor p = pf.newProcessor("html5")
- .setInput(mapFile)
- .setOutputDir(outDir)
- .setProperty("nav-toc", "partial");
- // Run conversion
- p.run();</code></pre>
- </div>
- <section class="section">
- <p class="p">By default, running DITA-OT via the API will write a debug log to the temporary directory. A custom SLF4J
- logger can also be used to access the log via the Simple Logging Facade for Java.</p>
- <p class="p">The processor cleans the temporary directory by default, but this can be disabled to simplify debugging in
- cases where the processor failed.</p>
- <div class="note tip note_tip"><span class="note__title">Tip:</span> See the <cite class="cite">DITA-OT Java API documentation</cite> in the <span class="ph filepath">doc/api/</span> folder
- of the DITA-OT distribution package for information on the packages, classes, interfaces and methods provided by
- the Java API.</div>
- </section>
- <section class="section"><h2 class="title sectiontitle">Downloading DITA-OT from Maven Central</h2>
-
- <p class="p">As of version 2.5, the DITA Open Toolkit base library (<span class="ph filepath">dost.jar</span>) is available via the
- Maven 2 Central Repository. You can use this mechanism to download the main JAR file and include it in the build
- for other Java projects.</p>
- <p class="p">To locate the latest version, <a class="xref" href="https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.dita-ot%22" target="_blank">search for the <code class="ph codeph">org.dita-ot</code> group ID</a>.</p>
- <div class="note important note_important"><span class="note__title">Important:</span> The <span class="ph filepath">dost.jar</span> file provides only the DITA Open Toolkit base library. It
- does <strong class="ph b">not</strong> contain the full DITA-OT distribution and cannot be used to run DITA-OT by itself. You will need
- to ensure that your build installs the other files and directories required for the toolkit along with the
- dependencies for your project.</div>
- </section>
- </div>
- <nav role="navigation" class="related-links"><div class="familylinks"><div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="../reference/index.html" title="The Reference topics provide more advanced information about the DITA-OT architecture, API and specification support, and licensing.">Reference</a></div></div><div class="linklist relinfo"><strong>Related information</strong><br><ul class="linklist"><li class="linklist"><a class="link" href="../api/index.html">DITA-OT Java API documentation</a></li></ul></div></nav></article></main></body></html>
|