Problem to use a catalog with ANT script

Having trouble installing Oxygen? Got a bug to report? Post it all here.
jvanhille
Posts: 8
Joined: Tue Jan 27, 2015 2:36 pm

Problem to use a catalog with ANT script

Post by jvanhille »

Hello,

I would like to use a XML catalog in my ANT script. See below an extract of my script :

Code: Select all

<xmlvalidate failonerror="yes" lenient="no" warn="yes"
classname="org.apache.xerces.parsers.SAXParser">
<classpath location="../tools/xercesImpl.jar"/>
<classpath location="../apache-ant-1.9.6/lib/ant-apache-resolver.jar"/>
<fileset dir="${outdir}" includes="*.ata"/>
<!--<property name="http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
value="${xsd.file}"/>-->
<attribute name="http://apache.org/xml/features/validation/schema" value="true"/>
<attribute name="http://xml.org/sax/features/namespaces" value="true"/>
<xmlcatalog>
<catalogpath path="..\catalog.xml" location="..\catalog.xml"/>
</xmlcatalog>
</xmlvalidate>
I tried to put the acces to resolver but it didn't work. I have always this message "Warning: XML resolver not found; external catalogs will be ignored"

See below the complete trace of my script :

Code: Select all

Executing:
"c:\mesprogrammes\oxygen xml editor 16\jre/bin/java" -Xmx256m -classpath "C:\Mesprogrammes\Oxygen XML Editor 16\tools\ant/lib/ant-launcher.jar" "-Dant.home=C:\Mesprogrammes\Oxygen XML Editor 16\tools\ant" org.apache.tools.ant.launch.Launcher -lib "C:\Mesprogrammes\Oxygen XML Editor 16\tools\ant\lib\ant-apache-resolver.jar" -f "S1000d2Ata.xml" "-Dmanuel=ESM" "-Dwebhelp.trial.license=no"

Buildfile: C:\Users\jvanhille\Documents\SNECMA\03-DEVELOPPEMENT\INDIGO\BATCHConverter\build\S1000d2Ata.xml
[echo] DEBUT C:\Users\jvanhille\Documents\SNECMA\03-DEVELOPPEMENT\INDIGO\BATCHConverter\DATA\INPUT_ESM
[xslt] Transforming into C:\Users\jvanhille\Documents\SNECMA\03-DEVELOPPEMENT\INDIGO\BATCHConverter\DATA\OUTPUT_ESM
Warning: XML resolver not found; external catalogs will be ignored
[xmlvalidate] C:\Users\jvanhille\Documents\SNECMA\03-DEVELOPPEMENT\INDIGO\BATCHConverter\DATA\OUTPUT_ESM\procedure_DMC-LEAP-1C-722413-01A-250A-C_000-01_SX-US_DELETED.ata:1:480: schema_reference.4: Failed to read schema document 'http://www.snecma.com/techpub/schemas/ata/em.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
[xmlvalidate] C:\Users\jvanhille\Documents\SNECMA\03-DEVELOPPEMENT\INDIGO\BATCHConverter\DATA\OUTPUT_ESM\procedure_DMC-LEAP-1C-722413-01A-250A-C_000-01_SX-US_DELETED.ata:1:480: cvc-elt.1: Cannot find the declaration of element 'task'.
[xmlvalidate] C:\Users\jvanhille\Documents\SNECMA\03-DEVELOPPEMENT\INDIGO\BATCHConverter\DATA\OUTPUT_ESM\procedure_DMC-LEAP-1C-722413-01A-250A-C_000-01_SX-US_DELETED.ata:1:480: schema_reference.4: Failed to read schema document 'http://www.snecma.com/techpub/schemas/ata/em.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
[xmlvalidate] C:\Users\jvanhille\Documents\SNECMA\03-DEVELOPPEMENT\INDIGO\BATCHConverter\DATA\OUTPUT_ESM\procedure_DMC-LEAP-1C-722413-01A-250A-C_000-01_SX-US_DELETED.ata:1:480: schema_reference.4: Failed to read schema document 'http://www.snecma.com/techpub/schemas/ata/em.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

The process finished with exit code: 1
Thank you for your help
Radu
Posts: 9434
Joined: Fri Jul 09, 2004 5:18 pm

Re: Problem to use a catalog with ANT script

Post by Radu »

Hi,

So specifying the path to the catalog something like this:

Code: Select all

        <xmlcatalog>
<catalogpath>
<pathelement location="../catalog.xml"/>
</catalogpath>
</xmlcatalog>
should work both when running the script on Linux and Windows operating systems.
Of course the path is usually relative to the base directory of the build file.
Usually on the <project> root element of the build file you can add an attribute like:

Code: Select all

 basedir="."
to signal that the place where the build file is located is the base folder for all relative references. But possibly this is also the default behavior.

One more thing, if you edit the ANT transformation scenario in Oxygen, in the Options tab it has a Libraries button. Could you add to that list the references to the Xerces and Resolver libraries that you added in the build file?
Because I'm not sure that just specifying the classpath in the xmlvalidate will actually load those JAR libraries in the ANT process class loader.


Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jvanhille
Posts: 8
Joined: Tue Jan 27, 2015 2:36 pm

Re: Problem to use a catalog with ANT script

Post by jvanhille »

Hi Radu,

Thank you for your help.

You're right, when I specified the location of the resolver like this

Code: Select all

<classpath location="../tools/resolver.jar"/>
. It didn't work. When I added it with ant option -lib it works.

But previously I didn't use the correct library. I used

Code: Select all

ant-apache-resolver.jar 
and it was not correct.

It has to be used

Code: Select all

resolver.jar
.

Best Regards
Post Reply