Examples of DissectableContentHandler


Examples of com.volantis.mcs.dissection.dom.DissectableContentHandler

        if (logger.isDebugEnabled()) {
            logger.debug("Creating dissectable document for: " + path);
        }

        DissectableContentHandler contentHandler
            = new DissectableContentHandler();
        contentHandler.initialise(builder);
        XMLReader parser = getXMLReader();

        parser.setContentHandler(contentHandler);

        // Prevent the external DTD from being loaded.
        parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",
                          false);
        parser.setProperty("http://xml.org/sax/properties/lexical-handler",
                           contentHandler);
        parser.setProperty("http://xml.org/sax/properties/declaration-handler",
                           contentHandler);
        parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",
                          false);

        URL input = baseClass.getResource(path);
        if (input == null) {
            throw new FileNotFoundException(path);
        }
        try {
            parser.parse(input.toExternalForm());
            /*} catch (SAXParseException spe) {
                spe.printStackTrace();
                throw spe;*/
        } catch (SAXException se) {
            se.printStackTrace();
            Exception cause = se.getException();
            if (cause != null) {
                System.out.println("Root Cause");
                cause.printStackTrace();
            }
            throw se;
        }

        TestDocumentDetails document
            = contentHandler.getTestDocumentDetails();

        return document;
    }
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.