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/02/26 15:53:20 UTC

svn commit: r511832 - in /lenya/branches/trunk-rework-pubconf/src/java/org/apache/lenya: cms/cocoon/source/AggregatingSource.java xml/NamespaceHelper.java

Author: andreas
Date: Mon Feb 26 06:53:19 2007
New Revision: 511832

URL: http://svn.apache.org/viewvc?view=rev&rev=511832
Log:
Allow null prefixes, this is conforming to DOM level 2

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

Modified: lenya/branches/trunk-rework-pubconf/src/java/org/apache/lenya/cms/cocoon/source/AggregatingSource.java
URL: http://svn.apache.org/viewvc/lenya/branches/trunk-rework-pubconf/src/java/org/apache/lenya/cms/cocoon/source/AggregatingSource.java?view=diff&rev=511832&r1=511831&r2=511832
==============================================================================
--- lenya/branches/trunk-rework-pubconf/src/java/org/apache/lenya/cms/cocoon/source/AggregatingSource.java (original)
+++ lenya/branches/trunk-rework-pubconf/src/java/org/apache/lenya/cms/cocoon/source/AggregatingSource.java Mon Feb 26 06:53:19 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/branches/trunk-rework-pubconf/src/java/org/apache/lenya/xml/NamespaceHelper.java
URL: http://svn.apache.org/viewvc/lenya/branches/trunk-rework-pubconf/src/java/org/apache/lenya/xml/NamespaceHelper.java?view=diff&rev=511832&r1=511831&r2=511832
==============================================================================
--- lenya/branches/trunk-rework-pubconf/src/java/org/apache/lenya/xml/NamespaceHelper.java (original)
+++ lenya/branches/trunk-rework-pubconf/src/java/org/apache/lenya/xml/NamespaceHelper.java Mon Feb 26 06:53:19 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