VirtualBox

source: vbox/trunk/src/libs/dita-ot-1.8.5/docsrc/dev_ref/plugin-javalib.dita@ 98997

Last change on this file since 98997 was 98584, checked in by vboxsync, 2 years ago

Docs: bugref:10302. Setting svn properties of DITA-OT library.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN"
3 "reference.dtd">
4<reference id="plugin-javalib" xml:lang="en-us">
5<title>Adding Java libraries to the classpath</title>
6<shortdesc>If your Ant or XSLT extensions require additional Java
7libraries in the classpath, you can add them to the global DITA-OT
8classpath with the following feature.</shortdesc>
9<refbody>
10<section> <dl><dlentry>
11<dt><codeph>dita.conductor.lib.import</codeph></dt>
12<dd>Add Java libraries to DITA-OT classpath.</dd>
13</dlentry></dl> </section>
14<example><title>Example</title><p>The following plug-in adds the compiled
15Java code from <filepath>myJavaLibrary.jar</filepath> into the global
16DITA-OT classpath. XSLT or Ant code can then make use of the added
17code.</p><codeblock>&lt;plugin id="com.example.addjar">
18 &lt;feature extension="dita.conductor.lib.import" file="myJavaLibrary.jar"/>
19&lt;/plugin></codeblock><p>Now assume that in this case myJavaLibrary.jar
20performs some validation step in the middle of processing, and you
21always want it to run immediately before the conref step. In that
22case you need to make use of several features in this plug-in</p><ul>
23<li>The JAR file must be added to the classpath.</li>
24<li>An Ant target must be created that uses this class, and the Ant
25wrapper integrated into the code.</li>
26<li>The Ant target must be added to the dependency chain for conref.</li>
27</ul><p>In this extended example, the files might look something like
28this.</p><codeblock>plugin.xml:
29&lt;?xml version="1.0" encoding="UTF-8"?>
30&lt;plugin id="com.example.samplejava">
31 &lt;!-- Add the JAR file to the DITA-OT CLASSPATH -->
32 <b>&lt;feature extension="dita.conductor.lib.import" file="com.example.sampleValidation.jar"/></b>
33 &lt;!-- Integrate the Ant code -->
34 &lt;feature extension="dita.conductor.target.relative" file="antWrapper.xml"/>
35 &lt;!-- Define the Ant target that is called, and the location (before conref) -->
36 &lt;feature extension="depend.preprocess.conref.pre" value="validateWithJava"/>
37&lt;/plugin>
38
39antWrapper.xml imports the new Ant code:
40&lt;?xml version="1.0" encoding="UTF-8"?>
41&lt;dummy>
42 &lt;import file="calljava-antcode.xml"/>
43&lt;/dummy>
44
45calljava-antcode.xml:
46&lt;?xml version="1.0" encoding="UTF-8"?>
47&lt;project default="validateWithJava">
48 &lt;target name="validateWithJava">
49 &lt;java classname="com.example.sampleValidation">
50 &lt;!-- The class was added to dost.class.path (the DITA-OT classpath) -->
51 &lt;classpath refid="dost.class.path"/>
52 &lt;/java>
53 &lt;/target>
54&lt;/project></codeblock></example>
55</refbody>
56</reference>
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette