You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by jk...@apache.org on 2005/12/05 14:44:58 UTC

svn commit: r354072 - /incubator/woden/java/src/org/apache/woden/internal/util/dom/DOMUtils.java

Author: jkaputin
Date: Mon Dec  5 05:44:52 2005
New Revision: 354072

URL: http://svn.apache.org/viewcvs?rev=354072&view=rev
Log:
Added a variation of the getQName method, pending
modification to the way namespace declarations are
registered.

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

Modified: incubator/woden/java/src/org/apache/woden/internal/util/dom/DOMUtils.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/util/dom/DOMUtils.java?rev=354072&r1=354071&r2=354072&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/util/dom/DOMUtils.java (original)
+++ incubator/woden/java/src/org/apache/woden/internal/util/dom/DOMUtils.java Mon Dec  5 05:44:52 2005
@@ -298,6 +298,57 @@
     return null;
   }
   
+  /*
+   * this is a new version of the original getQName method from WSDL4J, with the invocation
+   * of registerUniquePrefix commented out and the 'desc' arg removed from the arg list.
+   * TODO pending modification to original method post-M2 (see todo comments below).
+   */
+  public static QName getQName(String prefixedValue,
+                               Element contextEl)
+                               throws WSDLException
+  {
+      int    index        = prefixedValue.indexOf(':');
+      String prefix       = (index != -1)
+      ? prefixedValue.substring(0, index)
+              : null;
+      String localPart    = prefixedValue.substring(index + 1);
+      String namespaceURI = getNamespaceURIFromPrefix(contextEl, prefix);
+      
+      if (namespaceURI != null)
+      {
+          //TODO investigate changing the registration of namespaces and prefixes (i.e. namespace decls)
+          //so it can happen within any WSDL element, not just Description (current behaviour is copied from WSDL4J)
+          //registerUniquePrefix(prefix, namespaceURI, desc);
+          
+          //TODO when passing prefix to QName ctor, what if it was modified by
+          //registerUniquePrefix because of a name clash (pass original or modification)?
+          return new QName(namespaceURI, 
+                  localPart, 
+                  prefix != null ? prefix : emptyString);
+      }
+      else
+      {
+          //TODO use ErrorReporter here or in callers to report the problem
+          
+          String faultCode = (prefix == null)
+          ? WSDLException.NO_PREFIX_SPECIFIED
+                  : WSDLException.UNBOUND_PREFIX;
+          
+          WSDLException wsdlExc = new WSDLException(faultCode,
+                  "Unable to determine " +
+                  "namespace of '" +
+                  prefixedValue + "'.");
+          
+          wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(contextEl));
+          
+          throw wsdlExc;
+      }
+  }
+
+  /*
+   * this is the original version of the getQName method, per WSDL4J. See to do comment below
+   * about changing register unique prefix behaviour. TODO TBD post-M2 (JK)
+   */
   public static QName getQName(String prefixedValue,
                                Element contextEl,
                                DescriptionElement desc)
@@ -312,6 +363,8 @@
 
     if (namespaceURI != null)
     {
+      //TODO investigate changing the registration of namespaces and prefixes (i.e. namespace decls)
+      //so it can happen within any WSDL element, not just Description (current behaviour is copied from WSDL4J)
       registerUniquePrefix(prefix, namespaceURI, desc);
       
       //TODO when passing prefix to QName ctor, what if it was modified by



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