ws-woden-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkapu...@apache.org
Subject svn commit: r327191 - /incubator/woden/java/src/org/apache/woden/internal/util/dom/QNameUtils.java
Date Fri, 21 Oct 2005 14:09:08 GMT
Author: jkaputin
Date: Fri Oct 21 07:09:01 2005
New Revision: 327191

URL: http://svn.apache.org/viewcvs?rev=327191&view=rev
Log:
added methods to create a QName defaulting null
namespace or prefix to empty string

Modified:
    incubator/woden/java/src/org/apache/woden/internal/util/dom/QNameUtils.java

Modified: incubator/woden/java/src/org/apache/woden/internal/util/dom/QNameUtils.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/util/dom/QNameUtils.java?rev=327191&r1=327190&r2=327191&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/util/dom/QNameUtils.java (original)
+++ incubator/woden/java/src/org/apache/woden/internal/util/dom/QNameUtils.java Fri Oct 21
07:09:01 2005
@@ -15,15 +15,14 @@
  */
 package org.apache.woden.internal.util.dom;
 
-import java.util.List;
-
 import javax.xml.namespace.QName;
 
-import org.apache.woden.internal.util.StringUtils;
 import org.w3c.dom.Node;
 
 public class QNameUtils
 {
+  protected static final String emptyString = "";
+    
   public static boolean matches(QName qname, Node node)
   {
     return (node != null && qname.equals(newQName(node)));
@@ -70,5 +69,26 @@
       }
       
       return qname;
+  }
+  
+  /*
+   * Return a new QName created with the specified namespace and localPart and
+   * a prefix of "".
+   */
+  public static QName newQName(String namespace, String localPart)
+  {
+      return newQName(namespace != null ? namespace : emptyString, localPart, emptyString);
+  }
+  
+  /*
+   * Return a new QName created with the specified namespace, localPart and prefix, but
+   * with null namespace or prefix defaulting to the empty string. Let the QName
+   * constructor handle a null localPart.
+   */
+  public static QName newQName(String namespace, String localPart, String prefix)
+  {
+      return new QName(namespace != null ? namespace : emptyString, 
+                       localPart,
+                       prefix != null ? prefix : emptyString); 
   }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org


Mime
View raw message