diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-10 22:37:49 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-10 22:37:49 +0000 |
commit | 0222c86d39a53b25983f60c25f118aee9b9ffb1c (patch) | |
tree | ea15c23a813c189b0cfc7644cb601587ade2a3f2 /java/sca/modules/contribution/src | |
parent | af798b8f4c826c058bcc946af3224083d9ee3bd6 (diff) |
Cache DTDs for XMLSchema
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@783559 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/contribution/src')
-rw-r--r-- | java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java index dd52b8b533..8aac0ce3f6 100644 --- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java +++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java @@ -371,6 +371,9 @@ public class DefaultValidatingXMLInputFactory extends ValidatingXMLInputFactory inputFactory.setXMLResolver(arg0); } + /** + * Cache for public XSDs and DTDs + */ private static Map<String, URL> cachedXSDs = new HashMap<String, URL>(); static { cachedXSDs @@ -391,13 +394,25 @@ public class DefaultValidatingXMLInputFactory extends ValidatingXMLInputFactory .getResource("/org/apache/tuscany/sca/assembly/xsd/xml.xsd")); cachedXSDs.put("http://www.w3.org/2000/09/xmldsig#", DefaultValidatingXMLInputFactory.class .getResource("/org/apache/tuscany/sca/assembly/xsd/xmldsig-core-schema.xsd")); + + cachedXSDs.put("-//W3C//DTD XMLSCHEMA 200102//EN", DefaultValidatingXMLInputFactory.class + .getResource("/org/apache/tuscany/sca/assembly/xsd/XMLSchema.dtd")); + cachedXSDs.put("datatypes", DefaultValidatingXMLInputFactory.class + .getResource("/org/apache/tuscany/sca/assembly/xsd/datatypes.dtd")); }; public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { - URL url = cachedXSDs.get(namespaceURI); + String key = null; + if("http://www.w3.org/2001/XMLSchema".equals(type)) { + key = namespaceURI; + } else if("http://www.w3.org/TR/REC-xml".equals(type)) { + key = publicId; + } + URL url = cachedXSDs.get(key); if (url != null) { systemId = url.toString(); } + LSInput input = ls.createLSInput(); input.setBaseURI(baseURI); input.setPublicId(publicId); |