~ubuntu-branches/ubuntu/wily/libpgjava/wily

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
<?xml version="1.0"?>
<!--

  Copyright (c) 2004-2011, PostgreSQL Global Development Group

  Build file to allow ant (http://ant.apache.org/) to be used
  to build the PostgreSQL JDBC Driver.

  This file now requires Ant 1.4.1.  2002-04-18


-->

<!DOCTYPE project [
  <!ENTITY jarfiles "postgresql.jar">
]>

<project name="postgresqlJDBC" default="all" basedir=".">

  <!-- set global properties for this build -->
  <property name="srcdir"  value="." />
  <property name="jardir"  value="jars" />
  <property name="builddir" value="build" />
  <property name="package" value="org/postgresql" />
  <property name="debug" value="on" />

  <!-- default build parameters are in build.properties, these may be
       overridden by local configuration settings in build.local.properties
  -->
  <property file="build.local.properties" />
  <property file="build.properties"/>

  <target name="check_versions">
    <condition property="jdbc2">
      <or>
        <equals arg1="${java.specification.version}" arg2="1.2"/>
        <equals arg1="${java.specification.version}" arg2="1.3"/>
      </or>
    </condition>
    <condition property="jdbc3">
        <equals arg1="${java.specification.version}" arg2="1.4"/>
    </condition>
    <condition property="jdbc3g">
	<equals arg1="${java.specification.version}" arg2="1.5"/>
    </condition>
    <condition property="jdbc4">
        <equals arg1="${java.specification.version}" arg2="1.6"/>
    </condition>
    <condition property="jdbc41">
      <or>
	<equals arg1="${java.specification.version}" arg2="1.7"/>
        <equals arg1="${java.specification.version}" arg2="1.8"/>
      </or>
    </condition>
    <condition property="jdbc4any">
      <or>
        <isset property="jdbc4" />
	<isset property="jdbc41" />
      </or>
    </condition>
    <condition property="jdbc3any">
      <or>
        <isset property="jdbc3" />
	<isset property="jdbc3g" />
      </or>
    </condition>
    <condition property="jdbc3plus">
      <or>
        <isset property="jdbc3any" />
	<isset property="jdbc4any" />
      </or>
    </condition>

    <condition property="unknownjvm">
      <not>
        <or>
          <isset property="jdbc2" />
          <isset property="jdbc3any" />
          <isset property="jdbc4any" />
        </or>
      </not>
    </condition>

    <fail if="jdbc2" message="1.4 or higher JDK is required to build the JDBC driver." />
    <fail if="unknownjvm" message="Unknown JDK version." />

    <available property="junit" classname="junit.framework.Test"/>
    <available property="junit.task" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>

    <condition property="jdbc4tests">
      <and>
        <isset property="jdbc4any" />
        <isset property="junit" />
      </and>
    </condition>
  </target>


  <!-- default target -->
  <target name="all">
    <antcall target="jar" />
  </target>


  <!-- create the jar file -->
  <target name="jar" depends="compile">
    <jar jarfile="${jardir}/postgresql.jar">
      <fileset dir="${builddir}">
        <include name="${package}/**/*.class" />
      </fileset>

      <fileset dir="${srcdir}">
        <include name="${package}/translation/*.class" />
      </fileset>

      <metainf dir="META-INF">
      </metainf>
    </jar>
  </target>


  <target name="compile" depends="prepare,check_versions,driver">

    <available classname="org.postgresql.Driver" property="old.driver.present" />
    <fail message="Old driver was detected on classpath or in jre/lib/ext, please remove and try again." if="old.driver.present" />

    <javac classpath="${srcdir}" srcdir="${srcdir}" destdir="${builddir}" debug="${debug}" source="${java.specification.version}">
      <!-- This is the core of the driver.  It is common for all versions. -->
       <include name="${package}/*.java" />
       <include name="${package}/core/**" />
       <include name="${package}/copy/**" />
       <include name="${package}/fastpath/**" />
       <include name="${package}/geometric/**" />
       <include name="${package}/largeobject/**" />
       <include name="${package}/util/**" />

       <!--      
       Each jdbcN subpackage is used only if the driver supports *at least* that
       revision of JDBC. That is, a JDBC2 build uses only jdbc2, a JDBC3 build
       uses both jdbc2 and jdbc3, etc.
  
       Within those subpackages, classes beginning with "JdbcN" are assumed to be
       the concrete implementations for JDBC version N and are built only if the
       driver supports *exactly* that version. For example, jdbc2/Jdbc2Statement.java
       is built only if the driver build is a JDBC2 build.
       -->
 
       <!-- jdbc2 subpackage -->
       <include name="${package}/jdbc2/**"/>
 
       <!-- jdbc3 subpackage -->
       <include name="${package}/jdbc3/Abstract*.java" />
       <include name="${package}/jdbc3/PSQLSavepoint.java" />

       <include name="${package}/jdbc3/Jdbc3Array.java" if="jdbc3"/>
       <include name="${package}/jdbc3/Jdbc3Blob.java" if="jdbc3"/>
       <include name="${package}/jdbc3/Jdbc3CallableStatement.java" if="jdbc3"/>
       <include name="${package}/jdbc3/Jdbc3Clob.java" if="jdbc3"/>
       <include name="${package}/jdbc3/Jdbc3Connection.java" if="jdbc3"/>
       <include name="${package}/jdbc3/Jdbc3DatabaseMetaData.java" if="jdbc3"/>
       <include name="${package}/jdbc3/Jdbc3PreparedStatement.java" if="jdbc3"/>
       <include name="${package}/jdbc3/Jdbc3ResultSet.java" if="jdbc3"/>
       <include name="${package}/jdbc3/Jdbc3ResultSetMetaData.java.java" if="jdbc3"/>
       <include name="${package}/jdbc3/Jdbc3Statement.java" if="jdbc3"/>

       <!-- jdbc3g subpackage -->
       <include name="${package}/jdbc3g/*.java" if="jdbc3g" />
       <exclude name="${package}/jdbc3g/Jdbc3g*.java" unless="jdbc3g" />

       <!-- jdbc4 subpackage -->
       <include name="${package}/jdbc4/*.java" if="jdbc4any" />
       <exclude name="${package}/jdcb4/Jdbc4*.java" unless="jdbc4any" />

       <!-- ssl -->
       <include name="${package}/ssl/jdbc4/*.java" if="jdbc4any"/>
       <include name="${package}/ssl/jdbc3/*.java" if="jdbc3any"/>

       <!-- gss -->
       <include name="${package}/gss/*.java" />

       <!-- datasource stuff -->
       <include name="${package}/jdbc3/Jdbc3ConnectionPool.java" if="jdbc3any" />
       <include name="${package}/jdbc3/Jdbc3PoolingDataSource.java" if="jdbc3any" />
       <include name="${package}/jdbc3/Jdbc3SimpleDataSource.java" if="jdbc3any" />

       <include name="${package}/ds/*.java" />
       <include name="${package}/ds/common/*.java" />
       <include name="${package}/ds/jdbc23/*.java" />
       <include name="${package}/ds/jdbc4/*.java" if="jdbc4any" />

       <!-- XA stuff -->
       <include name="${package}/xa/*.java" />
       <include name="${package}/xa/jdbc3/*.java" />
       <include name="${package}/xa/jdbc4/*.java" if="jdbc4any" />

    </javac>
  </target>

  <target name="check_driver">
    <uptodate targetfile="${package}/Driver.java" property="driver.uptodate">
      <srcfiles dir=".">
      <include name="${package}/Driver.java.in"/>
      <include name="${package}/ds/PGSimpleDataSource.java.in"/>
      <include name="${package}/ds/PGPoolingDataSource.java.in"/>
      <include name="${package}/ds/PGPooledConnection.java.in"/>
      <include name="${package}/ds/PGConnectionPoolDataSource.java.in" />
      <include name="${package}/xa/PGXADataSource.java.in" />
      <include name="build.properties"/>
      <include name="build.local.properties" />
      </srcfiles>
    </uptodate>
  </target>

  <!--
    This generates Driver.java from Driver.java.in
    It's required for importing the driver version properties
  -->
  <target name="driver" depends="prepare,check_versions,check_driver"
          unless="driver.uptodate">
    <!-- determine the edition text -->
    <condition property="edition" value="JDBC3">
        <equals arg1="${jdbc3}" arg2="true"/>
    </condition>
    <condition property="edition" value="JDBC3g">
    	<equals arg1="${jdbc3g}" arg2="true" />
    </condition>
    <condition property="edition" value="JDBC4">
	<equals arg1="${jdbc4}" arg2="true" />
    </condition>
    <condition property="edition" value="JDBC4.1">
	<equals arg1="${jdbc41}" arg2="true" />
    </condition>

    <!-- determine the connection class -->
    <condition property="connectclass" value="org.postgresql.jdbc3.Jdbc3Connection">
        <equals arg1="${jdbc3}" arg2="true"/>
    </condition>
    <condition property="connectclass" value="org.postgresql.jdbc3g.Jdbc3gConnection">
        <equals arg1="${jdbc3g}" arg2="true"/>
    </condition>
    <condition property="connectclass" value="org.postgresql.jdbc4.Jdbc4Connection">
        <equals arg1="${jdbc4any}" arg2="true" />
    </condition>

    <condition property="notimplementedexception" value="java.sql.SQLException">
        <equals arg1="${jdbc3any}" arg2="true" />
    </condition>
    <condition property="notimplementedexception" value="java.sql.SQLFeatureNotSupportedException">
        <equals arg1="${jdbc4any}" arg2="true" />
    </condition>

    <condition property="simpledsclass" value="org.postgresql.ds.jdbc23.AbstractJdbc23SimpleDataSource">
        <equals arg1="${jdbc3any}" arg2="true" />
    </condition>
    <condition property="simpledsclass" value="org.postgresql.ds.jdbc4.AbstractJdbc4SimpleDataSource">
        <equals arg1="${jdbc4any}" arg2="true" />
    </condition>

    <condition property="poolingdsclass" value="org.postgresql.ds.jdbc23.AbstractJdbc23PoolingDataSource">
        <equals arg1="${jdbc3any}" arg2="true" />
    </condition>
    <condition property="poolingdsclass" value="org.postgresql.ds.jdbc4.AbstractJdbc4PoolingDataSource">
        <equals arg1="${jdbc4any}" arg2="true" />
</condition>

    <condition property="pooledconnclass" value="org.postgresql.ds.jdbc23.AbstractJdbc23PooledConnection">
        <equals arg1="${jdbc3any}" arg2="true" />
    </condition>
    <condition property="pooledconnclass" value="org.postgresql.ds.jdbc4.AbstractJdbc4PooledConnection">
        <equals arg1="${jdbc4any}" arg2="true" />
    </condition>

    <condition property="connpooldsclass" value="org.postgresql.ds.jdbc23.AbstractJdbc23ConnectionPoolDataSource">
        <equals arg1="${jdbc3any}" arg2="true" />
    </condition>
    <condition property="connpooldsclass" value="org.postgresql.ds.jdbc4.AbstractJdbc4ConnectionPoolDataSource">
        <equals arg1="${jdbc4any}" arg2="true" />
    </condition>

    <condition property="xadsclass" value="org.postgresql.xa.jdbc3.AbstractJdbc3XADataSource">
        <equals arg1="${jdbc3any}" arg2="true" />
    </condition>
    <condition property="xadsclass" value="org.postgresql.xa.jdbc4.AbstractJdbc4XADataSource">
        <equals arg1="${jdbc4any}" arg2="true" />
    </condition>
    <condition property="makesslclass" value="org.postgresql.ssl.jdbc3.AbstractJdbc3MakeSSL">
        <equals arg1="${jdbc3any}" arg2="true" />
    </condition>
    <condition property="makesslclass" value="org.postgresql.ssl.jdbc4.AbstractJdbc4MakeSSL">
        <equals arg1="${jdbc4any}" arg2="true" />
    </condition>
	
    <!-- Some defaults -->
    <filter token="MAJORVERSION" value="${major}" />
    <filter token="MINORVERSION" value="${minor}" />
    <filter token="VERSION" value="PostgreSQL ${fullversion} ${edition}" />
    <filter token="JDBCCONNECTCLASS" value="${connectclass}" />
    <filter token="NOTIMPLEMENTEDEXCEPTION" value="${notimplementedexception}" />
    <filter token="XA_DS_CLASS" value="${xadsclass}" />
    <filter token="POOLING_DS_CLASS" value="${poolingdsclass}" />
    <filter token="SIMPLE_DS_CLASS" value="${simpledsclass}" />
    <filter token="POOLED_CONN_CLASS" value="${pooledconnclass}" />
    <filter token="CONN_POOL_DS_CLASS" value="${connpooldsclass}" />
    <filter token="DEF_PGPORT" value="${def_pgport}" />
    <filter token="MAKE_SSL_CLASS" value="${makesslclass}"/>

     <fail unless="major" message="'major' undefined. Please follow the directions in README."/>
     <fail unless="minor" message="'minor' undefined. Please follow the directions in README."/>
     <fail unless="fullversion" message="'fullversion' undefined. Please follow the directions in README."/>
     <fail unless="def_pgport" message="'def_pgport' undefined. Please follow the directions in README."/>
     <fail unless="enable_debug" message="'enable_debug' undefined. Please follow the directions in README."/>
 
    <!-- Put a check for the current version here -->

    <!-- now copy and filter the file -->
    <copy file="${package}/Driver.java.in"
          overwrite="true"
          tofile="${package}/Driver.java"
          filtering="yes" />
    <copy file="${package}/ds/PGPoolingDataSource.java.in"
          overwrite="true"
          tofile="${package}/ds/PGPoolingDataSource.java"
          filtering="yes" />
    <copy file="${package}/ds/PGSimpleDataSource.java.in"
          overwrite="true"
          tofile="${package}/ds/PGSimpleDataSource.java"
          filtering="yes" />
    <copy file="${package}/ds/PGPooledConnection.java.in"
          overwrite="true"
          tofile="${package}/ds/PGPooledConnection.java"
          filtering="yes" />
    <copy file="${package}/ds/PGConnectionPoolDataSource.java.in"
          overwrite="true"
          tofile="${package}/ds/PGConnectionPoolDataSource.java"
          filtering="yes" />
    <copy file="${package}/xa/PGXADataSource.java.in"
          overwrite="true"
          tofile="${package}/xa/PGXADataSource.java"
          filtering="yes" />
    <copy file="${package}/ssl/MakeSSL.java.in"
          overwrite="true"
          tofile="${package}/ssl/MakeSSL.java"
          filtering="yes" />

  <echo message="Configured build for the ${edition} edition driver." />
  </target>


  <!-- Prepares the build directory -->
  <target name="prepare">
    <!-- use the enable_debug option from configure -->
    <condition property="debug" value="on">
      <and>
        <equals arg1="${enable_debug}" arg2="yes" />
      </and>
    </condition>
    <mkdir dir="${builddir}" />
    <mkdir dir="${jardir}" />
  </target>


  <!-- This target removes any class files from the build directory -->
  <target name="clean">
    <delete quiet="true" dir="${builddir}" />
    <delete quiet="true" dir="${jardir}" />
    <delete quiet="true" file="${package}/Driver.java" />
    <delete quiet="true" file="${package}/ds/PGPoolingDataSource.java" />
    <delete quiet="true" file="${package}/ds/PGSimpleDataSource.java" />
    <delete quiet="true" file="${package}/ds/PGPooledConnection.java" />
    <delete quiet="true" file="${package}/ds/PGConnectionPoolDataSource.java" />
    <delete quiet="true" file="${package}/xa/PGXADataSource.java" />
    <delete quiet="true" file="${package}/ssl/MakeSSL.java" />
  </target>

  <!-- This compiles and executes the JUnit tests -->

  <!-- defaults for the tests - override these if required -->
  <property name="server" value="localhost" />
  <property name="port" value="${def_pgport}" />
  <property name="database" value="test" />
  <property name="username" value="test" />
  <!-- Password must be something.  Doesn't matter if trust is used! -->
  <property name="password" value="password" />
  <property name="preparethreshold" value="5" />
  <property name="loglevel" value="0" />
  <property name="protocolVersion" value="0" />
  <property name="binarytransfer" value="true" />
  <property name="forcebinary" value="true" />
  <property name="ssltest.properties" value="ssltest.properties" />

  <!-- The tests now build to a separate directory and jarfile from the
       driver build, to ensure we're really testing against the jar we just
       built, and not whatever happens to be in builddir. -->

  <!-- This compiles and builds the test jarfile. -->  
  <target name="testjar" depends="jar">
    <fail message="JUnit could not be found in your classpath.  You must download and install it from http://junit.org to build and run the test suite." unless="junit" />
    <mkdir dir="${builddir}/tests"/>
    <javac srcdir="${srcdir}" destdir="${builddir}/tests" debug="${debug}" source="${java.specification.version}">
      <include name="${package}/test/**" />

      <exclude name="${package}/test/jdbc4/**" unless="jdbc4tests" />
      <exclude name="${package}/test/ssl/**" unless="jdbc4tests" />

      <classpath>
        <pathelement location="${jardir}/postgresql.jar"/>
      </classpath>
    </javac>
    <jar jarfile="${jardir}/postgresql-tests.jar" basedir="${builddir}/tests"/>
  </target>
    
  <!-- This actually runs the tests -->
  <target name="runtest" depends="testjar">
    <fail message="Your version of ant doesn't seem to have the junit task available.  I looked for org.apache.tools.ant.taskdefs.optional.junit.JUnitTask, but I couldn't find it." unless="junit.task" />

    <delete file="postgresql-jdbc-tests.debug.txt"/>

    <property name="testResultsDir" value="${builddir}/testresults" />
    <mkdir dir="${testResultsDir}" />
 
    <junit>
      <formatter type="brief" usefile="false"/>
      <formatter type="xml" usefile="true" />

      <sysproperty key="server" value="${server}" />
      <sysproperty key="port" value="${port}" />
      <sysproperty key="database" value="${database}" />
      <sysproperty key="username" value="${username}" />
      <sysproperty key="password" value="${password}" />
      <sysproperty key="preparethreshold" value="${preparethreshold}" />
      <sysproperty key="loglevel" value="${loglevel}" />
      <sysproperty key="protocolVersion" value="${protocolVersion}" />
      <sysproperty key="binaryTransfer" value="${binarytransfer}" />
      <sysproperty key="org.postgresql.forcebinary" value="${forcebinary}" />
      <sysproperty key="ssltest.properties" value="${ssltest.properties}" />

      <classpath>
        <pathelement location="${jardir}/postgresql.jar" />
        <pathelement location="${jardir}/postgresql-tests.jar" />
        <pathelement path="${java.class.path}" />
      </classpath>
      <test name="org.postgresql.test.jdbc2.Jdbc2TestSuite" outfile="${testResultsDir}/jdbc2"/>
      <test name="org.postgresql.test.jdbc2.optional.OptionalTestSuite" outfile="${testResultsDir}/jdbc2optional"/>
      <test name="org.postgresql.test.jdbc3.Jdbc3TestSuite" outfile="${testResultsDir}/jdbc3"/>
      <test name="org.postgresql.test.xa.XATestSuite" outfile="${testResultsDir}/xa"/>
      <test name="org.postgresql.test.extensions.ExtensionsSuite" outfile="${testResultsDir}/extensions"/>
      <test name="org.postgresql.test.jdbc4.Jdbc4TestSuite" if="jdbc4tests" outfile="${testResultsDir}/jdbc4"/>
      <test name="org.postgresql.test.ssl.SslTestSuite" if="jdbc4tests" outfile="${testResultsDir}/ssl"/>
    </junit>
  </target>
  
  <!-- Build and run the tests. -->
  <target name="test" depends="testjar,runtest"/>

  <!-- Build public javadoc -->
  <target name="publicapi" depends="compile">
    <mkdir dir="${builddir}/publicapi" />
    <javadoc destdir="${builddir}/publicapi">
      <classpath>
        <pathelement path="${builddir}" />
        <pathelement path="${java.class.path}" />
      </classpath>
      <fileset dir="${package}">
        <include name="copy/*.java" />
        <include name="geometric/*.java" />
        <include name="largeobject/*.java" />
        <include name="fastpath/*.java" />
        <include name="PG*.java" />
        <include name="util/PGobject.java" />
        <include name="util/PGmoney.java" />
        <include name="util/PGInterval.java" />
        <include name="util/ServerErrorMessage.java" />
	<include name="ssl/WrappedFactory.java" />
	<include name="ssl/NonValidatingFactory.java" />
	<include name="ds/PG*.java" />
	<include name="ds/common/BaseDataSource.java" />
	<include name="xa/PGXADataSource.java" />
      </fileset>
      <link href="/usr/share/doc/default-jdk-doc/api" />
    </javadoc>
  </target>

  <!-- Build driver-internal javadoc. NB: needs Ant 1.6 & JDK 1.4 for 'breakiterator'. -->
  <target name="privateapi" depends="compile">
    <javadoc destdir="${builddir}/privateapi" breakiterator="yes">
      <classpath>
        <pathelement path="${builddir}" />
        <pathelement path="${java.class.path}" />
      </classpath>
      <fileset dir="${package}">
        <include name="**/*.java"/>
	<exclude name="jdbc3/Jdbc3*.java" unless="jdbc3" />
	<exclude name="jdbc3g/Jdbc3g*.java" unless="jdbc3g" />
	<exclude name="jdbc4/*.java" unless="jdbc4any" />
	<exclude name="ds/jdbc4/*.java" unless="jdbc4any" />
        <exclude name="test/**/*.java"/>
      </fileset>
    </javadoc>
  </target>

  <!-- Build the documentation -->
  <target name="doc" depends="prepare">
   <mkdir dir="${builddir}/doc"/>
   <xslt basedir="doc" destdir="${builddir}/doc" includes="*.xml" force="yes" style="${docbook.stylesheet}">
     <param name="base.dir" expression="${builddir}/doc/"/>
     <param name="use.id.as.filename" expression="1" />
   </xslt>
  </target>

  <!-- Blah. Can't reference an external XML catalog until Ant 1.6.
       So instead we copy the contents of ${docbook.dtd}/catalog.xml
       here, in the form that Ant's xmlcatalog element wants. -->
  <xmlcatalog id="docbook-catalog">  
    <dtd publicId="-//OASIS//DTD DocBook XML V4.2//EN"
      location="${docbook.dtd}/docbookx.dtd"/>
    <entity publicId="-//OASIS//DTD DocBook CALS Table Model V4.2//EN"
      location="${docbook.dtd}/calstblx.dtd"/>
    <entity publicId="-//OASIS//DTD XML Exchange Table Model 19990315//EN"
      location="${docbook.dtd}/soextblx.dtd"/>
    <entity publicId="-//OASIS//ELEMENTS DocBook Information Pool V4.2//EN"
      location="${docbook.dtd}/dbpoolx.mod"/>    
    <entity publicId="-//OASIS//ELEMENTS DocBook Document Hierarchy V4.2//EN"
      location="${docbook.dtd}/dbhierx.mod"/>    
    <entity publicId="-//OASIS//ENTITIES DocBook Additional General Entities V4.2//EN"
      location="${docbook.dtd}/dbgenent.mod"/>    
    <entity publicId="-//OASIS//ENTITIES DocBook Notations V4.2//EN"
      location="${docbook.dtd}/dbnotnx.mod"/>
    <entity publicId="-//OASIS//ENTITIES DocBook Character Entities V4.2//EN"
      location="${docbook.dtd}/dbcentx.mod"/>
  </xmlcatalog>

  <!-- Validate but don't process the documentation.
       This target expects the DocBook XML DTDs, available at
       http://www.docbook.org/xml/4.2/docbook-xml-4.2.zip, to be
       present in ${docbook.dtd}. If they're not present, they will
       be fetched on each validation from www.oasis-open.org.

       Note that if the DTD fetch fails, validation fails with a fairly
       useless error message. Run ant with -verbose to get a more useful
       error. You'll need to set the java properties http.proxyHost and
       http.proxyPort if you need to go via a proxy to fetch the DTDs.
  -->
       
  <target name="validate-doc" depends="prepare">
    <xmlvalidate warn="true">
      <fileset dir="doc" includes="*.xml"/>
      <xmlcatalog refid="docbook-catalog"/>
    </xmlvalidate>
  </target>

</project>