summaryrefslogtreecommitdiff
path: root/gnu/xml/stream/XMLParser.java
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/xml/stream/XMLParser.java')
-rw-r--r--gnu/xml/stream/XMLParser.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/gnu/xml/stream/XMLParser.java b/gnu/xml/stream/XMLParser.java
index 663a300f8..fae4afec8 100644
--- a/gnu/xml/stream/XMLParser.java
+++ b/gnu/xml/stream/XMLParser.java
@@ -439,6 +439,7 @@ public class XMLParser
throw e2;
}
}
+ systemId = canonicalize(systemId);
pushInput(new Input(in, null, null, systemId, null, null, false, true));
}
@@ -513,6 +514,7 @@ public class XMLParser
throw e2;
}
}
+ systemId = canonicalize(systemId);
pushInput(new Input(null, reader, null, systemId, null, null, false, true));
}
@@ -1540,7 +1542,7 @@ public class XMLParser
{
if (!externalEntities)
return;
- String url = absolutize(input.systemId, ids.systemId);
+ String url = canonicalize(absolutize(input.systemId, ids.systemId));
// Check for recursion
for (Iterator i = inputStack.iterator(); i.hasNext(); )
{
@@ -1587,6 +1589,20 @@ public class XMLParser
}
/**
+ * Returns a canonicalized version of the specified URL.
+ * This is largely to work around a problem with the specification of
+ * file URLs.
+ */
+ static String canonicalize(String url)
+ {
+ if (url == null)
+ return null;
+ if (url.startsWith("file:") && !url.startsWith("file://"))
+ url = "file://" + url.substring(5);
+ return url;
+ }
+
+ /**
* "Absolutize" a URL. This resolves a relative URL into an absolute one.
* @param base the current base URL
* @param href the (absolute or relative) URL to resolve