diff options
Diffstat (limited to 'org')
-rw-r--r-- | org/madore/damlengine/Resolver.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/org/madore/damlengine/Resolver.java b/org/madore/damlengine/Resolver.java index 80f8afb..103659c 100644 --- a/org/madore/damlengine/Resolver.java +++ b/org/madore/damlengine/Resolver.java @@ -1,5 +1,6 @@ package org.madore.damlengine; +import java.io.StringReader; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -111,6 +112,27 @@ public final class Resolver return systemId; } + protected String damlMagic(String uri) { + if ( uri.equals("x-daml-magic://daml/weblog/doindex.xml") ) + return "IGNORE"; + else if ( uri.equals("x-daml-magic://daml/weblog/domaxentries.xml") ) + return "INCLUDE"; + else if ( uri.equals("x-daml-magic://daml/weblog/maxentries.xml") ) + return "20"; + else if ( uri.equals("x-daml-magic://daml/weblog/domonth.xml") ) + return "IGNORE"; + else if ( uri.equals("x-daml-magic://daml/weblog/month.xml") ) + return ""; + else if ( uri.equals("x-daml-magic://daml/weblog/docategory.xml") ) + return "IGNORE"; + else if ( uri.equals("x-daml-magic://daml/weblog/category-en.xml") ) + return ""; + else if ( uri.equals("x-daml-magic://daml/weblog/category-fr.xml") ) + return ""; + else + return null; + } + // Interface LSResourceResolver public LSInput resolveResource(String type, @@ -118,6 +140,10 @@ public final class Resolver String publicId, String systemId, String baseURI) { + String str = damlMagic(systemId); + if ( str != null ) + return new DOMInputImpl(publicId, systemId, baseURI, + str, "UTF-8"); String resolved = resolve(namespaceURI, publicId, systemId, baseURI); return new DOMInputImpl(publicId, resolved, baseURI); } @@ -126,6 +152,12 @@ public final class Resolver public InputSource resolveEntity(String publicId, String systemId) throws SAXException { + String str = damlMagic(systemId); + if ( str != null ) { + InputSource source = new InputSource(new StringReader(str)); + source.setPublicId(publicId); + return source; + } String resolved = resolve(null, publicId, systemId, null); InputSource source = new InputSource(resolved); source.setPublicId(publicId); @@ -137,6 +169,12 @@ public final class Resolver public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException { + String str = damlMagic(systemId); + if ( str != null ) { + InputSource source = new InputSource(new StringReader(str)); + source.setPublicId(publicId); + return source; + } String resolved = resolve(null, publicId, systemId, baseURI); InputSource source = new InputSource(resolved); source.setPublicId(publicId); |