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 2006/03/16 02:50:16 UTC

svn commit: r386238 - in /xmlgraphics/batik/trunk/sources/org/apache/batik/dom: ./ events/ svg12/

Author: cam
Date: Wed Mar 15 17:50:13 2006
New Revision: 386238

URL: http://svn.apache.org/viewcvs?rev=386238&view=rev
Log:
1. Convert "" to null for namespace URIs given to public DOM interfaces.

Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractAttrNS.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractDocument.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractElement.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractElementNS.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractNode.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractParentNode.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/GenericAttr.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/GenericAttrNS.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/GenericDocument.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/AbstractEvent.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg12/XBLOMDefinitionElement.java

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractAttrNS.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractAttrNS.java?rev=386238&r1=386237&r2=386238&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractAttrNS.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractAttrNS.java Wed Mar 15 17:50:13 2006
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 2000  The Apache Software Foundation 
+   Copyright 2000,2006  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -67,13 +67,16 @@
 			     AbstractDocument owner)
 	throws DOMException {
 	super(qname, owner);
+        if (nsURI != null && nsURI.length() == 0) {
+            nsURI = null;
+        }
 	namespaceURI = nsURI;
 	String prefix = DOMUtilities.getPrefix(qname);
         if (!owner.getStrictErrorChecking()) {
             return;
         }
 	if (prefix != null) {
-	    if (nsURI == null || nsURI.equals("") ||
+	    if (nsURI == null ||
 		("xml".equals(prefix) &&
 		 !XMLSupport.XML_NAMESPACE_URI.equals(nsURI)) ||
 		("xmlns".equals(prefix) &&

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractDocument.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractDocument.java?rev=386238&r1=386237&r2=386238&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractDocument.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractDocument.java Wed Mar 15 17:50:13 2006
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 2000-2003,2005  The Apache Software Foundation 
+   Copyright 2000-2003,2005-2006  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -173,7 +173,7 @@
     /**
      * The XBL manager for this document.
      */
-    protected XBLManager xblManager = new GenericXBLManager();
+    protected transient XBLManager xblManager = new GenericXBLManager();
 
     /**
      * The elementsById lists.
@@ -646,8 +646,8 @@
      * Returns an ElementsByTagNameNS object from the cache, if any.
      */
     public ElementsByTagNameNS getElementsByTagNameNS(Node n,
-                                                    String ns,
-                                                    String ln) {
+                                                      String ns,
+                                                      String ln) {
         if (elementsByTagNamesNS == null) {
             return null;
         }
@@ -698,6 +698,9 @@
         if (eventType == null) {
             return false;
         }
+        if (ns != null && ns.length() == 0) {
+            ns = null;
+        }
         if (ns == null || ns.equals(XMLConstants.XML_EVENTS_NAMESPACE_URI)) {
             return eventType.equals("Event")
                 || eventType.equals("MutationEvent")
@@ -1056,6 +1059,9 @@
                                                     qn });
         }
         String prefix = DOMUtilities.getPrefix(qn);
+        if (ns != null && ns.length() == 0) {
+            ns = null;
+        }
         if (prefix != null && ns == null) {
             throw createDOMException(DOMException.NAMESPACE_ERR,
                                      "prefix",

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractElement.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractElement.java?rev=386238&r1=386237&r2=386238&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractElement.java Wed Mar 15 17:50:13 2006
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 2000-2003  The Apache Software Foundation 
+   Copyright 2000-2003,2006  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -216,6 +216,9 @@
      * org.w3c.dom.Element#hasAttributeNS(String,String)}.
      */
     public boolean hasAttributeNS(String namespaceURI, String localName) {
+        if (namespaceURI != null && namespaceURI.length() == 0) {
+            namespaceURI = null;
+        }
 	return attributes != null &&
 	       attributes.getNamedItemNS(namespaceURI, localName) != null;
     }
@@ -228,6 +231,9 @@
 	if (attributes == null) {
 	    return "";
 	}
+        if (namespaceURI != null && namespaceURI.length() == 0) {
+            namespaceURI = null;
+        }
 	Attr attr = (Attr)attributes.getNamedItemNS(namespaceURI, localName);
 	return (attr == null) ? "" : attr.getValue();
     }
@@ -242,6 +248,9 @@
 	if (attributes == null) {
 	    attributes = createAttributes();
 	}
+        if (namespaceURI != null && namespaceURI.length() == 0) {
+            namespaceURI = null;
+        }
         Attr attr = getAttributeNodeNS(namespaceURI, qualifiedName);
         if (attr == null) {
             attr = getOwnerDocument().createAttributeNS(namespaceURI,
@@ -259,6 +268,9 @@
      */
     public void removeAttributeNS(String namespaceURI, 
 				  String localName) throws DOMException {
+        if (namespaceURI != null && namespaceURI.length() == 0) {
+            namespaceURI = null;
+        }
 	if (!hasAttributeNS(namespaceURI, localName)) {
             return;
 	}
@@ -271,6 +283,9 @@
      */
     public Attr getAttributeNodeNS(String namespaceURI, 
 				   String localName) {
+        if (namespaceURI != null && namespaceURI.length() == 0) {
+            namespaceURI = null;
+        }
 	if (attributes == null) {
 	    return null;
 	}
@@ -326,6 +341,9 @@
      */
     public void setIdAttributeNS(String ns, String ln, boolean isId)
             throws DOMException {
+        if (ns != null && ns.length() == 0) {
+            ns = null;
+        }
         AbstractAttr a = (AbstractAttr) getAttributeNodeNS(ns, ln);
         if (a == null) {
             throw createDOMException(DOMException.NOT_FOUND_ERR,
@@ -740,6 +758,9 @@
 	 * org.w3c.dom.NamedNodeMap#getNamedItemNS(String,String)}.
 	 */
 	public Node getNamedItemNS(String namespaceURI, String localName) {
+            if (namespaceURI != null && namespaceURI.length() == 0) {
+                namespaceURI = null;
+            }
             return get(namespaceURI, localName);
 	}
 
@@ -775,6 +796,9 @@
 					 "attribute.missing",
 					 new Object[] { "" });
 	    }
+            if (namespaceURI != null && namespaceURI.length() == 0) {
+                namespaceURI = null;
+            }
 	    AbstractAttr n = (AbstractAttr)remove(namespaceURI, localName);
 	    if (n == null) {
 		throw createDOMException(DOMException.NOT_FOUND_ERR,
@@ -794,6 +818,9 @@
  	 */
 	public Node setNamedItem(String ns, String name, Node arg)
             throws DOMException {
+            if (ns != null && ns.length() == 0) {
+                ns = null;
+            }
 	    ((AbstractAttr)arg).setOwnerElement(AbstractElement.this);
 	    AbstractAttr result = (AbstractAttr)put(ns, name, arg);
 

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractElementNS.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractElementNS.java?rev=386238&r1=386237&r2=386238&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractElementNS.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractElementNS.java Wed Mar 15 17:50:13 2006
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 2000  The Apache Software Foundation 
+   Copyright 2000,2006  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -28,8 +28,8 @@
  * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  * @version $Id$
  */
-
 public abstract class AbstractElementNS extends AbstractElement {
+
     /**
      * The namespace URI
      */
@@ -60,10 +60,13 @@
                                 AbstractDocument owner)
 	throws DOMException {
 	super(qname, owner);
+        if (nsURI != null && nsURI.length() == 0) {
+            nsURI = null;
+        }
 	namespaceURI = nsURI;
 	String prefix = DOMUtilities.getPrefix(qname);
 	if (prefix != null) {
-	    if (nsURI == null || nsURI.equals("") ||
+	    if (nsURI == null ||
 		("xml".equals(prefix) &&
 		 !XMLSupport.XML_NAMESPACE_URI.equals(nsURI))) {
 		throw createDOMException

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractNode.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractNode.java?rev=386238&r1=386237&r2=386238&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractNode.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractNode.java Wed Mar 15 17:50:13 2006
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 2000-2003,2005  The Apache Software Foundation 
+   Copyright 2000-2003,2005-2006  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -948,6 +948,9 @@
         if (eventSupport == null) {
             initializeEventSupport();
         }
+        if (namespaceURI != null && namespaceURI.length() == 0) {
+            namespaceURI = null;
+        }
         eventSupport.addEventListenerNS(namespaceURI,
                                         type,
                                         listener,
@@ -978,6 +981,9 @@
                                       EventListener listener,
                                       boolean useCapture) {
         if (eventSupport != null) {
+            if (namespaceURI != null && namespaceURI.length() == 0) {
+                namespaceURI = null;
+            }
             eventSupport.removeEventListenerNS(namespaceURI,
                                                type,
                                                listener,
@@ -1019,6 +1025,9 @@
     public boolean hasEventListenerNS(String namespaceURI, String type) {
         if (eventSupport == null) {
             return false;
+        }
+        if (namespaceURI != null && namespaceURI.length() == 0) {
+            namespaceURI = null;
         }
         return eventSupport.hasEventListenerNS(namespaceURI, type);
     }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractParentNode.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractParentNode.java?rev=386238&r1=386237&r2=386238&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractParentNode.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/AbstractParentNode.java Wed Mar 15 17:50:13 2006
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 2000-2003,2005  The Apache Software Foundation 
+   Copyright 2000-2003,2005-2006  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -286,6 +286,9 @@
 	if (localName == null) {
 	    return EMPTY_NODE_LIST;
 	}
+        if (namespaceURI != null && namespaceURI.length() == 0) {
+            namespaceURI = null;
+        }
         AbstractDocument ad = getCurrentDocument();
         ElementsByTagNameNS result =
             ad.getElementsByTagNameNS(this, namespaceURI,

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/ExtensibleDOMImplementation.java?rev=386238&r1=386237&r2=386238&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/ExtensibleDOMImplementation.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/ExtensibleDOMImplementation.java Wed Mar 15 17:50:13 2006
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 2001-2003  The Apache Software Foundation 
+   Copyright 2001-2003,2006  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -231,6 +231,9 @@
     public Element createElementNS(AbstractDocument document,
                                    String           namespaceURI,
                                    String           qualifiedName) {
+        if (namespaceURI != null && namespaceURI.length() == 0) {
+            namespaceURI = null;
+        }
         if (namespaceURI == null)
             return new GenericElement(qualifiedName.intern(), document);
 
@@ -292,5 +295,4 @@
 
         return extensions;
     }
-
 }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/GenericAttr.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/GenericAttr.java?rev=386238&r1=386237&r2=386238&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/GenericAttr.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/GenericAttr.java Wed Mar 15 17:50:13 2006
@@ -27,6 +27,7 @@
  * @version $Id$
  */
 public class GenericAttr extends AbstractAttr {
+
     /**
      * Is this attribute immutable?
      */

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/GenericAttrNS.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/GenericAttrNS.java?rev=386238&r1=386237&r2=386238&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/GenericAttrNS.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/GenericAttrNS.java Wed Mar 15 17:50:13 2006
@@ -28,6 +28,7 @@
  * @version $Id$
  */
 public class GenericAttrNS extends AbstractAttrNS {
+
     /**
      * Is this attribute immutable?
      */

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/GenericDocument.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/GenericDocument.java?rev=386238&r1=386237&r2=386238&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/GenericDocument.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/GenericDocument.java Wed Mar 15 17:50:13 2006
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 2000,2003  The Apache Software Foundation 
+   Copyright 2000,2003,2006  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -159,6 +159,9 @@
      */
     public Element createElementNS(String namespaceURI, String qualifiedName)
         throws DOMException {
+        if (namespaceURI != null && namespaceURI.length() == 0) {
+            namespaceURI = null;
+        }
         if (namespaceURI == null) {
             return new GenericElement(qualifiedName.intern(), this);
         } else {
@@ -174,6 +177,9 @@
      */
     public Attr createAttributeNS(String namespaceURI, String qualifiedName)
         throws DOMException {
+        if (namespaceURI != null && namespaceURI.length() == 0) {
+            namespaceURI = null;
+        }
         if (namespaceURI == null) {
             return new GenericAttr(qualifiedName.intern(), this);
         } else {

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/AbstractEvent.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/AbstractEvent.java?rev=386238&r1=386237&r2=386238&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/AbstractEvent.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/AbstractEvent.java Wed Mar 15 17:50:13 2006
@@ -272,6 +272,9 @@
                             String eventTypeArg,
                             boolean canBubbleArg,
                             boolean cancelableArg) {
+        if (namespaceURI != null && namespaceURI.length() == 0) {
+            namespaceURI = null;
+        }
         namespaceURI = namespaceURIArg;
 	type = eventTypeArg;
 	isBubbling = canBubbleArg;

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg12/XBLOMDefinitionElement.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg12/XBLOMDefinitionElement.java?rev=386238&r1=386237&r2=386238&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg12/XBLOMDefinitionElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg12/XBLOMDefinitionElement.java Wed Mar 15 17:50:13 2006
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 2005  The Apache Software Foundation 
+   Copyright 2005-2006  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -74,9 +74,6 @@
                          new Object[] { new Integer(getNodeType()),
                                         getNodeName(),
                                         prefix });
-        }
-        if (ns.equals("")) {
-            return null;
         }
         return ns;
     }