Hello,

I cannot get validation working when unmarshalling XML.  I followed the
directions on the Castor website, but validation was not working and invalid
documents were getting parsed as if they were valid.  After looking at the
castor.properties file, I changed set this property:
org.exolab.castor.parser.validation=true

Originally, the directions said only to set these properties:
org.exolab.castor.indent=true
org.exolab.castor.parser.namespaces=true
org.exolab.castor.sax.features=http://xml.org/sax/features/validation,\
  http://apache.org/xml/features/validation/schema,\
  http://apache.org/xml/features/validation/schema-full-checking

With the parser validation set to true, I get the following exception:

org.exolab.castor.mapping.MappingException: Nested error: Document is invalid:
no grammar found.{File: xml2cdpl-mapping-1.0.xml; line: 2; column: 11}
        at edu.harvard.itis.cdxml2cdpl.XmlTransform.<init>(XmlTransform.java:90)
        at
edu.harvard.itis.cdxml2cdpl.test.TransformTester.runTransformTest(TransformTester.java:90)
        at
edu.harvard.itis.cdxml2cdpl.test.TransformTester.main(TransformTester.java:50)
Caused by: edu.harvard.itis.cdxml2cdpl.exceptions.XmlTransformException:
org.exolab.castor.mapping.MappingException: Nested error: Document is invalid:
no grammar found.{File: xml2cdpl-mapping-1.0.xml; line: 2; column: 11}
        at edu.harvard.itis.cdxml2cdpl.XmlTransform.init(XmlTransform.java:147)
        at edu.harvard.itis.cdxml2cdpl.XmlTransform.<init>(XmlTransform.java:87)
        ... 2 more
Caused by: org.exolab.castor.mapping.MappingException: Nested error: Document is
invalid: no grammar found.{File: xml2cdpl-mapping-1.0.xml; line: 2; column: 11}
        at
org.castor.mapping.MappingUnmarshaller.loadMappingInternal(MappingUnmarshaller.java:246)
        at
org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:124)
        at
org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:99)
        at edu.harvard.itis.cdxml2cdpl.XmlTransform.init(XmlTransform.java:142)
        ... 3 more

The header to the mapping file is:

<?xml version="1.0"?>
<c:mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xmlns="http://xml.cadm.harvard.edu/HUPeopleData";
         xmlns:pd="http://xml.cadm.harvard.edu/HUPeopleData";
         xmlns:c="http://castor.exolab.org/";
         xsi:schemaLocation="http://castor.exolab.org/ mapping.xsd
                             http://xml.cadm.harvard.edu/HUPeopleData           
           data.xsd">
..etc...

Am I doing something wrong?  Has anyone run into a similar issue?  Any
suggestions?

Thank you,
Mike

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to