Would this be permissible?  This is very useful, as the current
EntityResolver interface does not provide a base URI, leading to the problem
of it being impossible to correctly resolve a root document including a DTD
which includes another resource via a relative reference (and that's really
common -- most DTDs include other DTDs).  A trivial example of such is
parsing and validating something specifiying:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>

where xhtml1-strict.dtd has as it's first line:

<!ENTITY % HTMLlat1 PUBLIC
   "-//W3C//ENTITIES Latin 1 for XHTML//EN"
   "xhtml-lat1.ent">
%HTMLlat1

I tried to do this before by implementing EntityResolver2 (against 2.3.0)
but I came unstuck on the `name' parameter, where basically in a large
number of places I wasn't sure what to put for that.  However, the new
method would work just fine for me, provided that I could get at it!

The patch below implements the change.  The code is already present, so it
just exposes it...

Thanks,

Mark

diff -ur xerces-c-src_2_5_0\src\xercesc/sax2/SAX2XMLReader.hpp
xml-xerces\src\xercesc/sax2/SAX2XMLReader.hpp
--- xerces-c-src_2_5_0\src\xercesc/sax2/SAX2XMLReader.hpp       2004-02-16
20:52:16.000000000 +0000
+++ xml-xerces\src\xercesc/sax2/SAX2XMLReader.hpp       2004-04-07
01:41:56.583227000 +0100
@@ -173,6 +173,7 @@

 class ContentHandler ;
 class DTDHandler;
+class XMLEntityResolver;
 class EntityResolver;
 class ErrorHandler;
 class InputSource;
@@ -249,6 +250,13 @@
     virtual EntityResolver* getEntityResolver() const = 0 ;

     /**
+      * This method returns the installed entity resolver.
+      *
+      * @return A pointer to the installed entity resolver object.
+      */
+    virtual XMLEntityResolver* getXMLEntityResolver() const = 0 ;
+
+       /**
       * This method returns the installed error handler.
       *
       * @return A pointer to the installed error handler object.
@@ -338,6 +346,24 @@
     */
     virtual void setEntityResolver(EntityResolver* const resolver) = 0;

+  /** Set the entity resolver
+    *
+    * This method allows applications to install their own entity
+    * resolver. By installing an entity resolver, the applications
+    * can trap and potentially redirect references to external
+    * entities.
+    *
+    * <i>Any previously set entity resolver is merely dropped, since the
parser
+    * does not own them.  If both setEntityResolver and
setXMLEntityResolver
+    * are called, then the last one is used.</i>
+    *
+    * @param resolver  A const pointer to the user supplied entity
+    *                  resolver.
+    *
+    * @see #getXMLEntityResolver
+    */
+    virtual void setXMLEntityResolver(XMLEntityResolver* const resolver) =
0;
+
   /**
     * Allow an application to register an error event handler.
     *


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to