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:57 UTC
svn commit: r386239 -
/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/
Author: cam
Date: Wed Mar 15 17:50:54 2006
New Revision: 386239
URL: http://svn.apache.org/viewcvs?rev=386239&view=rev
Log:
1. Convert "" to null for namespace URIs given to public DOM interfaces.
Modified:
xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractAttrNS.java
xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractDocument.java
xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractElement.java
xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractElementNS.java
xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractParentNode.java
xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/GenericAttr.java
xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/GenericAttrNS.java
xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/GenericDocument.java
Modified: xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractAttrNS.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractAttrNS.java?rev=386239&r1=386238&r2=386239&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractAttrNS.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractAttrNS.java Wed Mar 15 17:50:54 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,10 +67,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)) ||
("xmlns".equals(prefix) &&
Modified: xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractDocument.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractDocument.java?rev=386239&r1=386238&r2=386239&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractDocument.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractDocument.java Wed Mar 15 17:50:54 2006
@@ -551,8 +551,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;
}
Modified: xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractElement.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractElement.java?rev=386239&r1=386238&r2=386239&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractElement.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractElement.java Wed Mar 15 17:50:54 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.
@@ -207,6 +207,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;
}
@@ -219,6 +222,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();
}
@@ -233,6 +239,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,
@@ -250,6 +259,9 @@
*/
public void removeAttributeNS(String namespaceURI,
String localName) throws DOMException {
+ if (namespaceURI != null && namespaceURI.length() == 0) {
+ namespaceURI = null;
+ }
if (!hasAttributeNS(namespaceURI, localName)) {
return;
}
@@ -262,6 +274,9 @@
*/
public Attr getAttributeNodeNS(String namespaceURI,
String localName) {
+ if (namespaceURI != null && namespaceURI.length() == 0) {
+ namespaceURI = null;
+ }
if (attributes == null) {
return null;
}
@@ -633,6 +648,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);
}
@@ -668,6 +686,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,
@@ -687,6 +708,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/branches/svg11/sources/org/apache/batik/dom/AbstractElementNS.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractElementNS.java?rev=386239&r1=386238&r2=386239&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractElementNS.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractElementNS.java Wed Mar 15 17:50:54 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/branches/svg11/sources/org/apache/batik/dom/AbstractParentNode.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractParentNode.java?rev=386239&r1=386238&r2=386239&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractParentNode.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/AbstractParentNode.java Wed Mar 15 17:50:54 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.
@@ -284,6 +284,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/branches/svg11/sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/ExtensibleDOMImplementation.java?rev=386239&r1=386238&r2=386239&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/ExtensibleDOMImplementation.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/ExtensibleDOMImplementation.java Wed Mar 15 17:50:54 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.
@@ -237,6 +237,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);
@@ -298,5 +301,4 @@
return extensions;
}
-
}
Modified: xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/GenericAttr.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/GenericAttr.java?rev=386239&r1=386238&r2=386239&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/GenericAttr.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/GenericAttr.java Wed Mar 15 17:50:54 2006
@@ -27,6 +27,7 @@
* @version $Id$
*/
public class GenericAttr extends AbstractAttr {
+
/**
* Is this attribute immutable?
*/
Modified: xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/GenericAttrNS.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/GenericAttrNS.java?rev=386239&r1=386238&r2=386239&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/GenericAttrNS.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/GenericAttrNS.java Wed Mar 15 17:50:54 2006
@@ -28,6 +28,7 @@
* @version $Id$
*/
public class GenericAttrNS extends AbstractAttrNS {
+
/**
* Is this attribute immutable?
*/
Modified: xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/GenericDocument.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/GenericDocument.java?rev=386239&r1=386238&r2=386239&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/GenericDocument.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/dom/GenericDocument.java Wed Mar 15 17:50:54 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 {