You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by hi...@apache.org on 2001/11/06 10:40:34 UTC

cvs commit: xml-batik/sources/org/apache/batik/parser PathParser.java

hillion     01/11/06 01:40:34

  Modified:    resources/org/apache/batik/bridge BrokenLink.svg
               sources/org/apache/batik/dom/svg SAXSVGDocumentFactory.java
               sources/org/apache/batik/dom/util SAXDocumentFactory.java
               sources/org/apache/batik/parser PathParser.java
  Added:       resources/org/apache/batik/dom/svg/resources
                        dtdids.properties
  Removed:     resources/org/apache/batik/dom/svg/resources
                        dtduris.properties
  Log:
  - fixed a bug in the path parser (.1.2 was not correctly splitted),
  - changed the SAX parser configuration to handle namespaces,
  - the DTD lookup is now based on public Ids.
  
  Revision  Changes    Path
  1.4       +2 -1      xml-batik/resources/org/apache/batik/bridge/BrokenLink.svg
  
  Index: BrokenLink.svg
  ===================================================================
  RCS file: /home/cvs/xml-batik/resources/org/apache/batik/bridge/BrokenLink.svg,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BrokenLink.svg	2001/08/07 17:28:21	1.3
  +++ BrokenLink.svg	2001/11/06 09:40:33	1.4
  @@ -1,5 +1,6 @@
   <?xml version="1.0" encoding="iso-8859-1"?>
  -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000303 Stylable//EN"   "http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd">
  +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
  +   "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
   <!-- Generator: Adobe Illustrator 9.0, SVG Export Plug-In  -->
   <svg  viewBox="0 0 55.521 60.508" preserveAspectRatio="none">
       <defs>
  
  
  
  1.1                  xml-batik/resources/org/apache/batik/dom/svg/resources/dtdids.properties
  
  Index: dtdids.properties
  ===================================================================
  #
  # The publicIds property represents the list of SVG DTD IDs supported by
  # this SVG DOMImplementation.
  #
  
  publicIds = \
      -//W3C//DTD SVG 1.0//EN\
      -//W3C//DTD SVG 20001102//EN\
      -//W3C//DTD SVG 20000802//EN\
      -//W3C//DTD SVG 20000303 Stylable//EN
  
  
  
  1.12      +10 -10    xml-batik/sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
  
  Index: SAXSVGDocumentFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SAXSVGDocumentFactory.java	2001/10/16 23:25:31	1.11
  +++ SAXSVGDocumentFactory.java	2001/11/06 09:40:34	1.12
  @@ -36,17 +36,17 @@
    * from an URI using SAX2.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: SAXSVGDocumentFactory.java,v 1.11 2001/10/16 23:25:31 deweese Exp $
  + * @version $Id: SAXSVGDocumentFactory.java,v 1.12 2001/11/06 09:40:34 hillion Exp $
    */
   public class SAXSVGDocumentFactory
       extends    SAXDocumentFactory
       implements SVGDocumentFactory {
   
       /**
  -     * The dtd URIs resource bundle class name.
  +     * The dtd public IDs resource bundle class name.
        */
  -    protected final static String DTDS =
  -        "org.apache.batik.dom.svg.resources.dtduris";
  +    protected final static String DTDIDS =
  +        "org.apache.batik.dom.svg.resources.dtdids";
   
       /**
        * Constant for HTTP content type header charset field.
  @@ -54,9 +54,9 @@
       protected final static String HTTP_CHARSET = "charset";
   
       /**
  -     * The accepted DTD URIs.
  +     * The accepted DTD public IDs.
        */
  -    protected static String uris;
  +    protected static String dtdids;
   
       /**
        * Creates a new SVGDocumentFactory object.
  @@ -240,13 +240,13 @@
       public InputSource resolveEntity(String publicId, String systemId)
           throws SAXException {
           try {
  -            if (uris == null) {
  +            if (dtdids == null) {
                   ResourceBundle rb;
  -                rb = ResourceBundle.getBundle(DTDS,
  +                rb = ResourceBundle.getBundle(DTDIDS,
                                                 Locale.getDefault());
  -                uris = rb.getString("uris");
  +                dtdids = rb.getString("publicIds");
               }
  -            if (uris.indexOf(systemId) != -1) {
  +            if (dtdids.indexOf(publicId) != -1) {
                   return new InputSource
                       (getClass().getResource
                        ("resources/svg10.dtd").toString());
  
  
  
  1.5       +2 -2      xml-batik/sources/org/apache/batik/dom/util/SAXDocumentFactory.java
  
  Index: SAXDocumentFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/util/SAXDocumentFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SAXDocumentFactory.java	2001/10/24 14:52:36	1.4
  +++ SAXDocumentFactory.java	2001/11/06 09:40:34	1.5
  @@ -38,7 +38,7 @@
    * from an URI using SAX2.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: SAXDocumentFactory.java,v 1.4 2001/10/24 14:52:36 tkormann Exp $
  + * @version $Id: SAXDocumentFactory.java,v 1.5 2001/11/06 09:40:34 hillion Exp $
    */
   public class SAXDocumentFactory
       extends    DefaultHandler
  @@ -195,7 +195,7 @@
               parser.setErrorHandler(this);
   
               parser.setFeature("http://xml.org/sax/features/namespaces", 
  -			      false);
  +			      true);
               parser.setFeature("http://xml.org/sax/features/namespace-prefixes",
                                 true);
   	    parser.setFeature("http://xml.org/sax/features/validation",
  
  
  
  1.5       +18 -12    xml-batik/sources/org/apache/batik/parser/PathParser.java
  
  Index: PathParser.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/parser/PathParser.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PathParser.java	2001/04/13 13:46:53	1.4
  +++ PathParser.java	2001/11/06 09:40:34	1.5
  @@ -15,7 +15,7 @@
    * attribute values.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: PathParser.java,v 1.4 2001/04/13 13:46:53 hillion Exp $
  + * @version $Id: PathParser.java,v 1.5 2001/11/06 09:40:34 hillion Exp $
    */
   public class PathParser extends NumberParser {
   
  @@ -25,11 +25,6 @@
       protected PathHandler pathHandler;
   
       /**
  -     * Whether the last character was a 'e' or 'E'.
  -     */
  -    protected boolean eRead;
  -
  -    /**
        * Creates a new PathParser.
        */
       public PathParser() {
  @@ -834,7 +829,9 @@
       protected void readNumber() throws ParseException {
   	bufferSize = 0;
   	bufferize();
  -	eRead = false;
  +	boolean eRead = false;
  +	boolean eJustRead = false;
  +	boolean dotRead = false;
           for (;;) {
   	    read();
   	    switch (current) {
  @@ -853,21 +850,30 @@
   	    case 'a': case 'A':
   	    case 'z': case 'Z':
   	    case ',':
  +            case -1:
   		return;
   	    case 'e': case 'E':
  +                if (eRead) {
  +                    return;
  +                }
  +		eJustRead = true;
   		eRead = true;
   		bufferize();
   		break;
  +            case '.':
  +                if (eRead || dotRead) {
  +                    return;
  +                }
  +                dotRead = true;
  +                bufferize();
  +                break;
   	    case '+':
   	    case '-':
  -		if (!eRead) {
  +		if (!eJustRead) {
   		    return;
   		}
   	    default:
  -		if (current == -1) {
  -		    return;
  -		}
  -		eRead = false;
  +		eJustRead = false;
   		bufferize();
   	    }
   	}
  
  
  

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