mrglavas 2004/07/12 20:23:42 Modified: java/src/org/apache/xerces/util XMLCatalogResolver.java Log: For LSResourceResolver, resolve the system identifier against
the base URI if the user prefers that the expanded system identifier be used when doing a lookup on the catalog. Also doing a bit of cleanup. Revision Changes Path 1.7 +22 -11 xml-xerces/java/src/org/apache/xerces/util/XMLCatalogResolver.java Index: XMLCatalogResolver.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/util/XMLCatalogResolver.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- XMLCatalogResolver.java 12 Jul 2004 21:51:28 -0000 1.6 +++ XMLCatalogResolver.java 13 Jul 2004 03:23:42 -0000 1.7 @@ -275,12 +275,14 @@ String resolvedId = null; - if(!getUseLiteralSystemId() && baseURI != null){ - - URI base_uri = new URI(baseURI); - URI uri = new URI(base_uri, systemId); - systemId = uri.toString(); - + if (!getUseLiteralSystemId() && baseURI != null) { + // Attempt to resolve the system identifier against the base URI. + try { + URI uri = new URI(new URI(baseURI), systemId); + systemId = uri.toString(); + } + // Ignore the exception. Fallback to the literal system identifier. + catch (URI.MalformedURIException ex) {} } if (publicId != null && systemId != null) { @@ -300,8 +302,8 @@ /** * <p>Locates an external subset for documents which do not explicitly - * provide one. If no external subset is provided, this method should - * return <code>null</code>.</p> + * provide one. This method always returns <code>null</code>. It + * should be overrided if other behaviour is required.</p> * * @param name the identifier of the document root element * @param baseURI the document's base URI @@ -310,8 +312,7 @@ * @throws IOException thrown if some i/o error occurs */ public InputSource getExternalSubset(String name, String baseURI) - throws SAXException, IOException { - + throws SAXException, IOException { return null; } @@ -342,6 +343,16 @@ // the external identifier if one exists. if (namespaceURI != null) { resolvedId = resolveURI(namespaceURI); + } + + if (!getUseLiteralSystemId() && baseURI != null) { + // Attempt to resolve the system identifier against the base URI. + try { + URI uri = new URI(new URI(baseURI), systemId); + systemId = uri.toString(); + } + // Ignore the exception. Fallback to the literal system identifier. + catch (URI.MalformedURIException ex) {} } // Resolve against an external identifier if one exists. This --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]