name.Assign(kNull); rc = EncodeSimpleValue(aEncoding, kEmpty, kEmpty, name, nsnull, aDestination, aReturnValue); if (NS_FAILED(rc)) return rc; rc = (*aReturnValue)->SetAttributeNS(ns, kNull, nsSOAPUtils::kTrueA); if (NS_FAILED(rc)) return rc;
name.Assign(gSOAPStrings->kNull); rc = EncodeSimpleValue(aEncoding, gSOAPStrings->kEmpty, gSOAPStrings->kEmpty, name, nsnull, aDestination, aReturnValue); NS_ENSURE_SUCCESS(rc, rc);  rc = (*aReturnValue)->SetAttributeNS(ns, gSOAPStrings->kNull, gSOAPStrings->kTrueA); NS_ENSURE_SUCCESS(rc, rc);
    nsDefaultEncoder::Encode(nsISOAPEncoding * aEncoding,                             nsIVariant * aSource,                             const nsAString & aNamespaceURI,                             const nsAString & aName,                             nsISchemaType * aSchemaType,                             nsISOAPAttachments * aAttachments,                             nsIDOMElement * aDestination,                             nsIDOMElement * *aReturnValue){  NS_ENSURE_ARG_POINTER(aEncoding);  NS_ENSURE_ARG_POINTER(&aNamespaceURI);  NS_ENSURE_ARG_POINTER(&aName);  NS_ENSURE_ARG_POINTER(aDestination);  NS_ENSURE_ARG_POINTER(aReturnValue);  *aReturnValue = nsnull;  if (aSource == nsnull) {    nsAutoString ns;    nsCOMPtr<nsIDOMElement> cloneable;    nsresult rc = aEncoding->GetExternalSchemaURI(nsSOAPUtils::kXSIURI, ns);    if (NS_FAILED(rc))      return rc;    nsAutoString name;    if (!aName.IsEmpty())      name.Assign(kNull);    rc = EncodeSimpleValue(aEncoding, kEmpty, kEmpty,       name, nsnull, aDestination, aReturnValue);    if (NS_FAILED(rc))      return rc;    rc = (*aReturnValue)->SetAttributeNS(ns, kNull, nsSOAPUtils::kTrueA);    if (NS_FAILED(rc))      return rc;  }  nsCOMPtr < nsISOAPEncoder > encoder;  if (aSchemaType) {    nsCOMPtr < nsISchemaType > lookupType = aSchemaType;    do {      nsAutoString schemaType;      nsAutoString schemaURI;      nsAutoString encodingKey;      nsresult rc = lookupType->GetName(schemaType);      if (NS_FAILED(rc))        return rc;      rc = lookupType->GetTargetNamespace(schemaURI);      if (NS_FAILED(rc))        return rc;      SOAPEncodingKey(schemaURI, schemaType, encodingKey);      rc = aEncoding->GetEncoder(encodingKey, getter_AddRefs(encoder));      if (NS_FAILED(rc))        return rc;      if (encoder)        break;      nsCOMPtr<nsISchemaType> supertype;      rc = GetSupertype(aEncoding, lookupType, getter_AddRefs(supertype));      if (NS_FAILED(rc))        return rc;      lookupType = supertype;    }    while (lookupType);  }  if (!encoder) {    nsAutoString encodingKey;    SOAPEncodingKey(nsSOAPUtils::kXSURI,                    kAnyTypeSchemaType, encodingKey);    nsresult rc =        aEncoding->GetEncoder(encodingKey, getter_AddRefs(encoder));    if (NS_FAILED(rc))      return rc;  }  if (encoder) {    return encoder->Encode(aEncoding, aSource, aNamespaceURI, aName,                           aSchemaType, aAttachments, aDestination,                           aReturnValue);  }  return SOAP_EXCEPTION(NS_ERROR_NOT_IMPLEMENTED,"SOAP_NO_ENCODER_FOR_TYPE","The default encoder finds no encoder for specific type");}