gdaniels    02/03/14 12:47:46

  Modified:    java/src/org/apache/axis/message MessageElement.java
  Log:
  1) initialize typeQName from XML when constructing during deserialization
  
  2) getType() should just return whatever's set, since what was in there
     before was using prefixes whose mapping information wasn't available
     anymore
  
  3) use serialization context's serialize() method instead of using the
     serializer directly
  
  Revision  Changes    Path
  1.86      +10 -27    xml-axis/java/src/org/apache/axis/message/MessageElement.java
  
  Index: MessageElement.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/MessageElement.java,v
  retrieving revision 1.85
  retrieving revision 1.86
  diff -u -r1.85 -r1.86
  --- MessageElement.java       14 Mar 2002 17:26:26 -0000      1.85
  +++ MessageElement.java       14 Mar 2002 20:47:46 -0000      1.86
  @@ -185,6 +185,11 @@
               this.attributes = new AttributesImpl();
           } else {
               this.attributes = new AttributesImpl(attributes);
  +            
  +            typeQName = context.getTypeFromAttributes(namespace,
  +                                                      localPart, 
  +                                                      attributes);
  +            
               String rootVal = attributes.getValue(Constants.URI_CURRENT_SOAP_ENC, 
Constants.ATTR_ROOT);
               if (rootVal != null)
                   _isRoot = rootVal.equals("1");
  @@ -249,23 +254,6 @@
       public void setNamespaceURI(String nsURI) { namespaceURI = nsURI; }
   
       public QName getType() {
  -        if (typeQName == null) {
  -            String typeStr = attributes.
  -                getValue(Constants.URI_CURRENT_SCHEMA_XSI,
  -                         Constants.ATTR_TYPE);
  -            if (typeStr != null) {
  -                int colPos = typeStr.indexOf(':');
  -                if (colPos != -1) {
  -                    typeQName = new QName(typeStr.substring(0, colPos),
  -                                          typeStr.substring(colPos + 1));
  -                } else {
  -                    typeQName = new QName("", typeStr);
  -                }
  -            } else {
  -                typeQName = new QName(getNamespaceURI(), getName());
  -            }
  -          }
  -
           return typeQName;
       }
       public void setType(QName qName) { typeQName = qName; }
  @@ -651,16 +639,11 @@
               context.registerPrefixForURI(prefix, namespaceURI);
   
           if (objectValue != null) {
  -            Serializer typeSerial = context.
  -                getSerializerForJavaType(objectValue.getClass());
  -
  -            if (typeSerial != null) {
  -                typeSerial.serialize(new QName(namespaceURI, name),
  -                                     attributes,
  -                                     objectValue,
  -                                     context);
  -                return;
  -            }
  +            context.serialize(new QName(namespaceURI, name),
  +                              attributes,
  +                              objectValue,
  +                              objectValue.getClass());
  +            return;
           }
   
           context.startElement(new QName(namespaceURI, name), attributes);
  
  
  


Reply via email to