Run SAXON from ANT with a CATALOG

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Run SAXON from ANT with a CATALOG

Philippe.Favrais
Hello all,

I am trying to execute SAXON from ANT with an XML CATALOG.
I could not run Saxon with a Catalog for an  XSLT ANT task, while it worked  from JAVA ANT TASK
I did a tiny project to show the problem where the  building finish with Warning: XML resolver not found; external catalogs will be ignored and finally a fatal error.
As you can see in the log below, the path included_template.xsl is well resolved at a point of time, but  later in the build i get a warning Warning: XML resolver not found; external catalogs will be ignored an in the end fatal error telling that the fine cannot be found.

Here is the non working solution (ANT XSLT TASK + SAXON + CATALOG)
file : build.xml
<project basedir="." name="build_output" default="generate">
    <!--the output directory-->
    <property name="out.dir" value="output/ecuconfig"/>
    <property name="saxon_jar" value="D:/DATA/ts_mirr/xml/Saxon-EE-9-7/saxon9ee.jar"/>
        <property name="resolver_jar" value="D:/DATA/ts_mirr/xml/xerces-2_11_0/resolver.jar"/>
        <property name="catalog_manager" value="D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement"/>

        <path id="saxon.processor.classpath">                                        
          <pathelement path="${saxon_jar}"/>  <!-- Saxon jar -->
          <pathelement path="${resolver_jar}"/> <!-- resolver jar -->
          <pathelement path="${catalog_manager}"/>
        </path>
           
    <target name="gen">
        <xslt basedir="D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement" style="xsl_schema_aware.xsl" in="project.xmlprj" out="${out.dir}/myoutput.txt" scanincludeddirectories="true">
                <classpath refid="saxon.processor.classpath"/>
            <sysproperty key="org.apache.xerces.xni.parser.XMLParserConfiguration"
                value="org.apache.xerces.parsers.XIncludeParserConfiguration"/>
                <factory name="net.sf.saxon.TransformerFactoryImpl">                    
                        <attribute name="http://saxon.sf.net/feature/uriResolverClass" value="org.apache.xml.resolver.tools.CatalogResolver"/>
                        <attribute name="http://saxon.sf.net/feature/sourceParserClass" value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>                        
                <attribute name="http://saxon.sf.net/feature/xsltSchemaAware" value="true"/>
                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
            </factory>                
                   <xmlcatalog>
                        <catalogpath>
                                <pathelement location="D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/catalog.xml"/>
                         </catalogpath>
                </xmlcatalog>
        </xslt>
    </target>
...
File : catalog.xml
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
        <uri name="included_template.xsl" uri="include_xsl/included_template.xsl"/>
</catalog>

Here is the error i get. Warning: XML resolver not found; external catalogs will be ignored
Does any one have an idea about what is wrong. I?


Buildfile: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\build.xml
gen:
     [xslt] Processing D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\project.xmlprj to D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\output\ecuconfig\myoutput.txt
     [xslt] Loading stylesheet D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl
     [xslt] Parse catalog: catalog.xml
     [xslt] Loading catalog: catalog.xml
     [xslt] Default BASE: file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/catalog.xml
     [xslt] override: no
     [xslt] OVERRIDE: no
     [xslt] uri: included_template.xsl
     [xslt]         include_xsl/included_template.xsl
     [xslt] URI: included_template.xsl
     [xslt]         file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/include_xsl/included_template.xsl
Warning: XML resolver not found; external catalogs will be ignored
     [xslt] D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl:4:44: Fatal Error! I/O error reported by XML parser processing file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/included_template.xsl: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified) Cause: java.io.FileNotFoundException: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified)
     [xslt] D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl:4:44: Fatal Error! I/O error reported by XML parser processing file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/included_template.xsl: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified) Cause: java.io.FileNotFoundException: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified)
     [xslt] D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl:4:44: Fatal Error! I/O error reported by XML parser processing file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/included_template.xsl: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified) Cause: java.io.FileNotFoundException: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified)
     [xslt] Failed to process D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\project.xmlprj

BUILD FAILED
D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\build.xml:16: Fatal error during transformation using D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl: I/O error reported by XML parser processing file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/included_template.xsl: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified); SystemID: file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/xsl_schema_aware.xsl; Line#: 4; Column#: 44



Here is the working solution (ANT JAVA TASK + SAXON + CATALOG)
file : build.xml
<project basedir="." name="build_output" default="generate">    
    <property name="out.dir" value="output/ecuconfig"/> <!--the output directory-->
    <property name="saxon_jar" value="D:/DATA/ts_mirr/xml/Saxon-EE-9-7/saxon9ee.jar"/>
        <property name="resolver_jar" value="D:/DATA/ts_mirr/xml/xerces-2_11_0/resolver.jar"/>

        <!--classpath definition-->
        <path id="saxon.processor.classpath">                                        
          <pathelement path="${saxon_jar}"/>  <!-- Saxon jar -->
          <pathelement path="${resolver_jar}"/> <!-- resolver jar -->
        </path>
       
        <!--clean the out directory-->
        <target name="clean">
        <delete dir="${out.dir}"></delete>
    </target>

        <!--run saxon with xinclude and catalog-->
        <target name="gen">
            <java classname="net.sf.saxon.Transform">
                    <classpath refid="saxon.processor.classpath" />
                    <arg value="-catalog:catalog.xml" />                
                <arg value="-xi:on" />
                <arg value="-s:project.xmlprj" />
                <arg value="-xsl:xsl_schema_aware.xsl" />
                <arg value="-o:${out.dir}/myoutput.txt" />
            </java>
        </target>
....        

File : catalog.xml
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
        <uri name="included_template.xsl" uri="include_xsl/included_template.xsl"/>
</catalog>


Thank you for you help

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: Run SAXON from ANT with a CATALOG

cmarchand

 

 

It's an ANT bug. xslt task does not forward catalog parameters to underlying processor, as there is no standardized API to do this in JAXP.

 

So, if you need to use a catalog, you have no other choice than start a java task, and invoke directly saxon.

 

If you have Oxygen, have a look at frameworks/xspec/build.xml where this problem is shown and commented out.

 

Best regards,

Christophe

 

Le 2016-01-21 11:32, [hidden email] a écrit :

Hello all,

I am trying to execute SAXON from ANT with an XML CATALOG.
I could not run Saxon with a Catalog for an  XSLT ANT task, while it worked  from JAVA ANT TASK
I did a tiny project to show the problem where the  building finish with Warning: XML resolver not found; external catalogs will be ignored and finally a fatal error.
As you can see in the log below, the path included_template.xsl is well resolved at a point of time, but  later in the build i get a warning Warning: XML resolver not found; external catalogs will be ignored an in the end fatal error telling that the fine cannot be found.

Here is the non working solution (ANT XSLT TASK + SAXON + CATALOG)
file : build.xml
<project basedir="." name="build_output" default="generate">
    <!--the output directory-->
    <property name="out.dir" value="output/ecuconfig"/>
    <property name="saxon_jar" value="D:/DATA/ts_mirr/xml/Saxon-EE-9-7/saxon9ee.jar"/>
        <property name="resolver_jar" value="D:/DATA/ts_mirr/xml/xerces-2_11_0/resolver.jar"/>
        <property name="catalog_manager" value="D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement"/>

        <path id="saxon.processor.classpath">                                        
          <pathelement path="${saxon_jar}"/>  <!-- Saxon jar -->
          <pathelement path="${resolver_jar}"/> <!-- resolver jar -->
          <pathelement path="${catalog_manager}"/>
        </path>
           
    <target name="gen">
        <xslt basedir="D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement" style="xsl_schema_aware.xsl" in="project.xmlprj" out="${out.dir}/myoutput.txt" scanincludeddirectories="true">
                <classpath refid="saxon.processor.classpath"/>
            <sysproperty key="org.apache.xerces.xni.parser.XMLParserConfiguration"
                value="org.apache.xerces.parsers.XIncludeParserConfiguration"/>
                <factory name="net.sf.saxon.TransformerFactoryImpl">                    
                        <attribute name="http://saxon.sf.net/feature/uriResolverClass" value="org.apache.xml.resolver.tools.CatalogResolver"/>
                        <attribute name="http://saxon.sf.net/feature/sourceParserClass" value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>                        
                <attribute name="http://saxon.sf.net/feature/xsltSchemaAware" value="true"/>
                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
            </factory>                
                   <xmlcatalog>
                        <catalogpath>
                                <pathelement location="D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/catalog.xml"/>
                         </catalogpath>
                </xmlcatalog>
        </xslt>
    </target>
...
File : catalog.xml
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
        <uri name="included_template.xsl" uri="include_xsl/included_template.xsl"/>
</catalog>

Here is the error i get. Warning: XML resolver not found; external catalogs will be ignored
Does any one have an idea about what is wrong. I?


Buildfile: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\build.xml
gen:
     [xslt] Processing D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\project.xmlprj to D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\output\ecuconfig\myoutput.txt
     [xslt] Loading stylesheet D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl
     [xslt] Parse catalog: catalog.xml
     [xslt] Loading catalog: catalog.xml
     [xslt] Default BASE: file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/catalog.xml
     [xslt] override: no
     [xslt] OVERRIDE: no
     [xslt] uri: included_template.xsl
     [xslt]         include_xsl/included_template.xsl
     [xslt] URI: included_template.xsl
     [xslt]         file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/include_xsl/included_template.xsl
Warning: XML resolver not found; external catalogs will be ignored
     [xslt] D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl:4:44: Fatal Error! I/O error reported by XML parser processing file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/included_template.xsl: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified) Cause: java.io.FileNotFoundException: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified)
     [xslt] D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl:4:44: Fatal Error! I/O error reported by XML parser processing file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/included_template.xsl: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified) Cause: java.io.FileNotFoundException: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified)
     [xslt] D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl:4:44: Fatal Error! I/O error reported by XML parser processing file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/included_template.xsl: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified) Cause: java.io.FileNotFoundException: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified)
     [xslt] Failed to process D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\project.xmlprj

BUILD FAILED
D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\build.xml:16: Fatal error during transformation using D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl: I/O error reported by XML parser processing file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/included_template.xsl: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified); SystemID: file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/xsl_schema_aware.xsl; Line#: 4; Column#: 44



Here is the working solution (ANT JAVA TASK + SAXON + CATALOG)
file : build.xml
<project basedir="." name="build_output" default="generate">    
    <property name="out.dir" value="output/ecuconfig"/> <!--the output directory-->
    <property name="saxon_jar" value="D:/DATA/ts_mirr/xml/Saxon-EE-9-7/saxon9ee.jar"/>
        <property name="resolver_jar" value="D:/DATA/ts_mirr/xml/xerces-2_11_0/resolver.jar"/>

        <!--classpath definition-->
        <path id="saxon.processor.classpath">                                        
          <pathelement path="${saxon_jar}"/>  <!-- Saxon jar -->
          <pathelement path="${resolver_jar}"/> <!-- resolver jar -->
        </path>
       
        <!--clean the out directory-->
        <target name="clean">
        <delete dir="${out.dir}"></delete>
    </target>

        <!--run saxon with xinclude and catalog-->
        <target name="gen">
            <java classname="net.sf.saxon.Transform">
                    <classpath refid="saxon.processor.classpath" />
                    <arg value="-catalog:catalog.xml" />                
                <arg value="-xi:on" />
                <arg value="-s:project.xmlprj" />
                <arg value="-xsl:xsl_schema_aware.xsl" />
                <arg value="-o:${out.dir}/myoutput.txt" />
            </java>
        </target>
....        

File : catalog.xml
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
        <uri name="included_template.xsl" uri="include_xsl/included_template.xsl"/>
</catalog>


Thank you for you help

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: Run SAXON from ANT with a CATALOG

cmarchand
In reply to this post by Philippe.Favrais

https://bz.apache.org/bugzilla/show_bug.cgi?id=47704

Christophe

 

 

Le 2016-01-21 11:32, [hidden email] a écrit :

Hello all,

I am trying to execute SAXON from ANT with an XML CATALOG.
I could not run Saxon with a Catalog for an  XSLT ANT task, while it worked  from JAVA ANT TASK
I did a tiny project to show the problem where the  building finish with Warning: XML resolver not found; external catalogs will be ignored and finally a fatal error.
As you can see in the log below, the path included_template.xsl is well resolved at a point of time, but  later in the build i get a warning Warning: XML resolver not found; external catalogs will be ignored an in the end fatal error telling that the fine cannot be found.

Here is the non working solution (ANT XSLT TASK + SAXON + CATALOG)
file : build.xml
<project basedir="." name="build_output" default="generate">
    <!--the output directory-->
    <property name="out.dir" value="output/ecuconfig"/>
    <property name="saxon_jar" value="D:/DATA/ts_mirr/xml/Saxon-EE-9-7/saxon9ee.jar"/>
        <property name="resolver_jar" value="D:/DATA/ts_mirr/xml/xerces-2_11_0/resolver.jar"/>
        <property name="catalog_manager" value="D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement"/>

        <path id="saxon.processor.classpath">                                        
          <pathelement path="${saxon_jar}"/>  <!-- Saxon jar -->
          <pathelement path="${resolver_jar}"/> <!-- resolver jar -->
          <pathelement path="${catalog_manager}"/>
        </path>
           
    <target name="gen">
        <xslt basedir="D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement" style="xsl_schema_aware.xsl" in="project.xmlprj" out="${out.dir}/myoutput.txt" scanincludeddirectories="true">
                <classpath refid="saxon.processor.classpath"/>
            <sysproperty key="org.apache.xerces.xni.parser.XMLParserConfiguration"
                value="org.apache.xerces.parsers.XIncludeParserConfiguration"/>
                <factory name="net.sf.saxon.TransformerFactoryImpl">                    
                        <attribute name="http://saxon.sf.net/feature/uriResolverClass" value="org.apache.xml.resolver.tools.CatalogResolver"/>
                        <attribute name="http://saxon.sf.net/feature/sourceParserClass" value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>                        
                <attribute name="http://saxon.sf.net/feature/xsltSchemaAware" value="true"/>
                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
            </factory>                
                   <xmlcatalog>
                        <catalogpath>
                                <pathelement location="D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/catalog.xml"/>
                         </catalogpath>
                </xmlcatalog>
        </xslt>
    </target>
...
File : catalog.xml
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
        <uri name="included_template.xsl" uri="include_xsl/included_template.xsl"/>
</catalog>

Here is the error i get. Warning: XML resolver not found; external catalogs will be ignored
Does any one have an idea about what is wrong. I?


Buildfile: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\build.xml
gen:
     [xslt] Processing D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\project.xmlprj to D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\output\ecuconfig\myoutput.txt
     [xslt] Loading stylesheet D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl
     [xslt] Parse catalog: catalog.xml
     [xslt] Loading catalog: catalog.xml
     [xslt] Default BASE: file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/catalog.xml
     [xslt] override: no
     [xslt] OVERRIDE: no
     [xslt] uri: included_template.xsl
     [xslt]         include_xsl/included_template.xsl
     [xslt] URI: included_template.xsl
     [xslt]         file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/include_xsl/included_template.xsl
Warning: XML resolver not found; external catalogs will be ignored
     [xslt] D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl:4:44: Fatal Error! I/O error reported by XML parser processing file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/included_template.xsl: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified) Cause: java.io.FileNotFoundException: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified)
     [xslt] D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl:4:44: Fatal Error! I/O error reported by XML parser processing file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/included_template.xsl: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified) Cause: java.io.FileNotFoundException: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified)
     [xslt] D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl:4:44: Fatal Error! I/O error reported by XML parser processing file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/included_template.xsl: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified) Cause: java.io.FileNotFoundException: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified)
     [xslt] Failed to process D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\project.xmlprj

BUILD FAILED
D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\build.xml:16: Fatal error during transformation using D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl: I/O error reported by XML parser processing file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/included_template.xsl: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified); SystemID: file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/xsl_schema_aware.xsl; Line#: 4; Column#: 44



Here is the working solution (ANT JAVA TASK + SAXON + CATALOG)
file : build.xml
<project basedir="." name="build_output" default="generate">    
    <property name="out.dir" value="output/ecuconfig"/> <!--the output directory-->
    <property name="saxon_jar" value="D:/DATA/ts_mirr/xml/Saxon-EE-9-7/saxon9ee.jar"/>
        <property name="resolver_jar" value="D:/DATA/ts_mirr/xml/xerces-2_11_0/resolver.jar"/>

        <!--classpath definition-->
        <path id="saxon.processor.classpath">                                        
          <pathelement path="${saxon_jar}"/>  <!-- Saxon jar -->
          <pathelement path="${resolver_jar}"/> <!-- resolver jar -->
        </path>
       
        <!--clean the out directory-->
        <target name="clean">
        <delete dir="${out.dir}"></delete>
    </target>

        <!--run saxon with xinclude and catalog-->
        <target name="gen">
            <java classname="net.sf.saxon.Transform">
                    <classpath refid="saxon.processor.classpath" />
                    <arg value="-catalog:catalog.xml" />                
                <arg value="-xi:on" />
                <arg value="-s:project.xmlprj" />
                <arg value="-xsl:xsl_schema_aware.xsl" />
                <arg value="-o:${out.dir}/myoutput.txt" />
            </java>
        </target>
....        

File : catalog.xml
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
        <uri name="included_template.xsl" uri="include_xsl/included_template.xsl"/>
</catalog>


Thank you for you help

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: Run SAXON from ANT with a CATALOG

Michael Kay
In reply to this post by Philippe.Favrais
Are any of the suggestions at


any use?

I'm afraid I don't trust Ant to set up class paths correctly. Have you tried ensuring that the resolver.jar is placed on the external class path, before invoking ant?

Michael Kay
Saxonica




On 21 Jan 2016, at 10:32, [hidden email] wrote:

Hello all,

I am trying to execute SAXON from ANT with an XML CATALOG.
I could not run Saxon with a Catalog for an  XSLT ANT task, while it worked  from JAVA ANT TASK
I did a tiny project to show the problem where the  building finish with Warning: XML resolver not found; external catalogs will be ignored and finally a fatal error.
As you can see in the log below, the path included_template.xsl is well resolved at a point of time, but  later in the build i get a warning Warning: XML resolver not found; external catalogs will be ignored an in the end fatal error telling that the fine cannot be found.



------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: Run SAXON from ANT with a CATALOG

Michael Kay
In reply to this post by Philippe.Favrais
Are any of the suggestions here any use?


I'm afraid it might be false rumour-mongering, but I just don't trust ant to get classpaths right.

Michael Kay
Saxonica


On 21 Jan 2016, at 10:32, [hidden email] wrote:

Hello all,

I am trying to execute SAXON from ANT with an XML CATALOG.
I could not run Saxon with a Catalog for an  XSLT ANT task, while it worked  from JAVA ANT TASK
I did a tiny project to show the problem where the  building finish with Warning: XML resolver not found; external catalogs will be ignored and finally a fatal error.
As you can see in the log below, the path included_template.xsl is well resolved at a point of time, but  later in the build i get a warning Warning: XML resolver not found; external catalogs will be ignored an in the end fatal error telling that the fine cannot be found.

Here is the non working solution (ANT XSLT TASK + SAXON + CATALOG)
file : build.xml
<project basedir="." name="build_output" default="generate">
    <!--the output directory-->
    <property name="out.dir" value="output/ecuconfig"/>
    <property name="saxon_jar" value="D:/DATA/ts_mirr/xml/Saxon-EE-9-7/saxon9ee.jar"/>
        <property name="resolver_jar" value="D:/DATA/ts_mirr/xml/xerces-2_11_0/resolver.jar"/>
        <property name="catalog_manager" value="D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement"/>

        <path id="saxon.processor.classpath">                                        
          <pathelement path="${saxon_jar}"/>  <!-- Saxon jar -->
          <pathelement path="${resolver_jar}"/> <!-- resolver jar -->
          <pathelement path="${catalog_manager}"/>
        </path>
           
    <target name="gen">
        <xslt basedir="D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement" style="xsl_schema_aware.xsl" in="project.xmlprj" out="${out.dir}/myoutput.txt" scanincludeddirectories="true">
                <classpath refid="saxon.processor.classpath"/>
            <sysproperty key="org.apache.xerces.xni.parser.XMLParserConfiguration"
                value="org.apache.xerces.parsers.XIncludeParserConfiguration"/>
                <factory name="net.sf.saxon.TransformerFactoryImpl">                    
                        <attribute name="http://saxon.sf.net/feature/uriResolverClass" value="org.apache.xml.resolver.tools.CatalogResolver"/>
                        <attribute name="http://saxon.sf.net/feature/sourceParserClass" value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>                        
                <attribute name="http://saxon.sf.net/feature/xsltSchemaAware" value="true"/>
                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
            </factory>                
                   <xmlcatalog>
                        <catalogpath>
                                <pathelement location="D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/catalog.xml"/>
                         </catalogpath>
                </xmlcatalog>
        </xslt>
    </target>
...
File : catalog.xml
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
        <uri name="included_template.xsl" uri="include_xsl/included_template.xsl"/>
</catalog>

Here is the error i get. Warning: XML resolver not found; external catalogs will be ignored
Does any one have an idea about what is wrong. I?


Buildfile: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\build.xml
gen:
     [xslt] Processing D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\project.xmlprj to D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\output\ecuconfig\myoutput.txt
     [xslt] Loading stylesheet D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl
     [xslt] Parse catalog: catalog.xml
     [xslt] Loading catalog: catalog.xml
     [xslt] Default BASE: file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/catalog.xml
     [xslt] override: no
     [xslt] OVERRIDE: no
     [xslt] uri: included_template.xsl
     [xslt]         include_xsl/included_template.xsl
     [xslt] URI: included_template.xsl
     [xslt]         file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/include_xsl/included_template.xsl
Warning: XML resolver not found; external catalogs will be ignored
     [xslt] D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl:4:44: Fatal Error! I/O error reported by XML parser processing file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/included_template.xsl: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified) Cause: java.io.FileNotFoundException: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified)
     [xslt] D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl:4:44: Fatal Error! I/O error reported by XML parser processing file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/included_template.xsl: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified) Cause: java.io.FileNotFoundException: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified)
     [xslt] D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl:4:44: Fatal Error! I/O error reported by XML parser processing file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/included_template.xsl: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified) Cause: java.io.FileNotFoundException: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified)
     [xslt] Failed to process D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\project.xmlprj

BUILD FAILED
D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\build.xml:16: Fatal error during transformation using D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\xsl_schema_aware.xsl: I/O error reported by XML parser processing file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/included_template.xsl: D:\DATA\AUTOSAR\Sparc_NG\Configuration_Global_Improvement\included_template.xsl (The system cannot find the file specified); SystemID: file:/D:/DATA/AUTOSAR/Sparc_NG/Configuration_Global_Improvement/xsl_schema_aware.xsl; Line#: 4; Column#: 44



Here is the working solution (ANT JAVA TASK + SAXON + CATALOG)
file : build.xml
<project basedir="." name="build_output" default="generate">    
    <property name="out.dir" value="output/ecuconfig"/> <!--the output directory-->
    <property name="saxon_jar" value="D:/DATA/ts_mirr/xml/Saxon-EE-9-7/saxon9ee.jar"/>
        <property name="resolver_jar" value="D:/DATA/ts_mirr/xml/xerces-2_11_0/resolver.jar"/>

        <!--classpath definition-->
        <path id="saxon.processor.classpath">                                        
          <pathelement path="${saxon_jar}"/>  <!-- Saxon jar -->
          <pathelement path="${resolver_jar}"/> <!-- resolver jar -->
        </path>
       
        <!--clean the out directory-->
        <target name="clean">
        <delete dir="${out.dir}"></delete>
    </target>

        <!--run saxon with xinclude and catalog-->
        <target name="gen">
            <java classname="net.sf.saxon.Transform">
                    <classpath refid="saxon.processor.classpath" />
                    <arg value="-catalog:catalog.xml" />                
                <arg value="-xi:on" />
                <arg value="-s:project.xmlprj" />
                <arg value="-xsl:xsl_schema_aware.xsl" />
                <arg value="-o:${out.dir}/myoutput.txt" />
            </java>
        </target>
....        

File : catalog.xml
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
        <uri name="included_template.xsl" uri="include_xsl/included_template.xsl"/>
</catalog>


Thank you for you help
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: Run SAXON from ANT with a CATALOG

Earl Hood
On Thu, Jan 21, 2016 at 5:59 AM, Michael Kay wrote:

> http://stackoverflow.com/questions/14935209/ant-fails-to-locate-xml-catalog-resolver
>
> I'm afraid it might be false rumour-mongering, but I just don't trust
> ant to get classpaths right.

For the project I work on, we place resolver.jar in Ant's lib directory
and/or use the -lib option to Ant if there is a need to not clutter
Ant's lib directory with additional jars (useful if Ant is shared across
projects in order to avoid jar conflicts).

As for the commons resolver, as I stated in a previous message, there
are known bugs with the 1.2 version, bugs I submitted patches for.
IIRC, all but one of my patches was accepted and is likely in the source
code base of the project (there is another patch I believe I have never
submitted).  I have not seen a new release of the resolver that includes
the patches that were accepted.

For those curious if the patches address the problem(s) others are
having, you can download a zip file containing a version of resolver.jar that
I have been using in the project I am working on:

  http://www.mhonarc.org/release/misc/resolver-eps.zip

The following summarizes the local changes made to the resolver:

* Windows driver-letter pathname recognition.  The resolver will
  lose track of the current working directory if pathnames contain
  windwos driver letter.  For example:

    c:\project\...

* resolveSystem() modified to call resolveURI() if no system
  entry could be found.  The XML Catalog specification does
  not explicit spell out when <uri> entries are used.  It appears
  Saxon knows to call resolveURI() if resolveSystem() fails, but
  Xerces does not.

  To support schema validation with Xerces and how various XML
  catalogs are defined in projects (i.e. they make use of <uri>),
  this change was made to get things to work.

* Recognition of xml.catalog.verbosity if CatalogManager.properties
  is not being used.

* Proper setting of systemID of InputSource of SAX parsing
  when parsing XML catalog files.  This is needed so any
  relative paths to external entities are resolved using
  the location of the catalog file as the base.

* Better handling of special characters is pathnames.  These changes
  require Java 1.4 or later.  When catalog pathnames contained
  characters considered special in a URL, they were not escaped
  propertly when generating the file: URL version of the pathname.  This
  caused base URL resolution problems.

* Better handling of jar: URLs so relative paths referenced in a catalog
  loaded from a jar file will resolve correctly.


--ewh

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: Run SAXON from ANT with a CATALOG

Philippe.Favrais
Hello All,

thanks all for your responses that help to undertand the problem.
Indeed, i just tested with http://www.mhonarc.org/release/misc/resolver-eps.zip and it worked perfect. Thank you

When looking at Xerces, i did not see any information about futur version !

Best regards
Philippe






De :        Earl Hood <[hidden email]>
A :        Mailing list for the SAXON XSLT and XQuery processor <[hidden email]>,
Date :        21/01/2016 18:45
Objet :        Re: [saxon] Run SAXON from ANT with a CATALOG




On Thu, Jan 21, 2016 at 5:59 AM, Michael Kay wrote:

>
http://stackoverflow.com/questions/14935209/ant-fails-to-locate-xml-catalog-resolver
>
> I'm afraid it might be false rumour-mongering, but I just don't trust
> ant to get classpaths right.

For the project I work on, we place resolver.jar in Ant's lib directory
and/or use the -lib option to Ant if there is a need to not clutter
Ant's lib directory with additional jars (useful if Ant is shared across
projects in order to avoid jar conflicts).

As for the commons resolver, as I stated in a previous message, there
are known bugs with the 1.2 version, bugs I submitted patches for.
IIRC, all but one of my patches was accepted and is likely in the source
code base of the project (there is another patch I believe I have never
submitted).  I have not seen a new release of the resolver that includes
the patches that were accepted.

For those curious if the patches address the problem(s) others are
having, you can download a zip file containing a version of resolver.jar that
I have been using in the project I am working on:

 
http://www.mhonarc.org/release/misc/resolver-eps.zip

The following summarizes the local changes made to the resolver:

* Windows driver-letter pathname recognition.  The resolver will
 lose track of the current working directory if pathnames contain
 windwos driver letter.  For example:

   c:\project\...

* resolveSystem() modified to call resolveURI() if no system
 entry could be found.  The XML Catalog specification does
 not explicit spell out when <uri> entries are used.  It appears
 Saxon knows to call resolveURI() if resolveSystem() fails, but
 Xerces does not.

 To support schema validation with Xerces and how various XML
 catalogs are defined in projects (i.e. they make use of <uri>),
 this change was made to get things to work.

* Recognition of xml.catalog.verbosity if CatalogManager.properties
 is not being used.

* Proper setting of systemID of InputSource of SAX parsing
 when parsing XML catalog files.  This is needed so any
 relative paths to external entities are resolved using
 the location of the catalog file as the base.

* Better handling of special characters is pathnames.  These changes
 require Java 1.4 or later.  When catalog pathnames contained
 characters considered special in a URL, they were not escaped
 propertly when generating the file: URL version of the pathname.  This
 caused base URL resolution problems.

* Better handling of jar: URLs so relative paths referenced in a catalog
 loaded from a jar file will resolve correctly.


--ewh

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
saxon-help mailing list archived at
http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help