Fabricate a unique name for anonymous schema types. b=199555, r=rayw@netscape.com, sr=jst@netscape.com

This commit is contained in:
harishd%netscape.com 2003-04-18 00:11:34 +00:00
parent 5d6a25ae63
commit f2fed9e715
4 changed files with 40 additions and 10 deletions

View File

@ -443,16 +443,28 @@ FindOrConstructInterface(nsIInterfaceInfoSuperManager* iism,
nsAutoString ns;
nsCOMPtr<nsIGenericInterfaceInfo> newInfo;
nsID tempID;
PRBool haveUniqueID = PR_FALSE;
rv = aComplexType->GetName(name);
if (NS_FAILED(rv)) {
return rv;
}
if (name.IsEmpty()) {
// Fabricate a unique name for anonymous type.
// Bug 199555
::NewUniqueID(&tempID);
nsXPIDLCString idStr;
idStr += tempID.ToString();
name.AssignWithConversion(idStr);
haveUniqueID = PR_TRUE;
}
else {
rv = aComplexType->GetTargetNamespace(ns);
if (NS_FAILED(rv)) {
return rv;
}
}
BuildInterfaceName(qualifier, name, ns, qualifiedName);
@ -465,6 +477,7 @@ FindOrConstructInterface(nsIInterfaceInfoSuperManager* iism,
// Need to create the interface.
if (!haveUniqueID)
::NewUniqueID(&tempID);
rv = aSet->CreateAndAppendInterface(qualifiedName.get(), tempID,
iidx.Get(IIDX::IDX_nsISupports),

View File

@ -492,7 +492,9 @@ EncodeSimpleValue(nsISOAPEncoding * aEncoding,
rc = aSchemaType->GetTargetNamespace(typeNS);
if (NS_FAILED(rc))
return rc;
needType = !(typeName.Equals(kAnyTypeSchemaType) && typeNS.Equals(nsSOAPUtils::kXSURI));
needType = (!typeName.IsEmpty() &&
!(typeName.Equals(kAnyTypeSchemaType) &&
typeNS.Equals(nsSOAPUtils::kXSURI)));
}
nsAutoString name; // First choose the appropriate name and namespace for the element.
nsAutoString ns;

View File

@ -443,16 +443,28 @@ FindOrConstructInterface(nsIInterfaceInfoSuperManager* iism,
nsAutoString ns;
nsCOMPtr<nsIGenericInterfaceInfo> newInfo;
nsID tempID;
PRBool haveUniqueID = PR_FALSE;
rv = aComplexType->GetName(name);
if (NS_FAILED(rv)) {
return rv;
}
if (name.IsEmpty()) {
// Fabricate a unique name for anonymous type.
// Bug 199555
::NewUniqueID(&tempID);
nsXPIDLCString idStr;
idStr += tempID.ToString();
name.AssignWithConversion(idStr);
haveUniqueID = PR_TRUE;
}
else {
rv = aComplexType->GetTargetNamespace(ns);
if (NS_FAILED(rv)) {
return rv;
}
}
BuildInterfaceName(qualifier, name, ns, qualifiedName);
@ -465,6 +477,7 @@ FindOrConstructInterface(nsIInterfaceInfoSuperManager* iism,
// Need to create the interface.
if (!haveUniqueID)
::NewUniqueID(&tempID);
rv = aSet->CreateAndAppendInterface(qualifiedName.get(), tempID,
iidx.Get(IIDX::IDX_nsISupports),

View File

@ -492,7 +492,9 @@ EncodeSimpleValue(nsISOAPEncoding * aEncoding,
rc = aSchemaType->GetTargetNamespace(typeNS);
if (NS_FAILED(rc))
return rc;
needType = !(typeName.Equals(kAnyTypeSchemaType) && typeNS.Equals(nsSOAPUtils::kXSURI));
needType = (!typeName.IsEmpty() &&
!(typeName.Equals(kAnyTypeSchemaType) &&
typeNS.Equals(nsSOAPUtils::kXSURI)));
}
nsAutoString name; // First choose the appropriate name and namespace for the element.
nsAutoString ns;