deweese 2003/03/13 11:03:19
Modified: . build.xml
lib/build stylebook-1.0-b3_xalan-2.jar
resources/org/apache/batik/dom/svg/resources
dtdids.properties
sources/org/apache/batik/dom/svg SAXSVGDocumentFactory.java
xdocs book.xml
Log:
1) DocBook/StyleBook works again.
2) Batik now skips reading the SVG DTD unless validation is turned on.
Revision Changes Path
1.125 +5 -1 xml-batik/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/xml-batik/build.xml,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -r1.124 -r1.125
--- build.xml 5 Mar 2003 22:12:41 -0000 1.124
+++ build.xml 13 Mar 2003 19:03:18 -0000 1.125
@@ -120,6 +120,10 @@
<include name="stylebook*.jar"/>
<include name="xalan*.jar"/>
</fileset>
+ <fileset dir="lib">
+ <include name="xerces*.jar"/>
+ <include name="xml-apis.jar"/>
+ </fileset>
</path>
1.2 +184 -206 xml-batik/lib/build/stylebook-1.0-b3_xalan-2.jar
<<Binary file>>
1.6 +15 -0
xml-batik/resources/org/apache/batik/dom/svg/resources/dtdids.properties
Index: dtdids.properties
===================================================================
RCS file:
/home/cvs/xml-batik/resources/org/apache/batik/dom/svg/resources/dtdids.properties,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- dtdids.properties 19 Nov 2002 08:00:13 -0000 1.5
+++ dtdids.properties 13 Mar 2003 19:03:19 -0000 1.6
@@ -13,6 +13,21 @@
-//W3C//DTD SVG 1.1 Basic//EN\
-//W3C//DTD SVG 1.1 Tiny//EN
+#
+# The skippablePublicIds property represents the list of SVG DTD's we
+# can safely skip if we are not validating. Since SVG may move to
+# schema you shouldn't count on any entities from these files anyways.
+#
+skippablePublicIds = \
+ -//W3C//DTD SVG 1.0//EN\
+ -//W3C//DTD SVG 20010904//EN\
+ -//W3C//DTD SVG 20001102//EN\
+ -//W3C//DTD SVG 20000802//EN\
+ -//W3C//DTD SVG 20000303 Stylable//EN\
+ -//W3C//DTD SVG 1.1//EN\
+ -//W3C//DTD SVG 1.1 Basic//EN\
+ -//W3C//DTD SVG 1.1 Tiny//EN
+
systemId.-//W3C//DTD_SVG_1.0//EN = resources/svg10.dtd
systemId.-//W3C//DTD_SVG_20010904//EN = resources/svg10.dtd
systemId.-//W3C//DTD_SVG_20001102//EN = resources/svg10.dtd
1.19 +30 -6
xml-batik/sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
Index: SAXSVGDocumentFactory.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- SAXSVGDocumentFactory.java 12 Nov 2002 12:32:06 -0000 1.18
+++ SAXSVGDocumentFactory.java 13 Mar 2003 19:03:19 -0000 1.19
@@ -11,6 +11,7 @@
import java.io.InputStream;
import java.io.IOException;
import java.io.Reader;
+import java.io.ByteArrayInputStream;
import java.net.MalformedURLException;
import java.net.URL;
@@ -51,6 +52,11 @@
public static final String KEY_PUBLIC_IDS = "publicIds";
/**
+ * Key used for public identifiers
+ */
+ public static final String KEY_SKIPPABLE_PUBLIC_IDS = "skippablePublicIds";
+
+ /**
* Key used for system identifiers
*/
public static final String KEY_SYSTEM_ID = "systemId.";
@@ -72,6 +78,11 @@
protected static String dtdids;
/**
+ * The DTD public IDs we know we can skip.
+ */
+ protected static String skippable_dtdids;
+
+ /**
* The ResourceBunder for the public and system ids
*/
protected static ResourceBundle rb;
@@ -297,15 +308,28 @@
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException {
try {
- if (dtdids == null) {
- rb = ResourceBundle.getBundle(DTDIDS,
- Locale.getDefault());
+ if (rb == null)
+ rb = ResourceBundle.getBundle(DTDIDS, Locale.getDefault());
+
+ if (dtdids == null)
dtdids = rb.getString(KEY_PUBLIC_IDS);
- }
+
+ if (skippable_dtdids == null)
+ skippable_dtdids = rb.getString(KEY_SKIPPABLE_PUBLIC_IDS);
+
if (publicId != null){
+ if (!isValidating &&
+ (skippable_dtdids.indexOf(publicId) != -1)) {
+ // We are not validating and this is a DTD we can
+ // safely skip so do it...
+ byte [] bytes = new byte[0];
+ return new InputSource(new ByteArrayInputStream(bytes));
+ }
+
if (dtdids.indexOf(publicId) != -1) {
String localSystemId =
- rb.getString(KEY_SYSTEM_ID + publicId.replace(' ', '_'));
+ rb.getString(KEY_SYSTEM_ID +
+ publicId.replace(' ', '_'));
if (localSystemId != null && !"".equals(localSystemId)){
return new InputSource
1.12 +1 -1 xml-batik/xdocs/book.xml
Index: book.xml
===================================================================
RCS file: /home/cvs/xml-batik/xdocs/book.xml,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]