You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2007/03/05 10:15:10 UTC

svn commit: r514615 - in /lenya/trunk/src/java/org/apache/lenya: cms/cocoon/source/AggregatingSource.java xml/NamespaceHelper.java

Author: andreas
Date: Mon Mar  5 01:15:10 2007
New Revision: 514615

URL: http://svn.apache.org/viewvc?view=rev&rev=514615
Log:
Don't require namespace prefix in NamespaceHelper. This is correct according to DOM level 2.

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/AggregatingSource.java
    lenya/trunk/src/java/org/apache/lenya/xml/NamespaceHelper.java

Modified: lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/AggregatingSource.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/AggregatingSource.java?view=diff&rev=514615&r1=514614&r2=514615
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/AggregatingSource.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/AggregatingSource.java Mon Mar  5 01:15:10 2007
@@ -56,7 +56,7 @@
                     String prefix = docElement.getPrefix();
                     String localName = docElement.getLocalName();
 
-                    if (namespaceUri == null || prefix == null) {
+                    if (namespaceUri == null) {
                         this.dom = DocumentHelper.createDocument(null, localName, null);
                     } else {
                         NamespaceHelper helper = new NamespaceHelper(namespaceUri, prefix,

Modified: lenya/trunk/src/java/org/apache/lenya/xml/NamespaceHelper.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/xml/NamespaceHelper.java?view=diff&rev=514615&r1=514614&r2=514615
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/xml/NamespaceHelper.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/xml/NamespaceHelper.java Mon Mar  5 01:15:10 2007
@@ -42,7 +42,7 @@
 
     /**
      * Creates a new instance of NamespaceHelper using an existing document. The
-     * document is not affected. If you omit the prefix, the default namespace
+     * document is not affected. If the prefix is <code>null</code>, the default namespace
      * is used.
      * @param _document The document.
      * @param _namespaceUri The namespace URI.
@@ -51,7 +51,6 @@
     public NamespaceHelper(String _namespaceUri, String _prefix, Document _document) {
 
         Assert.notNull("namespace URI", _namespaceUri);
-        Assert.notNull("prefix", _prefix);
         Assert.notNull("DOM", _document);
 
         this.namespaceUri = _namespaceUri;
@@ -63,7 +62,7 @@
      * <p>
      * Creates a new instance of NamespaceHelper. A new document is created
      * using a document element in the given namespace with the given prefix. If
-     * you omit the prefix, the default namespace is used.
+     * the prefix is null, the default namespace is used.
      * </p>
      * <p>
      * NamespaceHelper("http://www.w3.org/2000/svg", "svg", "svg"):<br/>
@@ -113,7 +112,7 @@
      * @return The qualified name, i.e. prefix:localName.
      */
     public static String getQualifiedName(String prefix, String localName) {
-        if (prefix.equals("")) {
+        if (prefix == null || prefix.equals("")) {
             return localName;
         }
         return prefix + ":" + localName;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org