You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by an...@locus.apache.org on 2000/10/19 20:36:51 UTC

cvs commit: xml-xerces/java/src/javax/xml/parsers SAXParser.java

andyc       00/10/19 11:36:50

  Modified:    java/src/javax/xml/parsers Tag: xerces_j_2 SAXParser.java
  Log:
  Merge in fix from main branch for JAXP to compile under 1.x.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +13 -2     xml-xerces/java/src/javax/xml/parsers/SAXParser.java
  
  Index: SAXParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/javax/xml/parsers/SAXParser.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- SAXParser.java	2000/06/02 23:42:21	1.2
  +++ SAXParser.java	2000/10/19 18:36:49	1.2.2.1
  @@ -101,7 +101,7 @@
    *
    * @author <a href="pier@betaversion.org">Pierpaolo Fumagalli</a>
    * @author Copyright &copy; 2000 The Apache Software Foundation.
  - * @version 1.0 CVS $Revision: 1.2 $ $Date: 2000/06/02 23:42:21 $
  + * @version 1.0 CVS $Revision: 1.2.2.1 $ $Date: 2000/10/19 18:36:49 $
    */
   public abstract class SAXParser {
   
  @@ -167,7 +167,18 @@
       public void parse(File file, HandlerBase base)
       throws SAXException, IOException, IllegalArgumentException {
           if (file==null) throw new IllegalArgumentException();
  -        this.parse(new InputSource(file.toURL().toString()),base);
  +        String path = file.getAbsolutePath();
  +        if (File.separatorChar != '/') {
  +            path = path.replace(File.separatorChar, '/');
  +        }
  +        if (!path.startsWith("/")) {
  +            path = "/" + path;
  +        }
  +        if (!path.endsWith("/") && file.isDirectory()) {
  +            path = path + "/";
  +        }
  +        java.net.URL url = new java.net.URL("file", "", path);
  +        this.parse(new InputSource(url.toString()),base);
       }
   
       /**