Index: sources/org/apache/batik/util/ParsedURLData.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/util/ParsedURLData.java,v
retrieving revision 1.7
diff -w -u -r1.7 ParsedURLData.java
--- sources/org/apache/batik/util/ParsedURLData.java    11 Jul 2002 16:26:20 -0000      1.7
+++ sources/org/apache/batik/util/ParsedURLData.java    1 Aug 2002 20:21:10 -0000
@@ -124,18 +124,24 @@
      * URL.
      */
     protected URL buildURL() throws MalformedURLException {
-        String file = "";
-        if (path != null) 
-            file = path;
 
         // System.out.println("File: " + file);
         // if (ref != null)
         //     file += "#" + ref;
+        // System.out.println("Building: " + protocol + " - " + 
+        //                     host + " - " + path);
 
+        if ((protocol != null) && (host != null)) {
+            String file = "";
+            if (path != null) 
+                file = path;
         if (port == -1)
             return new URL(protocol, host, file);
 
         return new URL(protocol, host, port, file);
+        }
+
+        return new URL(toString());
     }
 
     /**
Index: sources/org/apache/batik/util/ParsedURLDefaultProtocolHandler.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/util/ParsedURLDefaultProtocolHandler.java,v
retrieving revision 1.8
diff -w -u -r1.8 ParsedURLDefaultProtocolHandler.java
--- sources/org/apache/batik/util/ParsedURLDefaultProtocolHandler.java  5 Jun 2002 21:14:48 -0000       1.8
+++ sources/org/apache/batik/util/ParsedURLDefaultProtocolHandler.java  1 Aug 2002 20:21:11 -0000
@@ -75,6 +75,7 @@
         }
 
         // new Exception("Custom Parse: " + urlStr).printStackTrace();
+        // System.out.println("Custom Parse: " + urlStr);
 
         ParsedURLData ret = constructParsedURLData();
 
@@ -82,6 +83,16 @@
 
         int pidx=0, idx;
         int len = urlStr.length();
+
+        // Pull fragement id off first...
+        idx = urlStr.indexOf('#');
+        ret.ref = null;
+        if (idx != -1) {
+            if (idx+1 < urlStr.length())
+                ret.ref = urlStr.substring(idx+1);
+            urlStr = urlStr.substring(0,idx);
+        }
+
         String prefix = urlStr;
         if ((idx = prefix.indexOf('/')) != -1)
             // Only check for ':' prior to first '/'
@@ -110,7 +121,6 @@
             // No slashes (apache.org) or a double slash 
             // (//apache.org/....) so
             // we should have host[:port] before next slash.
-
             if (idx != -1) 
                 pidx+=2;  // Skip double slash...
 
@@ -123,9 +133,7 @@
                 // Path spec follows...
                 hostPort = urlStr.substring(pidx, idx);
 
-            hostPort = hostPort;
-
-            pidx = idx;  // Remember location of '/'
+            int hidx = idx;  // Remember location of '/'
 
             // pull apart host and port number...
             idx = hostPort.indexOf(':');
@@ -150,23 +158,18 @@
                     }
                 }
             }
+            if (((ret.host == null) || (ret.host.indexOf('.') == -1)) &&
+                (ret.port == -1))
+                // no '.' in a host spec??? and no port, probably
+                // just a path.
+                ret.host = null;
+            else
+                pidx = hidx;
         }
 
         if ((pidx == -1) || (pidx >= len)) return ret; // Nothing follows
 
-        String pathRef = urlStr.substring(pidx);
-        pathRef = pathRef;
-
-        idx = pathRef.indexOf('#');
-        ret.ref = null;
-        if (idx == -1) {
-            // No ref (fragment) in URL
-            ret.path = pathRef;
-        } else {
-            ret.path = pathRef.substring(0,idx);
-            if (idx+1 < pathRef.length())
-                ret.ref = pathRef.substring(idx+1);
-        }
+        ret.path = urlStr.substring(pidx);
         return ret;
     }
