Project

Profile

Help

Support #2192

Updated by O'Neil Delpratt 5 months ago

Hi, 


 


 Hopefully I am just overlooking something simple, but I have not been able to get Saxon to validate an instance XML against a DTD.    I have broken down the problem into a simple example.    We are using the Apache Catalog Resolver, which is working perfectly fine with Saxon transforms and schema-based validation of instance XMLs, but I cannot get it to work with a DTD. 


 


 In my attached test case the files are as follows: 


 


 doSaxonValidate: shell script to run a validation using com.saxonica.Validate 

 

 CatalogManager.properties: Apache Catalog Manager Properties file for specifying catalog location 

 

 catalog.xml: my bare bones catalog to locate the dtd 

 

 instance.xml: my simple example instance XML file 

 

 xml-resolver.jar: Apache XML resolver jar (version 1.2) 

 

 dtd/simple.dtd: my simple dtd used to validate the instance XML 


 


 To run the test: 

 

 1) Expand the attached tar.gz into a directory 

 

 2) Edit the doSaxonValidate script.    Modify the SAXON_JAR variable to contain the location to your Saxon-EE jar and license.    We put our Saxon license in a jar file, and add the jar to the classpath, your situation may vary. 

 

 3) Run: ./doSaxonValidate instance.xml -t 


 


 This is the output that I get: 

 

 ~~~ 
 
 [pubsdm1:@pubsjsdev1:/home/pubsdm1/jrm29/saxonValidate 
 
 $ doSaxonValidate instance.xml    -t 
 
 Parse catalog: file:/home/pubsdm1/jrm29/saxonValidate/catalog.xml 
 
 Loading catalog: file:/home/pubsdm1/jrm29/saxonValidate/catalog.xml 
 
 Default BASE: file:/home/pubsdm1/jrm29/saxonValidate/catalog.xml 
 
 override: yes 
 
 OVERRIDE: yes 
 
 public: -//MYORG//DTD SIMPLE DTD//EN 
         
         dtd/simple.dtd 
 
 PUBLIC: -//MYORG//DTD SIMPLE DTD//EN 
         
         file:/home/pubsdm1/jrm29/saxonValidate/dtd/simple.dtd 
 
 Saxon-EE 9.5.1.7J from Saxonica 
 
 Java version 1.6.0_27-rev 
 
 Using license serial number V002327 
 
 Schema checking successful. Time: 20 milliseconds 
 
 Using parser org.apache.xml.resolver.tools.ResolvingXMLReader 
 
 Processing file:/home/pubsdm1/jrm29/saxonValidate/instance.xml 
 
 resolveSystem(file:/home/pubsdm1/jrm29/saxonValidate/simple.dtd) 
 
 resolvePublic(-//MYORG//DTD SIMPLE DTD//EN,file:/home/pubsdm1/jrm29/saxonValidate/simple.dtd) 
 
 Resolved public: -//MYORG//DTD SIMPLE DTD//EN 
         
         file:/home/pubsdm1/jrm29/saxonValidate/dtd/simple.dtd 
 
 Validation error on line 3 column 10 of instance.xml: 
   
   XSD99999: Cannot validate <myroot>: no element declaration available 
   
   See http://www.w3.org/TR/xmlschema11-1/#cvc-elt clause 1 
   
   Validating /myroot[1] 
 
 Validation error on line 3 column 10 of instance.xml: 
   
   XSD99999: One or more validation errors were reported 
 
 Validation unsuccessful 
 
 ~~~ 

 

 Note that the Catalog resolver successfully resolved the simple.dtd file, but Saxon cannot locate it. 


 


 I tried this same validation using oXygen and Saxon-EE by configuring oXygen to use my example catalog.xml and it worked fine. 


 


 I will be happy to assist in any troubleshooting and answer any questions you have.    Thank you. 
 

Back