Quantcast

ANT + SAXON to Validate XML/XSD with XINCLUDE

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ANT + SAXON to Validate XML/XSD with XINCLUDE

Philippe.Favrais
Hello All,

I am trying to validate xincluded XML files against XSD via an ANT file. However the validation do run only over the main xml file and not the xincluded files.
I wonder whether it is possible to validate all my files in on step.

The XML files are organized as following. I have a main file project.xml that xinclude many xml files.
project.xml (project.xsd)
  |______xinclude_________>file1.xml (file1.xsd)
  |______xinclude_________>file2.xml (file2.xsd)
  |______xinclude_________>file3.xml (file3.xsd)

For that i use the following ANT, but the validation does only validate the project.xml file and not the xincluded files.

ANT file
<xmlvalidate failonerror="no" lenient="false" warn="yes" classname="com.saxonica.ee.jaxp.ValidatingReader">
        <classpath refid="saxon.processor.classpath"/>
       <property name="http://saxon.sf.net/feature/uriResolverClass" value="org.apache.xml.resolver.tools.CatalogResolver"/>
       <property name="http://saxon.sf.net/feature/schema-validation-mode" value="strict"/>
       <attribute name="http://xml.org/sax/features/namespaces" value="true"/>
       <attribute name="http://xml.org/sax/features/validation" value="true"/>
        <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
        <fileset dir="." includes="project.xml"/>
</xmlvalidate>                                


Main XML file : project.xml
<project xmlns:xi="http://www.w3.org/2001/XML/xinclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="GeneratedXsd.xsd" XmlprjFormatVersion="1.2" Name="011d12">
        <mem>
                <FileEntry>
                        <xi:include href="module_a.xml" parse="xml" xml:base="D:/DATA/Configuration_Global_Improvement/"/>
                </FileEntry>
                <FileEntry">
                        <xi:include href="module_b.xml" parse="xml" xml:base="D:/DATA/Configuration_Global_Improvement/"/>
                </FileEntry>
        </mem>
</project>

Xincluded file : file1.xml
<?xml version="1.0" encoding="UTF-8"?>
<MODULE_A xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="module_a.xsd">
        <GLOBAL_DATA Clock="45" oups=""/>
        <NODE_1-8 Name="A"/>
        <NODE_1-8 Name="B"/>
</MODULE_A>

Thank you in advance
Philippe
------------------------------------------------------------------------------
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 
Loading...