< prev index next >

src/java.xml/share/classes/org/xml/sax/ext/EntityResolver2.java

Print this page


   1 /*
   2  * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 // EntityResolver2.java - Extended SAX entity resolver.
  27 // http://www.saxproject.org
  28 // No warranty; no copyright -- use this as you will.
  29 // $Id: EntityResolver2.java,v 1.2 2004/11/03 22:49:08 jsuttor Exp $
  30 
  31 package org.xml.sax.ext;
  32 
  33 import java.io.IOException;
  34 
  35 import org.xml.sax.EntityResolver;
  36 import org.xml.sax.InputSource;
  37 import org.xml.sax.XMLReader;
  38 import org.xml.sax.SAXException;
  39 
  40 
  41 /**
  42  * Extended interface for mapping external entity references to input
  43  * sources, or providing a missing external subset.  The
  44  * {@link XMLReader#setEntityResolver XMLReader.setEntityResolver()} method
  45  * is used to provide implementations of this interface to parsers.
  46  * When a parser uses the methods in this interface, the
  47  * {@link EntityResolver2#resolveEntity EntityResolver2.resolveEntity()}
  48  * method (in this interface) is used <em>instead of</em> the older (SAX 1.0)
  49  * {@link EntityResolver#resolveEntity EntityResolver.resolveEntity()} method.
  50  *
  51  * <blockquote>
  52  * <em>This module, both source code and documentation, is in the
  53  * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
  54  * </blockquote>
  55  *
  56  * <p>If a SAX application requires the customized handling which this
  57  * interface defines for external entities, it must ensure that it uses
  58  * an XMLReader with the
  59  * <em>http://xml.org/sax/features/use-entity-resolver2</em> feature flag
  60  * set to <em>true</em> (which is its default value when the feature is
  61  * recognized).  If that flag is unrecognized, or its value is false,
  62  * or the resolver does not implement this interface, then only the
  63  * {@link EntityResolver} method will be used.
  64  *
  65  * <p>That supports three categories of application that modify entity
  66  * resolution.  <em>Old Style</em> applications won't know about this interface;
  67  * they will provide an EntityResolver.
  68  * <em>Transitional Mode</em> provide an EntityResolver2 and automatically
  69  * get the benefit of its methods in any systems (parsers or other tools)
  70  * supporting it, due to polymorphism.
  71  * Both <em>Old Style</em> and <em>Transitional Mode</em> applications will
  72  * work with any SAX2 parser.
  73  * <em>New style</em> applications will fail to run except on SAX2 parsers
  74  * that support this particular feature.


   1 /*
   2  * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 





  26 package org.xml.sax.ext;
  27 
  28 import java.io.IOException;
  29 
  30 import org.xml.sax.EntityResolver;
  31 import org.xml.sax.InputSource;
  32 import org.xml.sax.XMLReader;
  33 import org.xml.sax.SAXException;
  34 
  35 
  36 /**
  37  * Extended interface for mapping external entity references to input
  38  * sources, or providing a missing external subset.  The
  39  * {@link XMLReader#setEntityResolver XMLReader.setEntityResolver()} method
  40  * is used to provide implementations of this interface to parsers.
  41  * When a parser uses the methods in this interface, the
  42  * {@link EntityResolver2#resolveEntity EntityResolver2.resolveEntity()}
  43  * method (in this interface) is used <em>instead of</em> the older (SAX 1.0)
  44  * {@link EntityResolver#resolveEntity EntityResolver.resolveEntity()} method.





  45  *
  46  * <p>If a SAX application requires the customized handling which this
  47  * interface defines for external entities, it must ensure that it uses
  48  * an XMLReader with the
  49  * <em>http://xml.org/sax/features/use-entity-resolver2</em> feature flag
  50  * set to <em>true</em> (which is its default value when the feature is
  51  * recognized).  If that flag is unrecognized, or its value is false,
  52  * or the resolver does not implement this interface, then only the
  53  * {@link EntityResolver} method will be used.
  54  *
  55  * <p>That supports three categories of application that modify entity
  56  * resolution.  <em>Old Style</em> applications won't know about this interface;
  57  * they will provide an EntityResolver.
  58  * <em>Transitional Mode</em> provide an EntityResolver2 and automatically
  59  * get the benefit of its methods in any systems (parsers or other tools)
  60  * supporting it, due to polymorphism.
  61  * Both <em>Old Style</em> and <em>Transitional Mode</em> applications will
  62  * work with any SAX2 parser.
  63  * <em>New style</em> applications will fail to run except on SAX2 parsers
  64  * that support this particular feature.


< prev index next >