ANT XML validation with xerces
Posted: Fri Nov 27, 2015 5:03 pm
				
				Hello,
I tried to validate some xml files with xerces parser launch with ANT script. My XML files have a DOCTYPE declaration to define the ENTITY graphic not to define a dtd. My XML files must be validate against a schema. See below an example :
When I execute my script I obtained :
My ANT script is :
The parser try to found a DTD in the DOCTYPE declaration. The validation with my xsd works (the last message come from the validation against my schema).
How can I tell to xerces to ignore the doctype?
Obsiously before to ask here, I searched on google but I didn't find the feature to use.
Thank for your help.
Regards
			I tried to validate some xml files with xerces parser launch with ANT script. My XML files have a DOCTYPE declaration to define the ENTITY graphic not to define a dtd. My XML files must be validate against a schema. See below an example :
Code: Select all
<!DOCTYPE task [
<!ENTITY ICN-LEAP-1A-725800-B-F0301-00285-A-001-01 SYSTEM "ICN-LEAP-1A-725800-B-F0301-00285-A-001-01.cgm" NDATA cgm>          
<!NOTATION cgm SYSTEM "cgm">]><task xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" chapnbr="72" sectnbr="24".....
      xsi:noNamespaceSchemaLocation="http://www.snecma.com/techpub/schemas/ata/em.xsd">
   <effect>......
Code: Select all
[schemavalidate] ....procedure.xml:18:88: Element type "task" must be declared.
[schemavalidate] ....procedure.xml:19:12: Element type "effect" must be declared.
[schemavalidate] ....procedure.xml:23:33: Element type "sbeff" must be declared.
[schemavalidate] ....procedure.xml:37:55: cvc-complex-type.2.4.d: Invalid content was found starting with element 'effect'. No child element is expected at this point
....
...
Code: Select all
    <schemavalidate failonerror="true" lenient="no" warn="yes"
        classname="org.apache.xerces.parsers.SAXParser">
        <fileset dir="${outdir}" includes="*.xml"/>
        <classpath location="../tools/xercesImpl.jar"/>        
 
        <attribute name="http://apache.org/xml/features/validation/schema" value="true"/>
        <attribute name="http://xml.org/sax/features/validation" value="true"/>       
        <xmlcatalog>
            <catalogpath location="..\catalog.xml"/>           
        </xmlcatalog>
    </schemavalidate>How can I tell to xerces to ignore the doctype?
Obsiously before to ask here, I searched on google but I didn't find the feature to use.
Thank for your help.
Regards