You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by hi...@apache.org on 2001/01/09 10:35:53 UTC
cvs commit: xml-batik/sources/org/apache/batik/dom/svg SAXSVGDocumentFactory.java SVGDOMImplementation.java
hillion 01/01/09 01:35:53
Modified: sources/org/apache/batik/dom/svg SAXSVGDocumentFactory.java
SVGDOMImplementation.java
Log:
Minor fixes.
Revision Changes Path
1.2 +54 -4 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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SAXSVGDocumentFactory.java 2001/01/08 13:19:51 1.1
+++ SAXSVGDocumentFactory.java 2001/01/09 09:35:52 1.2
@@ -31,7 +31,7 @@
* from an URI using SAX2.
*
* @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
- * @version $Id: SAXSVGDocumentFactory.java,v 1.1 2001/01/08 13:19:51 hillion Exp $
+ * @version $Id: SAXSVGDocumentFactory.java,v 1.2 2001/01/09 09:35:52 hillion Exp $
*/
public class SAXSVGDocumentFactory
extends SAXDocumentFactory
@@ -66,7 +66,7 @@
InputSource is = new InputSource(uri);
try {
- doc = (SVGOMDocument)createDocument
+ doc = (SVGOMDocument)super.createDocument
(SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", uri, is);
doc.setURLObject(new URL(uri));
} catch (MalformedURLException e) {
@@ -87,7 +87,7 @@
is.setSystemId(uri);
try {
- doc = (SVGOMDocument)createDocument
+ doc = (SVGOMDocument)super.createDocument
(SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", uri, is);
doc.setURLObject(new URL(uri));
} catch (MalformedURLException e) {
@@ -108,13 +108,63 @@
is.setSystemId(uri);
try {
- doc = (SVGOMDocument)createDocument
+ doc = (SVGOMDocument)super.createDocument
(SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", uri, is);
doc.setURLObject(new URL(uri));
} catch (MalformedURLException e) {
throw new IOException(e.getMessage());
}
return doc;
+ }
+
+ /**
+ * Creates a Document instance.
+ * @param ns The namespace URI of the root element of the document.
+ * @param root The name of the root element of the document.
+ * @param uri The document URI.
+ * @exception IOException if an error occured while reading the document.
+ */
+ public Document createDocument(String ns, String root, String uri)
+ throws IOException {
+ if (!SVGDOMImplementation.SVG_NAMESPACE_URI.equals(ns) ||
+ !"svg".equals(root)) {
+ throw new RuntimeException("Bad root element");
+ }
+ return super.createDocument(ns, root, uri);
+ }
+
+ /**
+ * Creates a Document instance.
+ * @param ns The namespace URI of the root element of the document.
+ * @param root The name of the root element of the document.
+ * @param uri The document URI.
+ * @param is The document input stream.
+ * @exception IOException if an error occured while reading the document.
+ */
+ public Document createDocument(String ns, String root, String uri, InputStream is)
+ throws IOException {
+ if (!SVGDOMImplementation.SVG_NAMESPACE_URI.equals(ns) ||
+ !"svg".equals(root)) {
+ throw new RuntimeException("Bad root element");
+ }
+ return super.createDocument(ns, root, uri, is);
+ }
+
+ /**
+ * Creates a Document instance.
+ * @param ns The namespace URI of the root element of the document.
+ * @param root The name of the root element of the document.
+ * @param uri The document URI.
+ * @param r The document reader.
+ * @exception IOException if an error occured while reading the document.
+ */
+ public Document createDocument(String ns, String root, String uri, Reader r)
+ throws IOException {
+ if (!SVGDOMImplementation.SVG_NAMESPACE_URI.equals(ns) ||
+ !"svg".equals(root)) {
+ throw new RuntimeException("Bad root element");
+ }
+ return super.createDocument(ns, root, uri, r);
}
/**
1.9 +4 -2 xml-batik/sources/org/apache/batik/dom/svg/SVGDOMImplementation.java
Index: SVGDOMImplementation.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/svg/SVGDOMImplementation.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SVGDOMImplementation.java 2000/11/09 16:56:42 1.8
+++ SVGDOMImplementation.java 2001/01/09 09:35:52 1.9
@@ -22,6 +22,8 @@
import org.apache.batik.dom.util.CSSStyleDeclarationFactory;
import org.apache.batik.dom.util.DOMUtilities;
import org.apache.batik.dom.util.HashTable;
+import org.apache.batik.util.SVGConstants;
+
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
import org.w3c.dom.DOMException;
@@ -38,7 +40,7 @@
* This class implements the {@link org.w3c.dom.DOMImplementation} interface.
*
* @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
- * @version $Id: SVGDOMImplementation.java,v 1.8 2000/11/09 16:56:42 hillion Exp $
+ * @version $Id: SVGDOMImplementation.java,v 1.9 2001/01/09 09:35:52 hillion Exp $
*/
public class SVGDOMImplementation
extends AbstractDOMImplementation
@@ -49,7 +51,7 @@
* The SVG namespace uri.
*/
public final static String SVG_NAMESPACE_URI =
- "http://www.w3.org/2000/svg";
+ SVGConstants.SVG_NAMESPACE_URI;
/**
* The default instance of this class.