This class seems to do what I want given that I can't do what I want from the command line.

But this seems like it would be a really common combination, namely schema validation and catalog resolution but I couldn't find an example of this combination anywhere. It would make really useful convenience class in the Xerces distribution. It could even look for some class-specific system properties to configure the specific validation settings (I have validation turned off but schema processing turned on since I only want the attribute value defaults and I don't want invalid docs to kill my process).


--- Start SchemaValidatingCatalogResolvingXMLReader.java ---
package org.example.xerces;

import org.apache.xml.resolver.CatalogManager;
import org.apache.xml.resolver.tools.ResolvingXMLReader;
import org.xml.sax.SAXNotRecognizedException;

/**
 *
 */
public class SchemaValidatingCatalogResolvingXMLReader extends
                ResolvingXMLReader {

        /**
         * @throws Throwable
         * @throws SAXNotRecognizedException
         *
         */
public SchemaValidatingCatalogResolvingXMLReader() throws SAXNotRecognizedException, Throwable {
                super();
                init();
        }

        /**
         * @throws Throwable
         * @throws SAXNotRecognizedException
         *
         */
        private void init() throws SAXNotRecognizedException, Throwable {
                System.err.println(" + INFO: Using " + 
this.getClass().getName());
                this.setFeature("http://xml.org/sax/features/validation";, 
false);
                
this.setFeature("http://apache.org/xml/features/validation/schema";, true);
this.setFeature("http://apache.org/xml/features/validation/dynamic";, true);
        }

        /**
         * @param catalogManager
         * @throws Throwable
         * @throws SAXNotRecognizedException
         */
public SchemaValidatingCatalogResolvingXMLReader(CatalogManager catalogManager) throws SAXNotRecognizedException, Throwable {
                super(catalogManager);
                init();
        }

}
--- end Java class ---



--
Eliot Kimber
Senior Solutions Architect
"Bringing Strategy, Content, and Technology Together"
Main: 610.631.6770
www.reallysi.com
www.rsuitecms.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to