Package javax.xml.stream

Examples of javax.xml.stream.XMLResolver


        XMLInputFactory factory = XMLInputFactory.newInstance();
        setProperty(factory, XMLInputFactory.IS_NAMESPACE_AWARE, nsAware);
        setProperty(factory, XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
        setProperty(factory, XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE);
        setProperty(factory, XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
        factory.setXMLResolver(new XMLResolver() {
            public Object resolveEntity(String publicID, String systemID,
                                        String baseURI, String namespace)
                throws XMLStreamException {
                throw new XMLStreamException("Reading external entities is disabled");
            }
View Full Code Here


        XMLInputFactory factory = XMLInputFactory.newInstance();
        setProperty(factory, XMLInputFactory.IS_NAMESPACE_AWARE, nsAware);
        setProperty(factory, XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
        setProperty(factory, XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE);
        setProperty(factory, XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
        factory.setXMLResolver(new XMLResolver() {
            public Object resolveEntity(String publicID, String systemID,
                                        String baseURI, String namespace)
                throws XMLStreamException {
                throw new XMLStreamException("Reading external entities is disabled");
            }
View Full Code Here

        }
        setProperty(factory, XMLInputFactory.IS_NAMESPACE_AWARE, nsAware);
        setProperty(factory, XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
        setProperty(factory, XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE);
        setProperty(factory, XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
        factory.setXMLResolver(new XMLResolver() {
            public Object resolveEntity(String publicID, String systemID,
                                        String baseURI, String namespace)
                throws XMLStreamException {
                throw new XMLStreamException("Reading external entities is disabled");
            }
View Full Code Here

        XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.TRUE);
    } catch (IllegalArgumentException e) {
      ; // we can live with that
    }

    factory.setXMLResolver(new XMLResolver() {
      @Override
      public InputStream resolveEntity(String publicID, String systemID, String baseURI, String namespace) {
        return new InputStream() {
          @Override
          public int read() { return -1; }
View Full Code Here

        XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.TRUE);
    } catch (IllegalArgumentException e) {
      ; // we can live with that
    }

    factory.setXMLResolver(new XMLResolver() {
      @Override
      public InputStream resolveEntity(String publicID, String systemID, String baseURI, String namespace) {
        return new InputStream() {
          @Override
          public int read() { return -1; }
View Full Code Here

        XMLInputFactory factory = XMLInputFactory.newInstance();
        factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, nsAware);
        factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
        factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE);
        factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
        factory.setXMLResolver(new XMLResolver() {
            public Object resolveEntity(String publicID, String systemID,
                                        String baseURI, String namespace)
                throws XMLStreamException {
                throw new XMLStreamException("Reading external entities is disabled");
            }
View Full Code Here

        XMLInputFactory factory = XMLInputFactory.newInstance();
        factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, nsAware);
        factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
        factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE);
        factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
        factory.setXMLResolver(new XMLResolver() {
            public Object resolveEntity(String publicID, String systemID,
                                        String baseURI, String namespace)
                throws XMLStreamException {
                throw new XMLStreamException("Reading external entities is disabled");
            }
View Full Code Here

         * below where we allow a catalog to be used to alleviate the network traffic. */
        factory.setProperty("javax.xml.stream.supportDTD", Boolean.TRUE);

        if (catalog != null) {
            final String[] catalogs = new String[] {catalog};
            final XMLResolver resolver = XMLUtil.getXMLResolver(catalogs);
            factory.setProperty("javax.xml.stream.resolver", resolver);
        }

        for (int i = 0; i < streams.length; i++) {
            final InputStream in = streams[i];
View Full Code Here

     * @param catalogs The array of URIs indicating where the XML catalogs are located.
     * @return The created EntityResolver.
     */
    public static XMLResolver getXMLResolver(final String[] catalogs) {
        final CatalogResolver catalogResolver = XMLUtil.getEntityResolver(catalogs);
        final XMLResolver resolver = new XMLResolver() {
            public Object resolveEntity(final String publicID, final String systemID, final String baseURI,
                    final String namespace) throws XMLStreamException {
                final InputSource inputSource = catalogResolver.resolveEntity(publicID, systemID);
                return inputSource.getByteStream();
            }
View Full Code Here

        reader = new InputStreamReader(new FileInputStream(domainXml));
        XMLInputFactory xif = getXmlInputFactory();
        // Set the resolver so that any external entity references, such
        // as a reference to a DTD, return an empty file.  The domain.xml
        // file doesn't support entity references.
        xif.setXMLResolver(new XMLResolver() {
                @Override
                public Object resolveEntity(String publicID,
                     String systemID,
                     String baseURI,
                     String namespace)
View Full Code Here

TOP

Related Classes of javax.xml.stream.XMLResolver

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.