You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by ru...@apache.org on 2002/01/21 01:01:57 UTC

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

rubys       02/01/20 16:01:57

  Modified:    java/src/org/apache/soap/encoding/soapenc
                        VectorSerializer.java
  Log:
  Check for and de-reference hrefs, if present.
  Submitted by:	Simon Fell <so...@zaks.demon.co.uk>
  
  Revision  Changes    Path
  1.8       +16 -3     xml-soap/java/src/org/apache/soap/encoding/soapenc/VectorSerializer.java
  
  Index: VectorSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/encoding/soapenc/VectorSerializer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- VectorSerializer.java	6 Sep 2001 20:34:17 -0000	1.7
  +++ VectorSerializer.java	21 Jan 2002 00:01:57 -0000	1.8
  @@ -180,11 +180,24 @@
   		  String actualEncStyle = declEncStyle != null
   								  ? declEncStyle
   									: inScopeEncStyle;
  -          QName declItemType = SoapEncUtils.getTypeQName(tempEl);
  +
  +		  // If it's a local reference, follow it.
  +      	  String href = tempEl.getAttribute(Constants.ATTR_REFERENCE);
  +      	  Element actualEl = tempEl;
  +		  if(href != null && !href.equals("") && (href.charAt(0) == '#'))
  +      	  {
  +        	href = href.substring(1);
  +        	actualEl = DOMUtils.getElementByID(src.getOwnerDocument().getDocumentElement(),href);
  +        	if (actualEl == null) {
  +          	  throw new IllegalArgumentException("No such ID '" + href + "'");
  +            }
  +          }
  +									
  +          QName declItemType = SoapEncUtils.getTypeQName(actualEl);
             QName actualItemType = declItemType;
   
  -                  Bean itemBean = xjmr.unmarshall(actualEncStyle, actualItemType,
  -                                                  tempEl, ctx);
  +          Bean itemBean = xjmr.unmarshall(actualEncStyle, actualItemType,
  +                                                  actualEl, ctx);
   
   		  v.addElement(itemBean.value);