Examples of SAXConfigurationHandler


Examples of org.codehaus.dna.impl.SAXConfigurationHandler

                                       final String publicId,
                                       final Logger logger )
        throws Exception
    {
        setupResolver();
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        if( null == publicId )
        {
            final SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
            saxParserFactory.setNamespaceAware( false );
            final SAXParser saxParser = saxParserFactory.newSAXParser();
            final XMLReader reader = saxParser.getXMLReader();
            reader.setEntityResolver( c_resolver );
            reader.setContentHandler( handler );
            reader.setErrorHandler( handler );
            reader.parse( input );
        }
        else
        {
            final InputSource inputSource = c_resolver.resolveEntity( publicId,
                                                                      null );
            if( null == inputSource )
            {
                final String message = "Unable to locate schema with publicID=" +
                    publicId;
                throw new IllegalStateException( message );
            }

            final ConfigValidator validator =
                ConfigValidatorFactory.create( inputSource, c_resolver );
            final ValidationResult result = validator.validate( input,
                                                                (ContentHandler)handler );
            processValidationResults( result, logger );
        }
        return handler.getConfiguration();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.