tkormann 01/10/24 07:52:37
Modified: resources/org/apache/batik/apps/svgbrowser/resources
GUI.properties
sources/org/apache/batik/apps/svgbrowser Application.java
JSVGViewerFrame.java Main.java
PreferenceDialog.java
sources/org/apache/batik/bridge DocumentLoader.java
URIResolver.java UserAgent.java
UserAgentAdapter.java
sources/org/apache/batik/dom/util DocumentFactory.java
SAXDocumentFactory.java
sources/org/apache/batik/swing/svg JSVGComponent.java
SVGUserAgent.java
sources/org/apache/batik/transcoder
XMLAbstractTranscoder.java
sources/org/apache/batik/transcoder/image
ImageTranscoder.java
sources/org/apache/batik/transcoder/print
PrintTranscoder.java
Log:
add an option (TranscodingHint, checkbox in the browser...) to toggle the XML
parser in validation mode.
Revision Changes Path
1.36 +2 -1
xml-batik/resources/org/apache/batik/apps/svgbrowser/resources/GUI.properties
Index: GUI.properties
===================================================================
RCS file:
/home/cvs/xml-batik/resources/org/apache/batik/apps/svgbrowser/resources/GUI.properties,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- GUI.properties 2001/10/15 14:40:15 1.35
+++ GUI.properties 2001/10/24 14:52:35 1.36
@@ -9,7 +9,7 @@
# The viewer's GUI resources.
#
# Author: [EMAIL PROTECTED]
-# $Id: GUI.properties,v 1.35 2001/10/15 14:40:15 tkormann Exp $
+# $Id: GUI.properties,v 1.36 2001/10/24 14:52:35 tkormann Exp $
#
ViewSource.width = 750
@@ -371,6 +371,7 @@
PreferenceDialog.label.show.rendering = Show Rendering
PreferenceDialog.label.show.debug.trace = Show Debug Trace
PreferenceDialog.label.selection.xor.mode = Display selection overlay using XOR mode
+PreferenceDialog.label.is.xml.parser.validating = Use a validating XML parser
PreferenceDialog.label.host = Proxy Host
PreferenceDialog.label.port = Proxy Port
1.5 +7 -1
xml-batik/sources/org/apache/batik/apps/svgbrowser/Application.java
Index: Application.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/apps/svgbrowser/Application.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Application.java 2001/10/15 11:08:36 1.4
+++ Application.java 2001/10/24 14:52:35 1.5
@@ -14,7 +14,7 @@
* This interface represents a SVG viewer application.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a>
- * @version $Id: Application.java,v 1.4 2001/10/15 11:08:36 tkormann Exp $
+ * @version $Id: Application.java,v 1.5 2001/10/24 14:52:35 tkormann Exp $
*/
public interface Application {
@@ -42,6 +42,12 @@
* Returns the XML parser class name.
*/
String getXMLParserClassName();
+
+ /**
+ * Returns true if the XML parser must be in validation mode, false
+ * otherwise.
+ */
+ boolean isXMLParserValidating();
/**
* Shows the preference dialog.
1.63 +9 -1
xml-batik/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
Index: JSVGViewerFrame.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- JSVGViewerFrame.java 2001/10/15 15:34:32 1.62
+++ JSVGViewerFrame.java 2001/10/24 14:52:35 1.63
@@ -157,7 +157,7 @@
* This class represents a SVG viewer swing frame.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a>
- * @version $Id: JSVGViewerFrame.java,v 1.62 2001/10/15 15:34:32 tkormann Exp $
+ * @version $Id: JSVGViewerFrame.java,v 1.63 2001/10/24 14:52:35 tkormann Exp $
*/
public class JSVGViewerFrame
extends JFrame
@@ -1739,6 +1739,14 @@
public String getXMLParserClassName() {
return application.getXMLParserClassName();
}
+
+ /**
+ * Returns true if the XML parser must be in validation mode, false
+ * otherwise.
+ */
+ public boolean isXMLParserValidating() {
+ return application.isXMLParserValidating();
+ }
/**
* Returns this user agent's CSS media.
1.21 +13 -2 xml-batik/sources/org/apache/batik/apps/svgbrowser/Main.java
Index: Main.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/apps/svgbrowser/Main.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Main.java 2001/10/15 11:08:36 1.20
+++ Main.java 2001/10/24 14:52:35 1.21
@@ -45,7 +45,7 @@
* This class contains the main method of an SVG viewer.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a>
- * @version $Id: Main.java,v 1.20 2001/10/15 11:08:36 tkormann Exp $
+ * @version $Id: Main.java,v 1.21 2001/10/24 14:52:35 tkormann Exp $
*/
public class Main implements Application {
@@ -145,7 +145,9 @@
"");
defaults.put(PreferenceDialog.PREFERENCE_KEY_CSS_MEDIA,
"screen");
-
+ defaults.put(PreferenceDialog.PREFERENCE_KEY_IS_XML_PARSER_VALIDATING,
+ Boolean.FALSE);
+
try {
preferenceManager = new XMLPreferenceManager("preferences.xml",
defaults);
@@ -364,6 +366,15 @@
*/
public String getXMLParserClassName() {
return XMLResourceDescriptor.getXMLParserClassName();
+ }
+
+ /**
+ * Returns true if the XML parser must be in validation mode, false
+ * otherwise.
+ */
+ public boolean isXMLParserValidating() {
+ return preferenceManager.getBoolean
+ (PreferenceDialog.PREFERENCE_KEY_IS_XML_PARSER_VALIDATING);
}
/**
1.10 +19 -2
xml-batik/sources/org/apache/batik/apps/svgbrowser/PreferenceDialog.java
Index: PreferenceDialog.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/apps/svgbrowser/PreferenceDialog.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- PreferenceDialog.java 2001/10/15 09:42:55 1.9
+++ PreferenceDialog.java 2001/10/24 14:52:35 1.10
@@ -55,7 +55,7 @@
* Dialog that displays user preferences.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Hardy</a>
- * @version $Id: PreferenceDialog.java,v 1.9 2001/10/15 09:42:55 tkormann Exp $
+ * @version $Id: PreferenceDialog.java,v 1.10 2001/10/24 14:52:35 tkormann Exp $
*/
public class PreferenceDialog extends JDialog
implements GridBagConstants {
@@ -122,6 +122,9 @@
public static final String LABEL_SELECTION_XOR_MODE
= "PreferenceDialog.label.selection.xor.mode";
+ public static final String LABEL_IS_XML_PARSER_VALIDATING
+ = "PreferenceDialog.label.is.xml.parser.validating";
+
public static final String LABEL_HOST
= "PreferenceDialog.label.host";
@@ -162,6 +165,9 @@
public static final String PREFERENCE_KEY_LANGUAGES
= "preference.key.languages";
+
+ public static final String PREFERENCE_KEY_IS_XML_PARSER_VALIDATING
+ = "preference.key.is.xml.parser.validating";
public static final String PREFERENCE_KEY_USER_STYLESHEET
= "preference.key.user.stylesheet";
@@ -221,6 +227,8 @@
protected JCheckBox selectionXorMode;
+ protected JCheckBox isXMLParserValidating;
+
protected JTextField host, port;
protected CSSMediaPanel cssMediaPanel;
@@ -281,6 +289,8 @@
showDebugTrace.setSelected(model.getBoolean(PREFERENCE_KEY_SHOW_DEBUG_TRACE));
selectionXorMode.setSelected(model.getBoolean(PREFERENCE_KEY_SELECTION_XOR_MODE));
+
isXMLParserValidating.setSelected(model.getBoolean(PREFERENCE_KEY_IS_XML_PARSER_VALIDATING));
+
//
// Initialize the proxy options
//
@@ -313,9 +323,10 @@
enableDoubleBuffering.isSelected());
model.setBoolean(PREFERENCE_KEY_SHOW_DEBUG_TRACE,
showDebugTrace.isSelected());
-
model.setBoolean(PREFERENCE_KEY_SELECTION_XOR_MODE,
selectionXorMode.isSelected());
+ model.setBoolean(PREFERENCE_KEY_IS_XML_PARSER_VALIDATING,
+ isXMLParserValidating.isSelected());
model.setString(PREFERENCE_KEY_PROXY_HOST,
host.getText());
@@ -485,14 +496,19 @@
= new JCheckBox(Resources.getString(LABEL_ENABLE_DOUBLE_BUFFERING));
showDebugTrace
= new JCheckBox(Resources.getString(LABEL_SHOW_DEBUG_TRACE));
+
selectionXorMode
= new JCheckBox(Resources.getString(LABEL_SELECTION_XOR_MODE));
+ isXMLParserValidating
+ = new JCheckBox(Resources.getString(LABEL_IS_XML_PARSER_VALIDATING));
+
p.add(showRendering, 0, 0, 1, 1, WEST, HORIZONTAL, 1, 0);
p.add(autoAdjustWindow, 0, 1, 1, 1, WEST, HORIZONTAL, 1, 0);
p.add(enableDoubleBuffering, 0, 2, 1, 1, WEST, HORIZONTAL, 1, 0);
p.add(showDebugTrace, 0, 3, 1, 1, WEST, HORIZONTAL, 1, 0);
p.add(selectionXorMode, 0, 4, 1, 1, WEST, HORIZONTAL, 1, 0);
+ p.add(isXMLParserValidating, 0, 5, 1, 1, WEST, HORIZONTAL, 1, 0);
p.setBorder(BorderFactory.createCompoundBorder
(BorderFactory.createTitledBorder
@@ -543,6 +559,7 @@
defaults.put(PREFERENCE_KEY_LANGUAGES, "fr");
defaults.put(PREFERENCE_KEY_SHOW_RENDERING, Boolean.TRUE);
defaults.put(PREFERENCE_KEY_SELECTION_XOR_MODE, Boolean.FALSE);
+ defaults.put(PREFERENCE_KEY_IS_XML_PARSER_VALIDATING, Boolean.FALSE);
defaults.put(PREFERENCE_KEY_AUTO_ADJUST_WINDOW, Boolean.TRUE);
defaults.put(PREFERENCE_KEY_ENABLE_DOUBLE_BUFFERING, Boolean.TRUE);
defaults.put(PREFERENCE_KEY_SHOW_DEBUG_TRACE, Boolean.TRUE);
1.11 +2 -3 xml-batik/sources/org/apache/batik/bridge/DocumentLoader.java
Index: DocumentLoader.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/DocumentLoader.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DocumentLoader.java 2001/04/23 12:19:34 1.10
+++ DocumentLoader.java 2001/10/24 14:52:35 1.11
@@ -30,7 +30,7 @@
* maintaining a cache.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a>
- * @version $Id: DocumentLoader.java,v 1.10 2001/04/23 12:19:34 tkormann Exp $
+ * @version $Id: DocumentLoader.java,v 1.11 2001/10/24 14:52:35 tkormann Exp $
*/
public class DocumentLoader {
@@ -66,6 +66,7 @@
this.userAgent = userAgent;
documentFactory = new SAXSVGDocumentFactory
(userAgent.getXMLParserClassName(), true);
+ documentFactory.setValidating(userAgent.isXMLParserValidating());
}
/**
@@ -80,8 +81,6 @@
}
DocumentState state = (DocumentState)cacheMap.get(uri);
if (state == null) {
- //System.out.println("loading: "+uri);
- // load the document
Document document = documentFactory.createDocument(uri);
DefaultSVGContext ctx
= (DefaultSVGContext)((SVGOMDocument)document).getSVGContext();
1.13 +2 -1 xml-batik/sources/org/apache/batik/bridge/URIResolver.java
Index: URIResolver.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/URIResolver.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- URIResolver.java 2001/10/18 12:30:22 1.12
+++ URIResolver.java 2001/10/24 14:52:36 1.13
@@ -28,7 +28,7 @@
* This class is used to resolve the URI that can be found in a SVG document.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a>
- * @version $Id: URIResolver.java,v 1.12 2001/10/18 12:30:22 hillion Exp $
+ * @version $Id: URIResolver.java,v 1.13 2001/10/24 14:52:36 tkormann Exp $
*/
public class URIResolver {
/**
@@ -66,6 +66,7 @@
*/
public Element getElement(String uri, Element ref)
throws MalformedURLException, IOException {
+
Node n = getNode(uri, ref);
if (n == null) {
return null;
1.18 +24 -18 xml-batik/sources/org/apache/batik/bridge/UserAgent.java
Index: UserAgent.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/UserAgent.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- UserAgent.java 2001/10/08 15:49:37 1.17
+++ UserAgent.java 2001/10/24 14:52:36 1.18
@@ -24,7 +24,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Christophe Jolif</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a>
- * @version $Id: UserAgent.java,v 1.17 2001/10/08 15:49:37 hillion Exp $
+ * @version $Id: UserAgent.java,v 1.18 2001/10/24 14:52:36 tkormann Exp $
*/
public interface UserAgent {
@@ -32,90 +32,96 @@
/**
* Returns the event dispatcher to use.
*/
- public EventDispatcher getEventDispatcher();
+ EventDispatcher getEventDispatcher();
/**
* Returns the default size of the viewport.
*/
- public Dimension2D getViewportSize();
+ Dimension2D getViewportSize();
/**
* Displays an error resulting from the specified Exception.
*/
- public void displayError(Exception ex);
+ void displayError(Exception ex);
/**
* Displays a message in the User Agent interface.
*/
- public void displayMessage(String message);
+ void displayMessage(String message);
/**
* Returns the pixel to mm factor.
*/
- public float getPixelToMM();
+ float getPixelToMM();
/**
* Returns the language settings.
*/
- public String getLanguages();
+ String getLanguages();
/**
* Returns the user stylesheet uri.
* @return null if no user style sheet was specified.
*/
- public String getUserStyleSheetURI();
+ String getUserStyleSheetURI();
/**
* Opens a link.
* @param elt The activated link element.
*/
- public void openLink(SVGAElement elt);
+ void openLink(SVGAElement elt);
/**
* Informs the user agent to change the cursor.
* @param cursor the new cursor
*/
- public void setSVGCursor(Cursor cursor);
+ void setSVGCursor(Cursor cursor);
/**
* Returns the class name of the XML parser.
*/
- public String getXMLParserClassName();
+ String getXMLParserClassName();
/**
+ * Returns true if the XML parser must be in validation mode, false
+ * otherwise.
+ */
+ boolean isXMLParserValidating();
+
+ /**
* Returns the <code>AffineTransform</code> currently
* applied to the drawing by the UserAgent.
*/
- public AffineTransform getTransform();
+ AffineTransform getTransform();
/**
* Returns this user agent's CSS media.
*/
- public String getMedia();
+ String getMedia();
/**
* Returns the location on the screen of the
* client area in the UserAgent.
*/
- public Point getClientAreaLocationOnScreen();
+ Point getClientAreaLocationOnScreen();
/**
* Tells whether the given feature is supported by this
* user agent.
*/
- public boolean hasFeature(String s);
+ boolean hasFeature(String s);
/**
* Tells whether the given extension is supported by this
* user agent.
*/
- public boolean supportExtension(String s);
+ boolean supportExtension(String s);
/**
* Lets the bridge tell the user agent that the following
* extension is supported by the bridge.
*/
- public void registerExtension(BridgeExtension ext);
+ void registerExtension(BridgeExtension ext);
/**
* Notifies the UserAgent that the input element
@@ -124,5 +130,5 @@
* <title> elements in a UserAgent-dependant
* way.
*/
- public void handleElement(Element elt, Object data);
+ void handleElement(Element elt, Object data);
}
1.5 +8 -1 xml-batik/sources/org/apache/batik/bridge/UserAgentAdapter.java
Index: UserAgentAdapter.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/UserAgentAdapter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- UserAgentAdapter.java 2001/10/08 15:49:37 1.4
+++ UserAgentAdapter.java 2001/10/24 14:52:36 1.5
@@ -31,7 +31,7 @@
* the creation of UserAgent instances.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Thomas DeWeese</a>
- * @version $Id: UserAgentAdapter.java,v 1.4 2001/10/08 15:49:37 hillion Exp $
+ * @version $Id: UserAgentAdapter.java,v 1.5 2001/10/24 14:52:36 tkormann Exp $
*/
public class UserAgentAdapter implements UserAgent {
protected Set FEATURES = new HashSet();
@@ -106,6 +106,13 @@
*/
public String getXMLParserClassName() {
return XMLResourceDescriptor.getXMLParserClassName();
+ }
+
+ /**
+ * Returns <tt>false</tt>. The XML parser is not in validation mode.
+ */
+ public boolean isXMLParserValidating() {
+ return false;
}
/**
1.7 +14 -1 xml-batik/sources/org/apache/batik/dom/util/DocumentFactory.java
Index: DocumentFactory.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/dom/util/DocumentFactory.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DocumentFactory.java 2001/02/13 19:45:16 1.6
+++ DocumentFactory.java 2001/10/24 14:52:36 1.7
@@ -18,9 +18,22 @@
* This interface represents an object which can build a Document.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a>
- * @version $Id: DocumentFactory.java,v 1.6 2001/02/13 19:45:16 hillion Exp $
+ * @version $Id: DocumentFactory.java,v 1.7 2001/10/24 14:52:36 tkormann Exp $
*/
public interface DocumentFactory {
+
+ /**
+ * Sets whether or not the XML stream has to be validate, depending on the
+ * specified parameter.
+ *
+ * @param isValidating true implies the XML stream will be validated
+ */
+ void setValidating(boolean isValidating);
+
+ /**
+ * Returns true if the XML stream has to be validated, false otherwise.
+ */
+ boolean isValidating();
/**
* Creates a Document instance.
1.4 +47 -6
xml-batik/sources/org/apache/batik/dom/util/SAXDocumentFactory.java
Index: SAXDocumentFactory.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/dom/util/SAXDocumentFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SAXDocumentFactory.java 2001/02/13 19:45:17 1.3
+++ SAXDocumentFactory.java 2001/10/24 14:52:36 1.4
@@ -27,6 +27,7 @@
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.ext.LexicalHandler;
import org.xml.sax.helpers.DefaultHandler;
@@ -37,7 +38,7 @@
* from an URI using SAX2.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a>
- * @version $Id: SAXDocumentFactory.java,v 1.3 2001/02/13 19:45:17 hillion Exp $
+ * @version $Id: SAXDocumentFactory.java,v 1.4 2001/10/24 14:52:36 tkormann Exp $
*/
public class SAXDocumentFactory
extends DefaultHandler
@@ -90,6 +91,11 @@
protected boolean inDTD;
/**
+ * Whether the parser is in validating mode.
+ */
+ protected boolean isValidating;
+
+ /**
* Whether the document element has been parsed.
*/
protected boolean documentElementParsed;
@@ -145,8 +151,8 @@
* @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 {
+ public Document createDocument(String ns, String root, String uri,
+ InputStream is) throws IOException {
InputSource inp = new InputSource(is);
inp.setSystemId(uri);
return createDocument(ns, root, uri, inp);
@@ -188,13 +194,14 @@
parser.setEntityResolver(this);
parser.setErrorHandler(this);
- parser.setFeature("http://xml.org/sax/features/namespaces", false);
+ parser.setFeature("http://xml.org/sax/features/namespaces",
+ false);
parser.setFeature("http://xml.org/sax/features/namespace-prefixes",
true);
-
+ parser.setFeature("http://xml.org/sax/features/validation",
+ isValidating);
parser.setProperty("http://xml.org/sax/properties/lexical-handler",
this);
-
parser.parse(is);
} catch (SAXException e) {
Exception ex = e.getException();
@@ -225,6 +232,24 @@
}
/**
+ * Sets whether or not the XML parser will validate the XML document
+ * depending on the specified parameter.
+ *
+ * @param isValidating indicates that the XML parser will validate the XML
+ * document
+ */
+ public void setValidating(boolean isValidating) {
+ this.isValidating = isValidating;
+ }
+
+ /**
+ * Returns true if the XML parser validates the XML stream, false otherwise.
+ */
+ public boolean isValidating() {
+ return isValidating;
+ }
+
+ /**
* <b>SAX</b>: Implements {@link
* org.xml.sax.ContentHandler#startDocument()}.
*/
@@ -338,6 +363,22 @@
}
}
}
+ }
+
+ /**
+ * <b>SAX</b>: Implements {@link
+ * org.xml.sax.ErrorHandler#error(SAXParseException)}.
+ */
+ public void error(SAXParseException ex) throws SAXException {
+ throw ex;
+ }
+
+ /**
+ * <b>SAX</b>: Implements {@link
+ * org.xml.sax.ErrorHandler#warning(SAXParseException)}.
+ */
+ public void warning(SAXParseException ex) throws SAXException {
+ throw ex;
}
/**
1.28 +12 -1 xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java
Index: JSVGComponent.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- JSVGComponent.java 2001/10/08 15:49:38 1.27
+++ JSVGComponent.java 2001/10/24 14:52:36 1.28
@@ -152,7 +152,7 @@
* building/rendering a document (invalid XML file, missing attributes...).</p>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a>
- * @version $Id: JSVGComponent.java,v 1.27 2001/10/08 15:49:38 hillion Exp $
+ * @version $Id: JSVGComponent.java,v 1.28 2001/10/24 14:52:36 tkormann Exp $
*/
public class JSVGComponent extends JGVTComponent {
@@ -910,6 +910,17 @@
return "org.apache.crimson.parser.XMLReaderImpl";
}
+ /**
+ * Returns true if the XML parser must be in validation mode, false
+ * otherwise depending on the SVGUserAgent.
+ */
+ public boolean isXMLParserValidating() {
+ if (svgUserAgent != null) {
+ return svgUserAgent.isXMLParserValidating();
+ }
+ return false;
+ }
+
/**
* Returns the <code>AffineTransform</code> currently
* applied to the drawing by the UserAgent.
1.6 +7 -1 xml-batik/sources/org/apache/batik/swing/svg/SVGUserAgent.java
Index: SVGUserAgent.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/svg/SVGUserAgent.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SVGUserAgent.java 2001/10/08 15:49:38 1.5
+++ SVGUserAgent.java 2001/10/24 14:52:36 1.6
@@ -15,7 +15,7 @@
* a JSVGComponent.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a>
- * @version $Id: SVGUserAgent.java,v 1.5 2001/10/08 15:49:38 hillion Exp $
+ * @version $Id: SVGUserAgent.java,v 1.6 2001/10/24 14:52:36 tkormann Exp $
*/
public interface SVGUserAgent {
@@ -55,6 +55,12 @@
* Returns the class name of the XML parser.
*/
String getXMLParserClassName();
+
+ /**
+ * Returns true if the XML parser must be in validation mode, false
+ * otherwise.
+ */
+ boolean isXMLParserValidating();
/**
* Returns this user agent's CSS media.
1.10 +33 -4
xml-batik/sources/org/apache/batik/transcoder/XMLAbstractTranscoder.java
Index: XMLAbstractTranscoder.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/transcoder/XMLAbstractTranscoder.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- XMLAbstractTranscoder.java 2001/05/07 23:49:52 1.9
+++ XMLAbstractTranscoder.java 2001/10/24 14:52:36 1.10
@@ -15,6 +15,7 @@
import org.apache.batik.dom.util.DocumentFactory;
import org.apache.batik.dom.util.SAXDocumentFactory;
+import org.apache.batik.transcoder.keys.BooleanKey;
import org.apache.batik.transcoder.keys.DOMImplementationKey;
import org.apache.batik.transcoder.keys.StringKey;
@@ -41,14 +42,16 @@
* </ul>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a>
- * @version $Id: XMLAbstractTranscoder.java,v 1.9 2001/05/07 23:49:52 tkormann Exp $
+ * @version $Id: XMLAbstractTranscoder.java,v 1.10 2001/10/24 14:52:36 tkormann Exp
$
*/
public abstract class XMLAbstractTranscoder extends AbstractTranscoder {
/**
* Constructs a new <tt>XMLAbstractTranscoder</tt>.
*/
- protected XMLAbstractTranscoder() {}
+ protected XMLAbstractTranscoder() {
+ hints.put(KEY_XML_PARSER_VALIDATING, Boolean.FALSE);
+ }
/**
* Transcodes the specified XML input in the specified output. All
@@ -76,7 +79,7 @@
(String)hints.get(KEY_DOCUMENT_ELEMENT);
DOMImplementation domImpl =
(DOMImplementation)hints.get(KEY_DOM_IMPLEMENTATION);
-
+
if (parserClassname == null) {
parserClassname = XMLResourceDescriptor.getXMLParserClassName();
}
@@ -97,6 +100,9 @@
}
// parse the XML document
DocumentFactory f = createDocumentFactory(domImpl, parserClassname);
+ boolean b =
+ ((Boolean)hints.get(KEY_XML_PARSER_VALIDATING)).booleanValue();
+ f.setValidating(b);
try {
if (input.getInputStream() != null) {
document = f.createDocument(namespaceURI,
@@ -143,7 +149,7 @@
*/
protected DocumentFactory createDocumentFactory(DOMImplementation domImpl,
String parserClassname) {
- return new SAXDocumentFactory(domImpl, parserClassname);
+ return new SAXDocumentFactory(domImpl, parserClassname);
}
/**
@@ -185,6 +191,29 @@
*/
public static final TranscodingHints.Key KEY_XML_PARSER_CLASSNAME
= new StringKey();
+
+ /**
+ * The validation mode of the XML parser.
+ * <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1">
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Key: </TH>
+ * <TD VALIGN="TOP">KEY_XML_PARSER_VALIDATING</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Value: </TH>
+ * <TD VALIGN="TOP">Boolean</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Default: </TH>
+ * <TD VALIGN="TOP">false</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Required: </TH>
+ * <TD VALIGN="TOP">No</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Description: </TH>
+ * <TD VALIGN="TOP">Specify the validation mode of the XML parser.</TD></TR>
+ * </TABLE>
+ */
+ public static final TranscodingHints.Key KEY_XML_PARSER_VALIDATING
+ = new BooleanKey();
/**
* Document element key.
1.32 +10 -1
xml-batik/sources/org/apache/batik/transcoder/image/ImageTranscoder.java
Index: ImageTranscoder.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/transcoder/image/ImageTranscoder.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- ImageTranscoder.java 2001/10/19 09:09:32 1.31
+++ ImageTranscoder.java 2001/10/24 14:52:36 1.32
@@ -102,7 +102,7 @@
* millimeter conversion factor.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a>
- * @version $Id: ImageTranscoder.java,v 1.31 2001/10/19 09:09:32 tkormann Exp $
+ * @version $Id: ImageTranscoder.java,v 1.32 2001/10/24 14:52:36 tkormann Exp $
*/
public abstract class ImageTranscoder extends XMLAbstractTranscoder {
@@ -397,6 +397,15 @@
}
}
+ /**
+ * Returns true if the XML parser must be in validation mode, false
+ * otherwise.
+ */
+ public boolean isXMLParserValidating() {
+ return ((Boolean)ImageTranscoder.this.hints.get
+ (KEY_XML_PARSER_VALIDATING)).booleanValue();
+ }
+
/**
* Returns this user agent's CSS media.
*/
1.17 +17 -4
xml-batik/sources/org/apache/batik/transcoder/print/PrintTranscoder.java
Index: PrintTranscoder.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/transcoder/print/PrintTranscoder.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- PrintTranscoder.java 2001/10/08 15:49:38 1.16
+++ PrintTranscoder.java 2001/10/24 14:52:37 1.17
@@ -109,7 +109,7 @@
* </ul>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Hardy</a>
- * @version $Id: PrintTranscoder.java,v 1.16 2001/10/08 15:49:38 hillion Exp $
+ * @version $Id: PrintTranscoder.java,v 1.17 2001/10/24 14:52:37 tkormann Exp $
*/
public class PrintTranscoder extends XMLAbstractTranscoder
implements Printable {
@@ -824,19 +824,32 @@
* <tt>TranscodingHints</tt> or null if any.
*/
public String getUserStyleSheetURI() {
- return (String)PrintTranscoder.this.hints.get(KEY_USER_STYLESHEET_URI);
+ return (String)PrintTranscoder.this.hints.get
+ (KEY_USER_STYLESHEET_URI);
}
/**
* Returns the XML parser to use from the TranscodingHints.
*/
public String getXMLParserClassName() {
- if (PrintTranscoder.this.hints.containsKey(KEY_XML_PARSER_CLASSNAME)) {
- return
(String)PrintTranscoder.this.hints.get(KEY_XML_PARSER_CLASSNAME);
+ if (PrintTranscoder.this.hints.containsKey
+ (KEY_XML_PARSER_CLASSNAME)) {
+
+ return (String)PrintTranscoder.this.hints.get
+ (KEY_XML_PARSER_CLASSNAME);
} else {
return XMLResourceDescriptor.getXMLParserClassName();
}
}
+
+ /**
+ * Returns true if the XML parser must be in validation mode, false
+ * otherwise.
+ */
+ public boolean isXMLParserValidating() {
+ return ((Boolean)PrintTranscoder.this.hints.get
+ (KEY_XML_PARSER_VALIDATING)).booleanValue();
+ }
/**
* Returns this user agent's CSS media.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]