Package com.ctc.wstx.sax

Examples of com.ctc.wstx.sax.WstxSAXParserFactory


        final String XML =
            "<!DOCTYPE root PUBLIC '//some//public//id' 'no-such-thing.dtd'>\n"
            +"<root />"
            ;

        SAXParserFactory spf = new WstxSAXParserFactory();
        spf.setNamespaceAware(true);
        SAXParser sp = spf.newSAXParser();
        DefaultHandler h = new DefaultHandler();

        /* First: let's verify that we get an exception for
         * unresolved reference...
         */
        try {
            sp.parse(new InputSource(new StringReader(XML)), h);
        } catch (SAXException e) {
            verifyException(e, "No such file or directory");
        }

        // And then with dummy resolver; should work ok now
        sp = spf.newSAXParser();
        sp.getXMLReader().setEntityResolver(new MyResolver("   "));
        h = new DefaultHandler();
        try {
            sp.parse(new InputSource(new StringReader(XML)), h);
        } catch (SAXException e) {
View Full Code Here


    @Override
    public Document loadDocument(InputSource inputSource, EntityResolver entityResolver,
                                 ErrorHandler errorHandler, int validationMode, boolean namespaceAware)
        throws Exception {
        if (validationMode == XmlBeanDefinitionReader.VALIDATION_NONE) {
            WstxSAXParserFactory woodstoxParserFactory;
            woodstoxParserFactory = new WstxSAXParserFactory();
            woodstoxParserFactory.setFeature("http://xml.org/sax/features/namespace-prefixes",
                                             namespaceAware);
            SAXParser parser = woodstoxParserFactory.newSAXParser();
            XMLReader reader = parser.getXMLReader();
            reader.setEntityResolver(entityResolver);
            reader.setErrorHandler(errorHandler);
            SAXSource saxSource = new SAXSource(reader, inputSource);
            Document document;
View Full Code Here

        saxParser.parse(input, saxDocumentSerializer);
    }
   
    private void readWithWoodstox() throws SAXException, TransformerConfigurationException, TransformerException, IOException {
        InputStream is = getClass().getResourceAsStream("/META-INF/cxf/cxf.xml");
        WstxSAXParserFactory woodstoxParserFactory;
        woodstoxParserFactory = new WstxSAXParserFactory();
        woodstoxParserFactory.setFeature("http://xml.org/sax/features/namespace-prefixes",
                                         true);
        SAXParser parser = woodstoxParserFactory.newSAXParser();
        XMLReader reader = parser.getXMLReader();
        SAXSource saxSource = new SAXSource(reader, new InputSource(is));
        Document document;
        document = documentBuilder.newDocument();
        DOMResult domResult = new DOMResult(document);
View Full Code Here

TOP

Related Classes of com.ctc.wstx.sax.WstxSAXParserFactory

Copyright © 2018 www.massapicom. 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.