Package org.xml.sax

Examples of org.xml.sax.EntityResolver


        // now format the XML
        ByteArrayInputStream bais = new ByteArrayInputStream(unformatted.toByteArray());
        DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
        // BZ 536138 & 1038728, don't resolve the preferences DTD.
        docBuilder.setEntityResolver(new EntityResolver() {
            @Override
            public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
                return new InputSource(new StringReader(""));
            }
        });
View Full Code Here


            documentBuilderFactory.setFeature("http://xml.org/sax/features/validation", false);
            documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
            documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);

            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            documentBuilder.setEntityResolver(new EntityResolver() {
                @Override
                public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
                    return new InputSource(new StringReader(""));
                }
            });
View Full Code Here

            documentBuilderFactory.setFeature("http://xml.org/sax/features/validation", false);
            documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
            documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);

            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            documentBuilder.setEntityResolver(new EntityResolver() {
                @Override
                public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
                    return new InputSource(new StringReader(""));
                }
            });
View Full Code Here

            SAXParserFactory factory = SAXParserFactory.newInstance();
            SAXParser parser = factory.newSAXParser();

            XMLReader reader = parser.getXMLReader();

            EntityResolver entityResolver = SelectiveSkippingEntityResolver.getDtdAndXsdSkippingInstance();
            reader.setEntityResolver(entityResolver);

            JBossServiceHandler contentHandler = new JBossServiceHandler(serviceXmlFile);
            reader.setContentHandler(contentHandler);
View Full Code Here

            SAXParserFactory factory = SAXParserFactory.newInstance();
            SAXParser parser = factory.newSAXParser();

            XMLReader reader = parser.getXMLReader();

            EntityResolver entityResolver = SelectiveSkippingEntityResolver.getDtdAndXsdSkippingInstance();
            reader.setEntityResolver(entityResolver);

            JBossServiceHandler contentHandler = new JBossServiceHandler(serviceXmlFile);
            reader.setContentHandler(contentHandler);
View Full Code Here

            final InputSource empty = new InputSource(new EmptyReader());
            parser = Builder.findParser(false);
            // parser = new org.apache.crimson.parser.XMLReaderImpl();
            // Now let's stop this parser from loading any external
            // entities the subset references
            parser.setEntityResolver(new EntityResolver() {

                public InputSource resolveEntity(String publicID, String systemID) {
                    return empty;
                }  
           
View Full Code Here

            String inputString =
                    readAsString(streamSource.getInputStream());
            input = new StreamSource(new StringReader(inputString),
                    streamSource.getSystemId());

            EntityResolver resolver = ConfigFactory.getDefaultInstance().
                    createRepositoryEntityResolver();

            SAXTransformerFactory factory = (SAXTransformerFactory)
                    transformerMetaFactory.createTransformerFactory();
            Source xslSource = stylesheet;
View Full Code Here

                public void fatalError(SAXParseException e) throws SAXException {
                    throw e;
                }
            });

            builder.setEntityResolver(new EntityResolver() {
                public InputSource resolveEntity(String publicId,
                        String systemId) throws SAXException, IOException {
                    if (systemId.equals(PROP_DTD_NAME)) {
                        InputSource result = new InputSource(new StringReader(PROP_DTD));
                        result.setSystemId(PROP_DTD_NAME);
View Full Code Here

    public void testDOMLoad() throws Exception
    {
        URL location = ConfigurationAssert.getTestURL(TEST_PROPERTIES_FILE);
        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
        dBuilder.setEntityResolver(new EntityResolver()
        {
            @Override
            public InputSource resolveEntity(String publicId, String systemId)
            {
                return new InputSource(getClass().getClassLoader()
View Full Code Here

                public void fatalError(SAXParseException e) throws SAXException {
                    throw e;
                }
            });
           
            builder.setEntityResolver(new EntityResolver() {
                public InputSource resolveEntity(String publicId, String systemId)
                        throws SAXException, IOException {
                    if (systemId.equals(PROP_DTD_NAME)) {
                        InputSource result = new InputSource(new StringReader(
                                PROP_DTD));
View Full Code Here

TOP

Related Classes of org.xml.sax.EntityResolver

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.