case nsISchemaBuiltinType::BUILTIN_TYPE_ANYTYPE: *_retval = nsnull; return NS_OK; case nsISchemaBuiltinType::BUILTIN_TYPE_STRING:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NORMALIZED_STRING: name = gSOAPStrings->kStringSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_TOKEN: name = gSOAPStrings->kNormalizedStringSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_BYTE: name = gSOAPStrings->kShortSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDBYTE: name = gSOAPStrings->kUnsignedShortSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_BASE64BINARY:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_HEXBINARY:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_INTEGER: name = gSOAPStrings->kDecimalSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_POSITIVEINTEGER: name = gSOAPStrings->kNonNegativeIntegerSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NEGATIVEINTEGER: name = gSOAPStrings->kNonPositiveIntegerSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NONNEGATIVEINTEGER: name = gSOAPStrings->kIntegerSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NONPOSITIVEINTEGER: name = gSOAPStrings->kIntegerSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_INT: name = gSOAPStrings->kLongSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDINT: name = gSOAPStrings->kUnsignedLongSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_LONG: name = gSOAPStrings->kIntegerSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDLONG: name = gSOAPStrings->kNonNegativeIntegerSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_SHORT: name = gSOAPStrings->kIntSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDSHORT: name = gSOAPStrings->kUnsignedIntSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_DECIMAL:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_FLOAT:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_DOUBLE:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_BOOLEAN:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_TIME:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_DATETIME:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_DURATION:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_DATE:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_GMONTH:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_GYEAR:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_GYEARMONTH:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_GDAY:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_GMONTHDAY:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NAME:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_QNAME:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NCNAME: name = gSOAPStrings->kNameSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_ANYURI:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_LANGUAGE: name = gSOAPStrings->kTokenSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_ID: name = gSOAPStrings->kNCNameSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_IDREF: name = gSOAPStrings->kNCNameSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_IDREFS: name = gSOAPStrings->kNormalizedStringSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_ENTITY: name = gSOAPStrings->kNCNameSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_ENTITIES: name = gSOAPStrings->kNormalizedStringSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NOTATION:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NMTOKEN: name = gSOAPStrings->kTokenSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NMTOKENS: name = gSOAPStrings->kNormalizedStringSchemaType; break;
case nsISchemaBuiltinType::BUILTIN_TYPE_ANYTYPE: *aResult = nsnull; return NS_OK; case nsISchemaBuiltinType::BUILTIN_TYPE_STRING:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NORMALIZED_STRING: name = gSOAPStrings->kStringSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_TOKEN: name = gSOAPStrings->kNormalizedStringSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_BYTE: name = gSOAPStrings->kShortSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDBYTE: name = gSOAPStrings->kUnsignedShortSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_BASE64BINARY:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_HEXBINARY:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_INTEGER: name = gSOAPStrings->kDecimalSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_POSITIVEINTEGER: name = gSOAPStrings->kNonNegativeIntegerSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NEGATIVEINTEGER: name = gSOAPStrings->kNonPositiveIntegerSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NONNEGATIVEINTEGER: name = gSOAPStrings->kIntegerSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NONPOSITIVEINTEGER: name = gSOAPStrings->kIntegerSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_INT: name = gSOAPStrings->kLongSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDINT: name = gSOAPStrings->kUnsignedLongSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_LONG: name = gSOAPStrings->kIntegerSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDLONG: name = gSOAPStrings->kNonNegativeIntegerSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_SHORT: name = gSOAPStrings->kIntSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDSHORT: name = gSOAPStrings->kUnsignedIntSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_DECIMAL:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_FLOAT:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_DOUBLE:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_BOOLEAN:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_TIME:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_DATETIME:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_DURATION:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_DATE:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_GMONTH:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_GYEAR:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_GYEARMONTH:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_GDAY:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_GMONTHDAY:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NAME:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_QNAME:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NCNAME: name = gSOAPStrings->kNameSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_ANYURI:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_LANGUAGE: name = gSOAPStrings->kTokenSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_ID: name = gSOAPStrings->kNCNameSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_IDREF: name = gSOAPStrings->kNCNameSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_IDREFS: name = gSOAPStrings->kNormalizedStringSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_ENTITY: name = gSOAPStrings->kNCNameSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_ENTITIES: name = gSOAPStrings->kNormalizedStringSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NOTATION:  name = gSOAPStrings->kAnyTypeSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NMTOKEN: name = gSOAPStrings->kTokenSchemaType; break; case nsISchemaBuiltinType::BUILTIN_TYPE_NMTOKENS: name = gSOAPStrings->kNormalizedStringSchemaType; break;
static nsresult GetSupertype(nsISOAPEncoding * aEncoding, nsISchemaType* aType, nsISchemaType** _retval){  PRUint16 typevalue;  nsresult rc = aType->GetSchemaType(&typevalue);  if (NS_FAILED(rc))    return rc;  nsCOMPtr<nsISchemaType> base;  nsAutoString name;  switch (typevalue) {    case nsISchemaType::SCHEMA_TYPE_COMPLEX:    {      nsCOMPtr<nsISchemaComplexType> type =        do_QueryInterface(aType);      rc = type->GetBaseType(getter_AddRefs(base));      if (NS_FAILED(rc))        return rc;      break;    }    case nsISchemaType::SCHEMA_TYPE_SIMPLE:    {      nsCOMPtr<nsISchemaSimpleType> type =        do_QueryInterface(aType);      PRUint16 simpletypevalue;      rc = type->GetSimpleType(&simpletypevalue);      if (NS_FAILED(rc))        return rc;      switch (simpletypevalue) {        //  Ultimately, this is wrong because in XML types are value spaces        //  We have not handled unions and lists.        //  A union might be considered a supertype of anything it joins        //  but it is the supertype of all types with value spaces it includes.        //  SOAP is an attempt to treat XML types as though they were        //  data types, which are governed by labels instead of value spaces.        //  So two unrelated values may coexist, but we will disallow it        //  because the caller probably wants type guarantees, not value        //  guarantees.        case nsISchemaSimpleType::SIMPLE_TYPE_RESTRICTION:        {          nsCOMPtr<nsISchemaRestrictionType> simpletype =            do_QueryInterface(type);          nsCOMPtr<nsISchemaSimpleType> simplebasetype;          rc = simpletype->GetBaseType(getter_AddRefs(simplebasetype));          if (NS_FAILED(rc))            return rc;          base = simplebasetype;          break;        }        case nsISchemaSimpleType::SIMPLE_TYPE_BUILTIN:        {          nsCOMPtr<nsISchemaBuiltinType> builtintype =             do_QueryInterface(type);          PRUint16 builtintypevalue;          rc = builtintype->GetBuiltinType(&builtintypevalue);          if (NS_FAILED(rc))            return rc;          switch(builtintypevalue) {            case nsISchemaBuiltinType::BUILTIN_TYPE_ANYTYPE:  //  Root of all types              *_retval = nsnull;              return NS_OK;            case nsISchemaBuiltinType::BUILTIN_TYPE_STRING://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_NORMALIZED_STRING:              name = gSOAPStrings->kStringSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_TOKEN:              name = gSOAPStrings->kNormalizedStringSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_BYTE:              name = gSOAPStrings->kShortSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDBYTE:              name = gSOAPStrings->kUnsignedShortSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_BASE64BINARY://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_HEXBINARY://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_INTEGER:              name = gSOAPStrings->kDecimalSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_POSITIVEINTEGER:              name = gSOAPStrings->kNonNegativeIntegerSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_NEGATIVEINTEGER:              name = gSOAPStrings->kNonPositiveIntegerSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_NONNEGATIVEINTEGER:              name = gSOAPStrings->kIntegerSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_NONPOSITIVEINTEGER:              name = gSOAPStrings->kIntegerSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_INT:              name = gSOAPStrings->kLongSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDINT:              name = gSOAPStrings->kUnsignedLongSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_LONG:              name = gSOAPStrings->kIntegerSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDLONG:              name = gSOAPStrings->kNonNegativeIntegerSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_SHORT:              name = gSOAPStrings->kIntSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDSHORT:              name = gSOAPStrings->kUnsignedIntSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_DECIMAL://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_FLOAT://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_DOUBLE://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_BOOLEAN://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_TIME://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_DATETIME://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_DURATION://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_DATE://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_GMONTH://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_GYEAR://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_GYEARMONTH://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_GDAY://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_GMONTHDAY://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_NAME://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_QNAME://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_NCNAME:              name = gSOAPStrings->kNameSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_ANYURI://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_LANGUAGE:              name = gSOAPStrings->kTokenSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_ID:              name = gSOAPStrings->kNCNameSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_IDREF:              name = gSOAPStrings->kNCNameSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_IDREFS:              name = gSOAPStrings->kNormalizedStringSchemaType;  //  Really a list...              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_ENTITY:              name = gSOAPStrings->kNCNameSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_ENTITIES:              name = gSOAPStrings->kNormalizedStringSchemaType;  //  Really a list...              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_NOTATION://              name = kAnySimpleTypeSchemaType;              name = gSOAPStrings->kAnyTypeSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_NMTOKEN:              name = gSOAPStrings->kTokenSchemaType;              break;            case nsISchemaBuiltinType::BUILTIN_TYPE_NMTOKENS:              name = gSOAPStrings->kNormalizedStringSchemaType;  //  Really a list...              break;          }        }      }      break;    }  }  if (!base) {    if (name.IsEmpty()) {      switch (typevalue) {        case nsISchemaType::SCHEMA_TYPE_COMPLEX:          name = gSOAPStrings->kAnyTypeSchemaType;          break;        default://          name = kAnySimpleTypeSchemaType;          name = gSOAPStrings->kAnyTypeSchemaType;      }    }    nsCOMPtr<nsISchemaCollection> collection;    rc = aEncoding->GetSchemaCollection(getter_AddRefs(collection));    if (NS_FAILED(rc))      return rc;    rc = collection->GetType(name,                             gSOAPStrings->kXSURI,                             getter_AddRefs(base));//    if (NS_FAILED(rc)) return rc;  }  *_retval = base;  NS_IF_ADDREF(*_retval);  return NS_OK;}