You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ne...@apache.org on 2002/09/26 11:02:06 UTC

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

neeraj      2002/09/26 02:02:06

  Modified:    java/src/javax/xml/parsers SAXParser.java
                        DocumentBuilder.java
  Log:
  fixing bug http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12257
  Added a new class which escapes character sequences that doesn't have representation using an unreserved character, it corresponds to printable character of US-ASCII coded character
    set [00-1F and 7F hexadecimal] or any US-ASCII character that is disallowed like space ' '
   As of right now this class doesn't not handle  non-US ASCII character. But it may be extended in future to handle those cases.
  
  Revision  Changes    Path
  1.7       +16 -10    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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SAXParser.java	26 Nov 2001 21:45:50 -0000	1.6
  +++ SAXParser.java	26 Sep 2002 09:02:06 -0000	1.7
  @@ -107,6 +107,7 @@
   
   public abstract class SAXParser {
   
  +    private static final boolean DEBUG = false ;
       protected SAXParser () {
       
       }
  @@ -293,14 +294,17 @@
               throw new IllegalArgumentException("File cannot be null");
           }
           
  -        String uri = "file:" + f.getAbsolutePath();
  -        if (File.separatorChar == '\\') {
  -            uri = uri.replace('\\', '/');
  -        }
  -        InputSource input = new InputSource(uri);
  +        String escapedURI = ConvertToURI.getEscapedURI(f.getAbsolutePath()) ;
  +        escapedURI = "file://" + escapedURI ;
  +
  +        if(DEBUG)
  +        System.out.println("Escaped URI = " + escapedURI) ;
  +
  +        InputSource input = new InputSource(escapedURI);
           this.parse(input, hb);
       }
       
  +
       /**
        * Parse the content of the file specified as XML using the
        * specified {@link org.xml.sax.helpers.DefaultHandler}.
  @@ -321,11 +325,13 @@
               throw new IllegalArgumentException("File cannot be null");
           }
           
  -        String uri = "file:" + f.getAbsolutePath();
  -        if (File.separatorChar == '\\') {
  -            uri = uri.replace('\\', '/');
  -        }
  -        InputSource input = new InputSource(uri);
  +        String escapedURI = ConvertToURI.getEscapedURI(f.getAbsolutePath()) ;
  +        escapedURI = "file://" + escapedURI ;
  +
  +        if(DEBUG)
  +        System.out.println("Escaped URI = " + escapedURI) ;
  +
  +        InputSource input = new InputSource(escapedURI);
           this.parse(input, dh);
       }
       
  
  
  
  1.9       +8 -5      xml-xerces/java/src/javax/xml/parsers/DocumentBuilder.java
  
  Index: DocumentBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/javax/xml/parsers/DocumentBuilder.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DocumentBuilder.java	15 Oct 2001 19:11:16 -0000	1.8
  +++ DocumentBuilder.java	26 Sep 2002 09:02:06 -0000	1.9
  @@ -100,6 +100,7 @@
       protected DocumentBuilder () {
       }
   
  +    private static final boolean DEBUG = false ;
       /**
        * Parse the content of the given <code>InputStream</code> as an XML 
        * document and return a new DOM {@link org.w3c.dom.Document} object.
  @@ -189,11 +190,13 @@
               throw new IllegalArgumentException("File cannot be null");
           }
           
  -        String uri = "file:" + f.getAbsolutePath();
  -    if (File.separatorChar == '\\') {
  -        uri = uri.replace('\\', '/');
  -    }
  -        InputSource in = new InputSource(uri);
  +        String escapedURI = ConvertToURI.getEscapedURI(f.getAbsolutePath()) ;
  +        escapedURI = "file://" + escapedURI ;
  +
  +        if(DEBUG)
  +            System.out.println("Escaped URI = " + escapedURI) ;
  +
  +        InputSource in = new InputSource(escapedURI);
           return parse(in);
       }
   
  
  
  

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