VirtualBox

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

最後變更 在這個檔案從99507是 98584,由 vboxsync 提交於 2 年 前

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

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 2.6 KB
 
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>
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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