You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by le...@apache.org on 2001/05/18 20:02:41 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/impl XMLEntityManager.java

lehors      01/05/18 11:02:39

  Modified:    java/src/org/apache/xerces/impl Tag: xerces_j_2
                        XMLEntityManager.java
  Log:
  systemId was ignored when an entity resolver is used
   - patch from Peter Kuzel - bug #1305
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.77  +22 -7     xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLEntityManager.java
  
  Index: XMLEntityManager.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLEntityManager.java,v
  retrieving revision 1.1.2.76
  retrieving revision 1.1.2.77
  diff -u -r1.1.2.76 -r1.1.2.77
  --- XMLEntityManager.java	2001/05/09 07:20:26	1.1.2.76
  +++ XMLEntityManager.java	2001/05/18 18:02:33	1.1.2.77
  @@ -117,7 +117,7 @@
    * @author Andy Clark, IBM
    * @author Arnaud  Le Hors, IBM
    *
  - * @version $Id: XMLEntityManager.java,v 1.1.2.76 2001/05/09 07:20:26 andyc Exp $
  + * @version $Id: XMLEntityManager.java,v 1.1.2.77 2001/05/18 18:02:33 lehors Exp $
    */
   public class XMLEntityManager
       implements XMLComponent {
  @@ -190,6 +190,9 @@
       /** Debug switching readers for encodings. */
       private static final boolean DEBUG_ENCODINGS = false;
   
  +    // should be diplayed trace resolving messages
  +    private static final boolean DEBUG_RESOLVER = false;
  +    
       //
       // Data
       //
  @@ -476,6 +479,12 @@
                                           String baseSystemId)
           throws IOException, XNIException {
   
  +        // if no base systemId given, assume that it's relative
  +        // to the systemId of the current scanned entity
  +        if (baseSystemId == null) {
  +            baseSystemId = fCurrentEntity.systemId;
  +        }
  +
           // give the entity resolver a chance
           XMLInputSource xmlInputSource = null;
           if (fEntityResolver != null) {
  @@ -489,18 +498,18 @@
               if (inputSource != null) {
                   xmlInputSource = new XMLInputSource(inputSource);
                   xmlInputSource.setBaseSystemId(baseSystemId);
  -                String expandedSystemId = expandSystemId(systemId, baseSystemId);
  +                String resolvedSystemId = inputSource.getSystemId();
  +                if (resolvedSystemId == null) {
  +                    resolvedSystemId = systemId;
  +                }
  +                String expandedSystemId =
  +                    expandSystemId(resolvedSystemId, baseSystemId);
                   xmlInputSource.setExpandedSystemId(expandedSystemId);
               }
           }
   
           // do default resolution
           if (xmlInputSource == null) {
  -            // if no base systemId given, assume that it's relative
  -            // to the systemId of the current scanned entity
  -            if (baseSystemId == null) {
  -                baseSystemId = fCurrentEntity.systemId;
  -            }
   
               // create the input source
               xmlInputSource = new XMLInputSource(systemId);
  @@ -510,6 +519,12 @@
               xmlInputSource.setExpandedSystemId(expandedSystemId);
           }
   
  +        if (DEBUG_RESOLVER) {
  +            System.err.println("XMLEntityManager.resolveEntity(" + publicId + ")");
  +            System.err.println(" = " + xmlInputSource);
  +        }
  +        
  +        
           return xmlInputSource;
   
       } // resolveEntity(String,String,String):XMLInputSource
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org