You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2011/12/17 18:50:27 UTC

svn commit: r1215535 - in /webservices/commons/trunk/modules/axiom/modules: axiom-api/src/main/java/org/apache/axiom/om/ axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/

Author: veithen
Date: Sat Dec 17 17:50:26 2011
New Revision: 1215535

URL: http://svn.apache.org/viewvc?rev=1215535&view=rev
Log:
The OMNamespace object stored by OMElementImpl and ElementImpl can't have a null prefix.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNamedInformationItem.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNamedInformationItem.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNamedInformationItem.java?rev=1215535&r1=1215534&r2=1215535&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNamedInformationItem.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNamedInformationItem.java Sat Dec 17 17:50:26 2011
@@ -42,10 +42,13 @@ public interface OMNamedInformationItem 
     /**
      * Get the namespace this information item is part of.
      * 
-     * @return the namespace of this information item, or <code>null</code> if the information item
-     *         has no namespace (note that this implies that the method never returns an
+     * @return The namespace of this information item, or <code>null</code> if the information item
+     *         has no namespace. Note that this implies that the method never returns an
      *         {@link OMNamespace} object with both prefix and namespace URI set to the empty
-     *         string)
+     *         string. In addition, the prefix of the returned {@link OMNamespace} object (if any)
+     *         is never <code>null</code>: if a <code>null</code> prefix was specified when creating
+     *         this information item, then a prefix has been automatically assigned and the assigned
+     *         prefix is returned.
      */
     OMNamespace getNamespace();
 

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=1215535&r1=1215534&r2=1215535&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java Sat Dec 17 17:50:26 2011
@@ -71,6 +71,18 @@ public class ElementImpl extends ParentN
     
     private int lineNumber;
 
+    /**
+     * The namespace of this element. Possible values:
+     * <ul>
+     * <li><code>null</code> (if the element has no namespace)
+     * <li>any {@link OMNamespace} instance, with the following exceptions:
+     * <ul>
+     * <li>an {@link OMNamespace} instance with a <code>null</code> prefix
+     * <li>an {@link OMNamespace} instance with both prefix and namespace URI set to the empty
+     * string
+     * </ul>
+     * </ul>
+     */
     protected OMNamespace namespace;
 
     protected String localName;
@@ -985,12 +997,8 @@ public class ElementImpl extends ParentN
     public QName getQName() {
         QName qName;
         if (namespace != null) {
-            if (namespace.getPrefix() != null) {
-                qName = new QName(namespace.getNamespaceURI(), this.localName,
-                                  namespace.getPrefix());
-            } else {
-                qName = new QName(namespace.getNamespaceURI(), this.localName);
-            }
+            qName = new QName(namespace.getNamespaceURI(), this.localName,
+                              namespace.getPrefix());
         } else {
             qName = new QName(this.localName);
         }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java?rev=1215535&r1=1215534&r2=1215535&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java Sat Dec 17 17:50:26 2011
@@ -74,7 +74,18 @@ public class OMElementImpl extends OMNod
 
     private static final Log log = LogFactory.getLog(OMElementImpl.class);
     
-    /** Field ns */
+    /**
+     * The namespace of this element. Possible values:
+     * <ul>
+     * <li><code>null</code> (if the element has no namespace)
+     * <li>any {@link OMNamespace} instance, with the following exceptions:
+     * <ul>
+     * <li>an {@link OMNamespace} instance with a <code>null</code> prefix
+     * <li>an {@link OMNamespace} instance with both prefix and namespace URI set to the empty
+     * string
+     * </ul>
+     * </ul>
+     */
     protected OMNamespace ns;
 
     /** Field localName */
@@ -1001,11 +1012,7 @@ public class OMElementImpl extends OMNod
         }
 
         if (ns != null) {
-            if (ns.getPrefix() != null) {
-                qName = new QName(ns.getNamespaceURI(), localName, ns.getPrefix());
-            } else {
-                qName = new QName(ns.getNamespaceURI(), localName);
-            }
+            qName = new QName(ns.getNamespaceURI(), localName, ns.getPrefix());
         } else {
             qName = new QName(localName);
         }