You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by ca...@apache.org on 2005/10/25 09:03:10 UTC

svn commit: r328299 - in /xmlgraphics/batik/trunk/sources/org/apache/batik: bridge/BridgeContext.java bridge/svg12/SVG12BridgeContext.java bridge/svg12/XPathPatternContentSelector.java dom/svg12/BindableElement.java

Author: cam
Date: Tue Oct 25 00:03:04 2005
New Revision: 328299

URL: http://svn.apache.org/viewcvs?rev=328299&view=rev
Log:
1. Bindable elements are now SVGGraphicsElements so that getBBox()
   works on them.
2. Fix bug with XPath selectors for xbl:content elements, where changes
   to the children of the bound element caused NPE errors with Xalan's
   XPath code.

Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/BridgeContext.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12BridgeContext.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg12/BindableElement.java

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/BridgeContext.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/BridgeContext.java?rev=328299&r1=328298&r2=328299&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/BridgeContext.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/BridgeContext.java Tue Oct 25 00:03:04 2005
@@ -1083,7 +1083,7 @@
      * registered for the capture phase as the 'default' behavior
      * for cursors is handled by the BridgeContext during the 
      * capture phase and the 'custom' behavior (handling of 'auto'
-     * on anchors, for example), is handled during the bubling phase.
+     * on anchors, for example), is handled during the bubbling phase.
      */
     public void addUIEventListeners(Document doc) {
         NodeEventTarget evtTarget = (NodeEventTarget)doc.getDocumentElement();

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12BridgeContext.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12BridgeContext.java?rev=328299&r1=328298&r2=328299&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12BridgeContext.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVG12BridgeContext.java Tue Oct 25 00:03:04 2005
@@ -261,7 +261,7 @@
      * registered for the capture phase as the 'default' behavior
      * for cursors is handled by the BridgeContext during the 
      * capture phase and the 'custom' behavior (handling of 'auto'
-     * on anchors, for example), is handled during the bubling phase.
+     * on anchors, for example), is handled during the bubbling phase.
      */
     public void addUIEventListeners(Document doc) {
         EventTarget evtTarget = (EventTarget)doc.getDocumentElement();

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java?rev=328299&r1=328298&r2=328299&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java Tue Oct 25 00:03:04 2005
@@ -75,17 +75,24 @@
                                        Element bound,
                                        String selector) {
         super(cm, content, bound);
+        expression = selector;
+        parse();
+    }
+
+    /**
+     * Parses the XPath selector.
+     */
+    protected void parse() {
+        context = new XPathContext();
         try {
-            xpath = new XPath(selector, null, prefixResolver, XPath.MATCH);
-            context = new XPathContext();
-            expression = selector;
+            xpath = new XPath(expression, null, prefixResolver, XPath.MATCH);
         } catch (javax.xml.transform.TransformerException te) {
             AbstractDocument doc
-                = (AbstractDocument) content.getOwnerDocument();
+                = (AbstractDocument) contentElement.getOwnerDocument();
             throw doc.createXPathException
                 (XPathException.INVALID_EXPRESSION_ERR,
                  "xpath.invalid.expression",
-                 new Object[] { selector, te.getMessage() });
+                 new Object[] { expression, te.getMessage() });
         }
     }
 
@@ -112,6 +119,7 @@
             selectedContent = new SelectedNodes();
             return true;
         }
+        parse();
         return selectedContent.update();
     }
 

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg12/BindableElement.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg12/BindableElement.java?rev=328299&r1=328298&r2=328299&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg12/BindableElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg12/BindableElement.java Tue Oct 25 00:03:04 2005
@@ -19,7 +19,7 @@
 
 import org.apache.batik.dom.AbstractDocument;
 import org.apache.batik.dom.svg.AttributeInitializer;
-import org.apache.batik.dom.svg.SVGStylableElement;
+import org.apache.batik.dom.svg.SVGGraphicsElement;
 
 import org.w3c.dom.Node;
 
@@ -30,7 +30,7 @@
  * @author <a href="mailto:cam%40mcc%2eid%2eau">Cameron McCormack</a>
  * @version $Id$
  */
-public class BindableElement extends SVGStylableElement {
+public class BindableElement extends SVGGraphicsElement {
 
     /**
      * The namespace URI of the custom element.