You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by du...@apache.org on 2001/05/19 06:29:04 UTC

cvs commit: xml-soap/java/src/org/apache/soap/encoding/soapenc ParameterSerializer.java

duftler     01/05/18 21:29:03

  Modified:    java/src/org/apache/soap/encoding/soapenc
                        ParameterSerializer.java
  Log:
  For the case when href is present, changed the xsi:type lookup to act on
    the referenced element, as opposed to the element doing the referencing.
  Some cleanup, also.
  
  Revision  Changes    Path
  1.9       +61 -36    xml-soap/java/src/org/apache/soap/encoding/soapenc/ParameterSerializer.java
  
  Index: ParameterSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/encoding/soapenc/ParameterSerializer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ParameterSerializer.java	2001/05/11 17:38:15	1.8
  +++ ParameterSerializer.java	2001/05/19 04:29:02	1.9
  @@ -114,57 +114,82 @@
       String name = paramEl.getTagName();
       Bean bean = null;
   
  -    // If the element contains an href= parameter, shortcut to
  -    // MimePartSerializer.
  -    String href = paramEl.getAttribute(Constants.ATTR_REFERENCE);
  -    if(href != null && !href.equals(""))
  +    /*
  +      If the element contains an href= parameter, shortcut to
  +      MimePartSerializer.
  +    */
  +    String href = DOMUtils.getAttribute(paramEl, Constants.ATTR_REFERENCE);
  +
  +    if (href != null)
       {
  -      // First, check to see if it's a local ref
  -      if (href.charAt(0) == '#') {
  +      // First, check to see if it's a local ref.
  +      if (href.length() > 0 && href.charAt(0) == '#')
  +      {
           href = href.substring(1);
  -        Element el = DOMUtils.getElementByID(src.getOwnerDocument().getDocumentElement(),href);
  -        if (el == null) {
  -          throw new IllegalArgumentException("No such ID '" + href + "'");
  +
  +        Element el =
  +          DOMUtils.getElementByID(src.getOwnerDocument().getDocumentElement(),
  +                                  href);
  +
  +        if (el == null)
  +        {
  +          throw new IllegalArgumentException("No such ID '" + href + "'.");
           }
  -        
  -        QName soapType = 
  -                        SoapEncUtils.getTypeQName(paramEl);
  -        
  -        if (soapType == null) {
  -          // no xsi:type attribute found: determine the type as the 
  -          // qualified name of the parameter element (if the parameter
  -          // element is qualified) or as the qname formed by an empty
  -          // namespace URI and the tag name of the parameter element.
  -          // is that a legal qname???
  +
  +        QName soapType = SoapEncUtils.getTypeQName(el);
  +
  +        if (soapType == null)
  +        {
  +          /*
  +            No xsi:type attribute found: determine the type as the 
  +            qualified name of the parameter element (if the parameter
  +            element is qualified) or as the qname formed by an empty
  +            namespace URI and the tag name of the parameter element.
  +            Is that a legal qname???
  +          */
             String paramNamespaceURI = paramEl.getNamespaceURI();
  -          if (paramNamespaceURI != null) {
  +
  +          if (paramNamespaceURI != null)
  +          {
               soapType = new QName(paramNamespaceURI, name);
  -          } else {
  +          }
  +          else
  +          {
               soapType = new QName("", name);
             }
  -          bean = xjmr.unmarshall(inScopeEncStyle, soapType, el, ctx);
           }
  -      } else {
  +
  +        bean = xjmr.unmarshall(inScopeEncStyle, soapType, el, ctx);
  +      }
  +      else
  +      {
           bean = (new MimePartSerializer()).unmarshall(inScopeEncStyle,
                                                        elementType, src,
                                                        xjmr, ctx);
         }
       }
  -    else {
  -      QName soapType = 
  -        SoapEncUtils.getTypeQName(paramEl);
  -      
  -      if (soapType == null) {
  -        // no xsi:type attribute found: determine the type as the 
  -        // qualified name of the parameter element (if the parameter
  -        // element is qualified) or as the qname formed by an empty
  -        // namespace URI and the tag name of the parameter element.
  -	// is that a legal qname???
  +    else
  +    {
  +      QName soapType = SoapEncUtils.getTypeQName(paramEl);
  +
  +      if (soapType == null)
  +      {
  +        /*
  +          No xsi:type attribute found: determine the type as the 
  +          qualified name of the parameter element (if the parameter
  +          element is qualified) or as the qname formed by an empty
  +          namespace URI and the tag name of the parameter element.
  +          Is that a legal qname???
  +        */
           String paramNamespaceURI = paramEl.getNamespaceURI();
  -        if (paramNamespaceURI != null) {
  +
  +        if (paramNamespaceURI != null)
  +        {
             soapType = new QName(paramNamespaceURI, name);
  -        } else {
  -	  soapType = new QName("", name);
  +        }
  +        else
  +        {
  +          soapType = new QName("", name);
           }
         }