1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
Index: resolver.xml
===================================================================
RCS file: /home/cvspublic/xml-commons/java/resolver.xml,v
retrieving revision 1.12
diff -u -b -r1.12 resolver.xml
--- resolver.xml 5 Nov 2003 03:02:10 -0000 1.12
+++ resolver.xml 25 Feb 2005 13:42:14 -0000
@@ -83,7 +83,7 @@
<echo message="Compiling..." />
- <javac srcdir="${src.dir}" destdir="${build.classes.dir}">
+ <javac srcdir="${src.dir}" destdir="${build.classes.dir}" source="1.4" debug="on">
<!-- <classpath> not needed since Ant already supplies these Sep-03 -sc -->
<include name="${resolver.subdir}/*.java"/>
<include name="${resolver.subdir}/helpers/*.java"/>
Index: src/org/apache/xml/resolver/Catalog.java
===================================================================
RCS file: /home/cvspublic/xml-commons/java/src/org/apache/xml/resolver/Catalog.java,v
retrieving revision 1.7
diff -u -b -r1.7 Catalog.java
--- src/org/apache/xml/resolver/Catalog.java 2 Sep 2003 07:05:07 -0000 1.7
+++ src/org/apache/xml/resolver/Catalog.java 25 Feb 2005 13:42:18 -0000
@@ -64,6 +64,7 @@
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
+import java.util.Iterator;
import java.net.URL;
import java.net.MalformedURLException;
import org.apache.xml.resolver.CatalogManager;
@@ -1166,6 +1167,23 @@
/**
+ * Return all registered public IDs.
+ */
+ public Iterator getPublicIDs() {
+ Vector v = new Vector();
+ Enumeration enum = catalogEntries.elements();
+
+ while (enum.hasMoreElements()) {
+ CatalogEntry e = (CatalogEntry) enum.nextElement();
+ if (e.getEntryType() == PUBLIC) {
+ v.add(e.getEntryArg(0));
+ }
+ }
+ return v.iterator();
+ }
+
+
+ /**
* Return the applicable DOCTYPE system identifier.
*
* @param entityName The name of the entity (element) for which
Index: src/org/apache/xml/resolver/CatalogManager.java
===================================================================
RCS file: /home/cvspublic/xml-commons/java/src/org/apache/xml/resolver/CatalogManager.java,v
retrieving revision 1.6
diff -u -b -r1.6 CatalogManager.java
--- src/org/apache/xml/resolver/CatalogManager.java 2 Sep 2003 07:05:07 -0000 1.6
+++ src/org/apache/xml/resolver/CatalogManager.java 25 Feb 2005 13:42:20 -0000
@@ -249,7 +249,11 @@
// to avoid it.
}
- /** Constructor that specifies an explicit property file. */
+ /**
+ * Constructor that specifies an explicit property file.
+ * @param propertyFile path to poperty file (e.g. com/resources/CatalogManager).
+ * <code>null</code> means that no property file is consulted at all.
+ */
public CatalogManager(String propertyFile) {
this.propertyFile = propertyFile;
@@ -276,13 +280,14 @@
* resources from it.
*/
private synchronized void readProperties() {
+ if (propertyFile == null) return;
try {
propertyFileURI = CatalogManager.class.getResource("/"+propertyFile);
InputStream in =
CatalogManager.class.getResourceAsStream("/"+propertyFile);
if (in==null) {
if (!ignoreMissingProperties) {
- System.err.println("Cannot find "+propertyFile);
+ debug.message(2, "Cannot find "+propertyFile);
// there's no reason to give this warning more than once
ignoreMissingProperties = true;
}
Index: src/org/apache/xml/resolver/tools/CatalogResolver.java
===================================================================
RCS file: /home/cvspublic/xml-commons/java/src/org/apache/xml/resolver/tools/CatalogResolver.java,v
retrieving revision 1.5
diff -u -b -r1.5 CatalogResolver.java
--- src/org/apache/xml/resolver/tools/CatalogResolver.java 2 Sep 2003 07:05:08 -0000 1.5
+++ src/org/apache/xml/resolver/tools/CatalogResolver.java 25 Feb 2005 13:42:20 -0000
@@ -223,30 +223,9 @@
String resolved = getResolvedEntity(publicId, systemId);
if (resolved != null) {
- try {
InputSource iSource = new InputSource(resolved);
iSource.setPublicId(publicId);
-
- // Ideally this method would not attempt to open the
- // InputStream, but there is a bug (in Xerces, at least)
- // that causes the parser to mistakenly open the wrong
- // system identifier if the returned InputSource does
- // not have a byteStream.
- //
- // It could be argued that we still shouldn't do this here,
- // but since the purpose of calling the entityResolver is
- // almost certainly to open the input stream, it seems to
- // do little harm.
- //
- URL url = new URL(resolved);
- InputStream iStream = url.openStream();
- iSource.setByteStream(iStream);
-
return iSource;
- } catch (Exception e) {
- catalogManager.debug.message(1, "Failed to create InputSource", resolved);
- return null;
- }
}
return null;
|