EntityResolver patch

Elliotte Harold <[email protected]> Sun, 25 Apr 2004 11:13:18 -0400
Newsgroups gmane.text.xml.sax.devel
Message-ID <[email protected]>
This patch makes it clear that under no circumstances should the parser 
call the EntityResolver for the top-level document entity. (Two version 
of AElfred, though not GNU JAXP) currently get this wrong.

--
Elliotte Rusty Harold
EntityResolver.patch (text/plain, 2.4 KB)
Index: src/org/xml/sax/EntityResolver.java
===================================================================
RCS file: /cvsroot/sax/sax2/src/org/xml/sax/EntityResolver.java,v
retrieving revision 1.10
diff -u -r1.10 EntityResolver.java
--- src/org/xml/sax/EntityResolver.java	30 Jan 2002 21:13:44 -0000	1.10
+++ src/org/xml/sax/EntityResolver.java	25 Apr 2004 14:59:06 -0000
@@ -81,7 +81,8 @@
      * entities).  The application may request that the parser locate
      * the entity itself, that it use an alternative URI, or that it
      * use data provided by the application (as a character or byte
-     * input stream).</p>
+     * input stream). The parser will not call this method before opening 
+     * the top-level document entity.</p>
      *
      * <p>Application writers can use this method to redirect external
      * system identifiers to secure and/or local URIs, to look up
@@ -96,18 +97,18 @@
      * <p>If the system identifier is a URL, the SAX parser must
      * resolve it fully before reporting it to the application.</p>
      *
-     * @param publicId The public identifier of the external entity
-     *        being referenced, or null if none was supplied.
-     * @param systemId The system identifier of the external entity
-     *        being referenced.
-     * @return An InputSource object describing the new input source,
+     * @param publicId the public identifier of the external entity
+     *        being referenced, or null if none was supplied
+     * @param systemId the system identifier of the external entity
+     *        being referenced
+     * @return an InputSource object describing the new input source,
      *         or null to request that the parser open a regular
-     *         URI connection to the system identifier.
-     * @exception org.xml.sax.SAXException Any SAX exception, possibly
-     *            wrapping another exception.
-     * @exception java.io.IOException A Java-specific IO exception,
+     *         URI connection to the system identifier
+     * @throws org.xml.sax.SAXException any SAX exception, possibly
+     *            wrapping another exception
+     * @throws java.io.IOException a Java-specific IO exception,
      *            possibly the result of creating a new InputStream
-     *            or Reader for the InputSource.
+     *            or Reader for the InputSource
      * @see org.xml.sax.InputSource
      */
     public abstract InputSource resolveEntity (String publicId,