hillion 02/04/10 00:23:12 Modified: . build.xml sources batik-bean.mf batik-browser.mf batik-pp.mf batik-rasterizer.mf batik-slideshow.mf batik-ttf2svg.mf batik.mf sources/org/apache/batik/bridge BaseScriptingEnvironment.java ScriptingEnvironment.java sources/org/apache/batik/script Window.java sources/org/apache/batik/script/rhino WindowWrapper.java xdocs javaScripting.xml scriptFeatures.xml whoAreWe.xml Removed: sources/org/apache/batik/bridge Plugin.java Log: - Implemented Vincent's proposal of native scripts, - fixed build.xml, - implemented parseXML(), - doc updates. Revision Changes Path 1.107 +17 -4 xml-batik/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/xml-batik/build.xml,v retrieving revision 1.106 retrieving revision 1.107 diff -u -r1.106 -r1.107 --- build.xml 9 Apr 2002 16:27:17 -0000 1.106 +++ build.xml 10 Apr 2002 07:23:09 -0000 1.107 @@ -47,7 +47,7 @@ [win32] .\build.bat help - $Id: build.xml,v 1.106 2002/04/09 16:27:17 hillion Exp $ + $Id: build.xml,v 1.107 2002/04/10 07:23:09 hillion Exp $ --> @@ -294,6 +294,7 @@ script-jar, transcoder-jar, bridge-jar, + swing-jar, extension-jar, xml-jar, root-jar, @@ -361,6 +362,7 @@ <include name="${package-prefix}/script/**/*.class"/> <include name="${package-prefix}/swing/**/*.class"/> <include name="${package-prefix}/util/*.class"/> + <include name="${package-prefix}/util/io/*.class"/> <include name="${package-prefix}/xml/*.class"/> </fileset> <fileset dir="${resources}" excludes="${resources}/**/CVS"> @@ -371,6 +373,7 @@ <include name="${package-prefix}/parser/**"/> <include name="${package-prefix}/swing/**"/> <include name="${package-prefix}/util/resources/**"/> + <include name="${package-prefix}/util/io/resources/**"/> </fileset> <fileset dir="${build}/tmp"> <include name="org/**"/> @@ -396,12 +399,12 @@ <fileset dir="${dest}"> <include name="${package-prefix}/i18n/*.class"/> <include name="${package-prefix}/util/*.class"/> + <include name="${package-prefix}/util/io/*.class"/> <include name="${package-prefix}/util/resources/*.class"/> - <include name="${package-prefix}/util/svg/*.class"/> </fileset> <fileset dir="${resources}" excludes="${resources}/**/CVS"> <include name="${package-prefix}/util/resources/**"/> - <include name="${package-prefix}/util/svg/resources/**"/> + <include name="${package-prefix}/util/io/resources/**"/> </fileset> </jar> </target> @@ -574,11 +577,21 @@ <jar jarfile="${build}/lib/${project}-bridge.jar"> <fileset dir="${dest}"> <include name="${package-prefix}/bridge/**/*.class"/> - <include name="${package-prefix}/swing/**/*.class"/> </fileset> <fileset dir="${resources}" excludes="${resources}/**/CVS"> <include name="${package-prefix}/bridge/BrokenLink.svg"/> <include name="${package-prefix}/bridge/**/resources/*"/> + </fileset> + </jar> + </target> + + <!-- Swing (dependencies: all) --> + <target name="swing-jar" depends="compile, prepare-build"> + <jar jarfile="${build}/lib/${project}-swing.jar"> + <fileset dir="${dest}"> + <include name="${package-prefix}/swing/**/*.class"/> + </fileset> + <fileset dir="${resources}" excludes="${resources}/**/CVS"> <include name="${package-prefix}/swing/**/resources/*"/> </fileset> </jar> 1.2 +1 -1 xml-batik/sources/batik-bean.mf Index: batik-bean.mf =================================================================== RCS file: /home/cvs/xml-batik/sources/batik-bean.mf,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- batik-bean.mf 4 May 2001 12:13:11 -0000 1.1 +++ batik-bean.mf 10 Apr 2002 07:23:10 -0000 1.2 @@ -1,4 +1,4 @@ -Manifest-Version: $Id: batik-bean.mf,v 1.1 2001/05/04 12:13:11 hillion Exp $ +Manifest-Version: 1.0 Name: org/apache/batik/swing/JSVGCanvas.class Java-Bean: True 1.4 +3 -4 xml-batik/sources/batik-browser.mf Index: batik-browser.mf =================================================================== RCS file: /home/cvs/xml-batik/sources/batik-browser.mf,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- batik-browser.mf 1 Apr 2001 18:05:09 -0000 1.3 +++ batik-browser.mf 10 Apr 2002 07:23:10 -0000 1.4 @@ -1,4 +1,4 @@ -Manifest-Version: $Id: batik-browser.mf,v 1.3 2001/04/01 18:05:09 hillion Exp $ +Manifest-Version: 1.0 Main-Class: org.apache.batik.apps.svgbrowser.Main Class-Path: lib/batik-ext.jar \ lib/batik-dom.jar \ @@ -8,12 +8,11 @@ lib/batik-parser.jar \ lib/batik-script.jar \ lib/batik-bridge.jar \ + lib/batik-swing.jar \ lib/batik-transcoder.jar \ lib/batik-gui-util.jar \ lib/batik-awt-util.jar \ lib/batik-util.jar \ lib/batik-xml.jar \ lib/crimson-parser.jar \ - lib/js.jar \ - lib/xalan-1.2.1.jar \ - lib/xerces-1.2.1.jar + lib/js.jar 1.2 +1 -1 xml-batik/sources/batik-pp.mf Index: batik-pp.mf =================================================================== RCS file: /home/cvs/xml-batik/sources/batik-pp.mf,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- batik-pp.mf 10 Jan 2001 09:42:39 -0000 1.1 +++ batik-pp.mf 10 Apr 2002 07:23:10 -0000 1.2 @@ -1,4 +1,4 @@ -Manifest-Version: $Id: batik-pp.mf,v 1.1 2001/01/10 09:42:39 hillion Exp $ +Manifest-Version: 1.0 Main-Class: org.apache.batik.apps.svgpp.Main Class-Path: lib/batik-ext.jar \ lib/batik-dom.jar \ 1.5 +1 -1 xml-batik/sources/batik-rasterizer.mf Index: batik-rasterizer.mf =================================================================== RCS file: /home/cvs/xml-batik/sources/batik-rasterizer.mf,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- batik-rasterizer.mf 11 May 2001 16:15:07 -0000 1.4 +++ batik-rasterizer.mf 10 Apr 2002 07:23:10 -0000 1.5 @@ -1,4 +1,4 @@ -Manifest-Version: $Id: batik-rasterizer.mf,v 1.4 2001/05/11 16:15:07 hillion Exp $ +Manifest-Version: 1.0 Main-Class: org.apache.batik.apps.rasterizer.Main Class-Path: lib/batik-ext.jar \ lib/batik-dom.jar \ 1.2 +2 -1 xml-batik/sources/batik-slideshow.mf Index: batik-slideshow.mf =================================================================== RCS file: /home/cvs/xml-batik/sources/batik-slideshow.mf,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- batik-slideshow.mf 17 Sep 2001 20:45:18 -0000 1.1 +++ batik-slideshow.mf 10 Apr 2002 07:23:10 -0000 1.2 @@ -1,4 +1,4 @@ -Manifest-Version: $Id: batik-slideshow.mf,v 1.1 2001/09/17 20:45:18 deweese Exp $ +Manifest-Version: 1.0 Class-Path: lib/batik-ext.jar \ lib/batik-dom.jar \ lib/batik-css.jar \ @@ -7,6 +7,7 @@ lib/batik-parser.jar \ lib/batik-script.jar \ lib/batik-bridge.jar \ + lib/batik-swing.jar \ lib/batik-transcoder.jar \ lib/batik-awt-util.jar \ lib/batik-util.jar \ 1.2 +1 -1 xml-batik/sources/batik-ttf2svg.mf Index: batik-ttf2svg.mf =================================================================== RCS file: /home/cvs/xml-batik/sources/batik-ttf2svg.mf,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- batik-ttf2svg.mf 11 May 2001 16:15:08 -0000 1.1 +++ batik-ttf2svg.mf 10 Apr 2002 07:23:10 -0000 1.2 @@ -1,4 +1,4 @@ -Manifest-Version: $Id: batik-ttf2svg.mf,v 1.1 2001/05/11 16:15:08 hillion Exp $ +Manifest-Version: 1.0 Main-Class: org.apache.batik.apps.ttf2svg.Main Class-Path: lib/batik-svggen.jar \ lib/batik-util.jar 1.4 +3 -4 xml-batik/sources/batik.mf Index: batik.mf =================================================================== RCS file: /home/cvs/xml-batik/sources/batik.mf,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- batik.mf 8 Mar 2001 19:19:18 -0000 1.3 +++ batik.mf 10 Apr 2002 07:23:10 -0000 1.4 @@ -1,4 +1,4 @@ -Manifest-Version: $Id: batik.mf,v 1.3 2001/03/08 19:19:18 hillion Exp $ +Manifest-Version: 1.0 Main-Class: org.apache.batik.apps.svgbrowser.Main Class-Path: lib/batik-ext.jar \ lib/batik-dom.jar \ @@ -8,6 +8,7 @@ lib/batik-parser.jar \ lib/batik-script.jar \ lib/batik-bridge.jar \ + lib/batik-swing.jar \ lib/batik-transcoder.jar \ lib/batik-gui-util.jar \ lib/batik-awt-util.jar \ @@ -19,6 +20,4 @@ batik-rasterizer.jar \ batik-pp.jar \ lib/crimson-parser.jar \ - lib/js.jar \ - lib/xalan-1.2.1.jar \ - lib/xerces-1.2.1.jar + lib/js.jar 1.3 +70 -72 xml-batik/sources/org/apache/batik/bridge/BaseScriptingEnvironment.java Index: BaseScriptingEnvironment.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/BaseScriptingEnvironment.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- BaseScriptingEnvironment.java 25 Mar 2002 11:02:22 -0000 1.2 +++ BaseScriptingEnvironment.java 10 Apr 2002 07:23:11 -0000 1.3 @@ -23,7 +23,10 @@ import java.util.Set; import java.util.StringTokenizer; +import java.util.jar.Manifest; + import org.apache.batik.dom.svg.SVGOMDocument; +import org.apache.batik.dom.svg.XMLBaseSupport; import org.apache.batik.dom.util.DOMUtilities; import org.apache.batik.dom.util.HashTable; @@ -31,10 +34,12 @@ import org.apache.batik.script.Interpreter; import org.apache.batik.script.InterpreterException; +import org.apache.batik.script.ScriptHandler; import org.apache.batik.util.SVGConstants; import org.w3c.dom.Document; +import org.w3c.dom.DocumentFragment; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -51,28 +56,14 @@ * This class is the base class for SVG scripting. * * @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a> - * @version $Id: BaseScriptingEnvironment.java,v 1.2 2002/03/25 11:02:22 hillion Exp $ + * @version $Id: BaseScriptingEnvironment.java,v 1.3 2002/04/10 07:23:11 hillion Exp $ */ public class BaseScriptingEnvironment { - protected final static String BATIK_PLUGIN_PI = "batik-plugin"; - /** * Tells whether the given SVG document is dynamic. */ public static boolean isDynamicDocument(Document doc) { - for (Node n = doc.getFirstChild(); - n != null && n.getNodeType() != n.ELEMENT_NODE; - n = n.getNextSibling()) { - if (n.getNodeType() != n.PROCESSING_INSTRUCTION_NODE) { - continue; - } - ProcessingInstruction pi = (ProcessingInstruction)n; - if (!BATIK_PLUGIN_PI.equals(pi.getTarget())) { - continue; - } - return true; - } Element elt = doc.getDocumentElement(); if (elt.getNamespaceURI().equals(SVGConstants.SVG_NAMESPACE_URI)) { if (elt.getAttributeNS @@ -226,61 +217,6 @@ */ public void loadScripts() { org.apache.batik.script.Window window = null; - for (Node n = document.getFirstChild(); - n != null && n.getNodeType() != n.ELEMENT_NODE; - n = n.getNextSibling()) { - if (n.getNodeType() != n.PROCESSING_INSTRUCTION_NODE) { - continue; - } - ProcessingInstruction pi = (ProcessingInstruction)n; - if (!BATIK_PLUGIN_PI.equals(pi.getTarget())) { - continue; - } - - if (window == null) { - window = createWindow(); - } - - try { - HashTable pattrs = new HashTable(); - DOMUtilities.parseStyleSheetPIData(pi.getData(), pattrs); - - URL url = ((SVGOMDocument)document).getURLObject(); - String base = (String)pattrs.get("codebase"); - if (base == null) { - url = new URL(url, "."); - } else { - url = new URL(url, base); - } - - URL[] urls; - - String archive = (String)pattrs.get("archive"); - if (archive != null) { - List lst = new ArrayList(); - lst.add(url); - StringTokenizer st = new StringTokenizer(archive, ", "); - while (st.hasMoreTokens()) { - String ar = st.nextToken(); - lst.add(new URL(url, ar)); - } - urls = (URL[])lst.toArray(new URL[] {}); - } else { - urls = new URL[] { url }; - } - - URLClassLoader cl = new URLClassLoader(urls); - String cname = (String)pattrs.get("code"); - Class c = cl.loadClass(cname); - Plugin p = (Plugin)c.newInstance(); - p.run(document, window); - } catch (Exception ex) { - UserAgent ua = bridgeContext.getUserAgent(); - if (ua != null) { - ua.displayError(ex); - } - } - } NodeList scripts = document.getElementsByTagNameNS (SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_SCRIPT_TAG); @@ -296,6 +232,51 @@ Element script = (Element)scripts.item(i); String type = script.getAttributeNS (null, SVGConstants.SVG_TYPE_ATTRIBUTE); + + // + // Java code invocation. + // + if (type.equals("application/x-java-jar-file")) { + try { + String href = XLinkSupport.getXLinkHref(script); + URL url; + url = new URL(XMLBaseSupport.getCascadedXMLBase(script)); + url = new URL(url, href); + URLClassLoader cll = new URLClassLoader(new URL[] { url }); + + // Get the 'Script-Handler' entry in the manifest. + url = cll.findResource("META-INF/MANIFEST.MF"); + if (url == null) { + continue; + } + Manifest man = new Manifest(url.openStream()); + String sh; + sh = man.getMainAttributes().getValue("Script-Handler"); + if (sh == null) { + continue; + } + + // Run the script handler. + ScriptHandler h; + h = (ScriptHandler)cll.loadClass(sh).newInstance(); + + if (window == null) { + window = createWindow(); + } + + h.run(document, window); + + } catch (Exception e) { + if (userAgent != null) { + userAgent.displayError(e); + } + } + continue; + } + + // + // Scripting language invocation. + // Interpreter interpreter = bridgeContext.getInterpreter(type); if (interpreter == null) { @@ -316,8 +297,9 @@ Reader reader; if (href.length() > 0) { // External script. - URL url = new URL(((SVGOMDocument)document).getURLObject(), - href); + URL url; + url = new URL(XMLBaseSupport.getCascadedXMLBase(script)); + url = new URL(url, href); reader = new InputStreamReader(url.openStream()); } else { // Inline script. @@ -488,6 +470,15 @@ } /** + * Parses the given XML string into a DocumentFragment of the + * given document. + * @return The document fragment or null on error. + */ + public DocumentFragment parseXML(String text, Document doc) { + return null; + } + + /** * Displays an alert dialog box. */ public void alert(String message) { @@ -512,6 +503,13 @@ */ public String prompt(String message, String defVal) { return null; + } + + /** + * Returns the current BridgeContext. + */ + public BridgeContext getBridgeContext() { + return bridgeContext; } /** 1.18 +46 -1 xml-batik/sources/org/apache/batik/bridge/ScriptingEnvironment.java Index: ScriptingEnvironment.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/ScriptingEnvironment.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- ScriptingEnvironment.java 22 Mar 2002 10:59:25 -0000 1.17 +++ ScriptingEnvironment.java 10 Apr 2002 07:23:11 -0000 1.18 @@ -8,16 +8,25 @@ package org.apache.batik.bridge; +import java.io.StringReader; + import java.util.Timer; import java.util.TimerTask; +import org.apache.batik.dom.svg.SAXSVGDocumentFactory; +import org.apache.batik.dom.svg.SVGOMDocument; + +import org.apache.batik.dom.util.DocumentFactory; + import org.apache.batik.script.Interpreter; import org.apache.batik.script.InterpreterException; import org.apache.batik.util.RunnableQueue; import org.apache.batik.util.SVGConstants; +import org.apache.batik.util.XMLResourceDescriptor; import org.w3c.dom.Document; +import org.w3c.dom.DocumentFragment; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -29,7 +38,7 @@ * This class contains the informations needed by the SVG scripting. * * @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a> - * @version $Id: ScriptingEnvironment.java,v 1.17 2002/03/22 10:59:25 hillion Exp $ + * @version $Id: ScriptingEnvironment.java,v 1.18 2002/04/10 07:23:11 hillion Exp $ */ public class ScriptingEnvironment extends BaseScriptingEnvironment { @@ -581,6 +590,35 @@ } /** + * Implements {@link + * org.apache.batik.script.Window#parseXML(String,Document)}. + */ + public DocumentFragment parseXML(String text, Document doc) { + text = "<svg>" + text + "</svg>"; + SAXSVGDocumentFactory df = new SAXSVGDocumentFactory + (XMLResourceDescriptor.getXMLParserClassName()); + String uri = ((SVGOMDocument)context.getDocument()). + getURLObject().toString(); + DocumentFragment result = null; + try { + Document d = df.createDocument(uri, new StringReader(text)); + for (Node n = d.getDocumentElement().getFirstChild(); + n != null; + n = n.getNextSibling()) { + if (n.getNodeType() == n.ELEMENT_NODE) { + n = doc.importNode(n, true); + result = doc.createDocumentFragment(); + result.appendChild(n); + break; + } + } + } catch (Exception ex) { + // !!! TODO: warning + } + return result; + } + + /** * Displays an alert dialog box. */ public void alert(String message) { @@ -617,6 +655,13 @@ return userAgent.showPrompt(message, defVal); } return null; + } + + /** + * Returns the current BridgeContext. + */ + public BridgeContext getBridgeContext() { + return bridgeContext; } /** 1.2 +19 -1 xml-batik/sources/org/apache/batik/script/Window.java Index: Window.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/script/Window.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Window.java 25 Feb 2002 15:05:32 -0000 1.1 +++ Window.java 10 Apr 2002 07:23:11 -0000 1.2 @@ -8,12 +8,17 @@ package org.apache.batik.script; +import org.apache.batik.bridge.BridgeContext; + +import org.w3c.dom.Document; +import org.w3c.dom.DocumentFragment; + /** * This interface represents the 'window' object defined in the global * environment of a SVG document. * * @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a> - * @version $Id: Window.java,v 1.1 2002/02/25 15:05:32 hillion Exp $ + * @version $Id: Window.java,v 1.2 2002/04/10 07:23:11 hillion Exp $ */ public interface Window { @@ -61,6 +66,13 @@ void clearTimeout(Object timeout); /** + * Parses the given XML string into a DocumentFragment of the + * given document. + * @return The document fragment or null on error. + */ + DocumentFragment parseXML(String text, Document doc); + + /** * Displays an alert dialog box. */ void alert(String message); @@ -81,6 +93,12 @@ * @return The input of the user, or null if the dialog was cancelled. */ String prompt(String message, String defVal); + + /** + * Returns the current BridgeContext. This object given a deep + * access to the viewer internals. + */ + BridgeContext getBridgeContext(); /** * Returns the associated interpreter. 1.5 +22 -1 xml-batik/sources/org/apache/batik/script/rhino/WindowWrapper.java Index: WindowWrapper.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/script/rhino/WindowWrapper.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- WindowWrapper.java 11 Mar 2002 09:04:37 -0000 1.4 +++ WindowWrapper.java 10 Apr 2002 07:23:11 -0000 1.5 @@ -23,11 +23,13 @@ import org.apache.batik.script.InterpreterException; import org.apache.batik.script.Window; +import org.w3c.dom.Document; + /** * This class wraps a Window object to expose it to the interpreter. * * @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a> - * @version $Id: WindowWrapper.java,v 1.4 2002/03/11 09:04:37 hillion Exp $ + * @version $Id: WindowWrapper.java,v 1.5 2002/04/10 07:23:11 hillion Exp $ */ public class WindowWrapper extends ScriptableObject { @@ -157,6 +159,25 @@ window.clearTimeout(NativeJavaObject.coerceType (Object.class, args[0])); } + } + + /** + * Wraps the 'parseXML' method of the Window interface. + */ + public static Object jsFunction_parseXML(Context cx, + Scriptable thisObj, + Object[] args, + Function funObj) + throws JavaScriptException { + int len = args.length; + WindowWrapper ww = (WindowWrapper)thisObj; + Window window = ww.window; + if (len >= 2) { + return window.parseXML + ((String)NativeJavaObject.coerceType(String.class, args[0]), + (Document)NativeJavaObject.coerceType(Document.class, args[1])); + } + return null; } /** 1.5 +61 -1 xml-batik/xdocs/javaScripting.xml Index: javaScripting.xml =================================================================== RCS file: /home/cvs/xml-batik/xdocs/javaScripting.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- javaScripting.xml 11 Mar 2002 09:04:38 -0000 1.4 +++ javaScripting.xml 10 Apr 2002 07:23:11 -0000 1.5 @@ -11,7 +11,7 @@ <!-- ========================================================================= --> <!-- author [EMAIL PROTECTED] --> -<!-- version $Id: javaScripting.xml,v 1.4 2002/03/11 09:04:38 hillion Exp $ --> +<!-- version $Id: javaScripting.xml,v 1.5 2002/04/10 07:23:11 hillion Exp $ --> <!-- ========================================================================= --> <document> <header> @@ -22,6 +22,22 @@ </header> <body> + <s1 title="Introduction"> + <p> + This section explains how to manipulate the DOM tree of an SVG document from a Java program. It contains the following sub-sections: + </p> + + <ul> + <li><link href="#Swing"> + How to manipulate a JSVGCanvas' document?</link></li> + <li><link href="#Threads"> + How to write thread-safe code?</link></li> + <li><link href="#Extension"> + How to run Java code using a <script> element?</link></li> + </ul> + </s1> + + <anchor id="Swing"/> <s1 title="How to manipulate a JSVGCanvas DOM document"> <p> The follow code template demonstrates how to manipulate an SVG @@ -138,6 +154,10 @@ } </source> </s1> + + <!-- #################################################### --> + + <anchor id="Threads"/> <s1 title="Writing thread-safe code"> <p> The DOM listeners registered on the SVG document are called from @@ -166,5 +186,45 @@ thread, the graphics are updated. </p> </s1> + + <!-- #################################################### --> + + <anchor id="Extension"/> + <s1 title="Alternate way to manipulate an SVG document"> + <p> + Batik provides an extension of the SVG <script> element + which allows Java programs to be called from an SVG document. + + This feature is available to any application of Batik that uses + the bridge module (for example the Swing component and the + transcoders). + </p> + + <p> + + In order to use this extension, the <code>type</code> attribute + of a <script> element must be set to + <code>application/x-java-jar-file</code>. In addition the + <code>xlink:href</code> attribute must be the URI of a jar file + which contains the program to run. + + The manifest of this jar file must contains an entry of the form: + <br/><br/> + <code>Script-Handler: </code><em>classname</em><br/><br/> + + Where <em>classname</em> must be the name of a class which + implements the + <code>org.apache.batik.script.ScriptHandler</code> interface. + See the javadoc of this interface for more details. + <br/> + + The class can be contained directly in the jar file, but it is + also possible for it to be contained in a jar file added to the + classpath using the <code>Class-Path</code> entry of the + manifest. + + </p> + </s1> + </body> </document> 1.5 +22 -1 xml-batik/xdocs/scriptFeatures.xml Index: scriptFeatures.xml =================================================================== RCS file: /home/cvs/xml-batik/xdocs/scriptFeatures.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- scriptFeatures.xml 11 Mar 2002 09:04:38 -0000 1.4 +++ scriptFeatures.xml 10 Apr 2002 07:23:11 -0000 1.5 @@ -11,7 +11,7 @@ <!-- ========================================================================= --> <!-- author [EMAIL PROTECTED] --> -<!-- version $Id: scriptFeatures.xml,v 1.4 2002/03/11 09:04:38 hillion Exp $ --> +<!-- version $Id: scriptFeatures.xml,v 1.5 2002/04/10 07:23:11 hillion Exp $ --> <!-- ========================================================================= --> <document> <header> @@ -253,6 +253,27 @@ <li><em>timeoutID</em>: An object returned by a call to <code>setTimeout</code>.</li> </ul> + + <!-- ========================================================= --> + + <table> + <tr> + <td>Method <code>parseXML</code>(<em>text</em>, + <em>document</em>)</td> + + </tr> + </table> + <p> + Parses and returns a DocumentFragment object. + </p> + <ul> + <li><em>text</em>: A string representing an XML document fragment.</li> + <li><em>document</em>: The document used to build the DOM + representation of the XML fragment.</li> + </ul> + <p> + This method returns a <code>org.w3c.dom.DocumentFragment</code> object. + </p> </s1> </body> 1.36 +3 -3 xml-batik/xdocs/whoAreWe.xml Index: whoAreWe.xml =================================================================== RCS file: /home/cvs/xml-batik/xdocs/whoAreWe.xml,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- whoAreWe.xml 11 Mar 2002 10:02:58 -0000 1.35 +++ whoAreWe.xml 10 Apr 2002 07:23:11 -0000 1.36 @@ -11,7 +11,7 @@ <!-- ========================================================================= --> <!-- author [EMAIL PROTECTED] --> -<!-- version $Id: whoAreWe.xml,v 1.35 2002/03/11 10:02:58 hillion Exp $ --> +<!-- version $Id: whoAreWe.xml,v 1.36 2002/04/10 07:23:11 hillion Exp $ --> <!-- ========================================================================= --> <document> <header> @@ -68,7 +68,7 @@ <link href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</link><br /> <em> Stephane is a software engineer at the Koala project, part of - the ILOG's visualisation R&D team, located in Sophia-Antipolis, + the ILOG's visualization R&D team, located in Sophia-Antipolis, France. His main interests are in programming languages and web standards. He wrote the Apache Batik's DOM, CSS and Swing modules. </em> @@ -79,7 +79,7 @@ <link href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</link><br /> <em> Christophe Jolif is a Staff Software Engineer mainly working on the ILOG - JViews Component Suite, the ILOG Java visualisation framework. He has + JViews Component Suite, the ILOG Java visualization framework. He has been working for ILOG since 1997, and is representing the company at the Scalable Vector Graphics (SVG) W3C Working Group since 1999. He has implemented the SVG import and export features in ILOG JViews and is now
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]