More fixes to strings, and changed encoding to support a single string

lookup key instead of two for better genericity and efficiency.
This commit is contained in:
rayw%netscape.com 2001-12-05 00:10:07 +00:00
parent fe233270bf
commit 3eb3353b87
20 changed files with 362 additions and 326 deletions

View File

@ -78,56 +78,40 @@ interface nsISOAPEncoding : nsISupports {
/**
* Set an encoder in the encoding.
*
* @param aSchemaNamespaceURI The schema namespace URI to serve as key.
*
* @param aSchemaType The schema type to serve as key.
* @param aKey The key to be associated with the encoder.
*
* @param aEncoder The encoder to be specified or null to eliminate
* the encoder.
*
* @return Old encoder registered under that type in the encoding, which
* should be kept by the new encoder if it is to be called back.
*/
void setEncoder(in AString aSchemaNamespaceURI, in AString aSchemaType,
in nsISOAPEncoder aEncoder);
void setEncoder(in AString aKey, in nsISOAPEncoder aEncoder);
/**
* Get an encoder from the encoding.
*
* @param aSchemaNamespaceURI The schema namespace URI to serve as key.
*
* @param aSchemaType The schema type to serve as key.
* @param aKey The key to be used to look up the encoder.
*
* @return The encoder.
*/
nsISOAPEncoder getEncoder(in AString aSchemaNamespaceURI, in AString aSchemaType);
nsISOAPEncoder getEncoder(in AString aKey);
/**
* Set a decoder in the encoding.
*
* @param aSchemaNamespaceURI The schema namespace URI to serve as key.
*
* @param aSchemaType The schema type to serve as key.
* @param aKey The key to be associated with the decoder.
*
* @param aDecoder The decoder to be specified or null to eliminate
* the decoder.
*
* @return Old decoder registered under that type in the encoding, which
* should be kept by the new decoder if it is to be called back.
*/
void setDecoder(in AString aSchemaNamespaceURI, in AString aSchemaType,
in nsISOAPDecoder aDecoder);
void setDecoder(in AString aKey, in nsISOAPDecoder aDecoder);
/**
* Get a decoder from the encoding.
*
* @param aSchemaNamespaceURI The schema namespace URI to serve as key.
*
* @param aSchemaType The schema type to serve as key.
* @param aKey The key to be used to look up the decoder.
*
* @return The decoder.
*/
nsISOAPDecoder getDecoder(in AString aSchemaNamespaceURI, in AString aSchemaType);
nsISOAPDecoder getDecoder(in AString aKey);
/**
* The default encoder invoked by all encoding calls. Appropriate calls

View File

@ -134,10 +134,13 @@ DECLARE_ENCODER(UnsignedByte)
#define REGISTER_ENCODER(name) \
{\
ns##name##Encoder *handler = new ns##name##Encoder();\
SetEncoder(nsSOAPUtils::kXSURI, k##name##SchemaType, handler); \
SetEncoder(nsSOAPUtils::kXSDURI, k##name##SchemaType, handler); \
SetDecoder(nsSOAPUtils::kXSURI, k##name##SchemaType, handler); \
SetDecoder(nsSOAPUtils::kXSDURI, k##name##SchemaType, handler); \
nsAutoString encodingKey;\
SOAPEncodingKey(nsSOAPUtils::kXSURI, k##name##SchemaType, encodingKey);\
SetEncoder(encodingKey, handler); \
SetDecoder(encodingKey, handler); \
SOAPEncodingKey(nsSOAPUtils::kXSDURI, k##name##SchemaType, encodingKey);\
SetEncoder(encodingKey, handler); \
SetDecoder(encodingKey, handler); \
}
nsDefaultSOAPEncoder::nsDefaultSOAPEncoder(): nsSOAPEncoding(nsSOAPUtils::kSOAPEncodingURI, nsnull, nsnull)
@ -151,8 +154,10 @@ nsDefaultSOAPEncoder::nsDefaultSOAPEncoder(): nsSOAPEncoding(nsSOAPUtils::kSOAPE
REGISTER_ENCODER(AnySimpleType)
{
nsArrayEncoder *handler = new nsArrayEncoder();
SetEncoder(nsSOAPUtils::kSOAPEncodingURI, kArraySOAPType, handler);
SetDecoder(nsSOAPUtils::kSOAPEncodingURI, kArraySOAPType, handler);
nsAutoString encodingKey;
SOAPEncodingKey(nsSOAPUtils::kSOAPEncodingURI, kArraySOAPType, encodingKey);
SetEncoder(encodingKey, handler);
SetDecoder(encodingKey, handler);
}
REGISTER_ENCODER(String)
REGISTER_ENCODER(Boolean)
@ -169,9 +174,9 @@ nsDefaultSOAPEncoder::nsDefaultSOAPEncoder(): nsSOAPEncoding(nsSOAPUtils::kSOAPE
}
// Here is the implementation of the encoders.
static nsresult EncodeSimpleValue(
const nsAReadableString & aValue,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aValue,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsIDOMElement* aDestination,
nsIDOMElement** _retval)
{
@ -199,8 +204,8 @@ static nsresult EncodeSimpleValue(
NS_IMETHODIMP nsDefaultEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -212,11 +217,13 @@ NS_IMETHODIMP nsDefaultEncoder::Encode(nsISOAPEncoding* aEncoding,
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;
rc = aEncoding->GetEncoder(schemaURI, schemaType, getter_AddRefs(encoder));
SOAPEncodingKey(schemaURI, schemaType, encodingKey);
rc = aEncoding->GetEncoder(encodingKey, getter_AddRefs(encoder));
if (NS_FAILED(rc)) return rc;
if (encoder) break;
PRUint16 typevalue;
@ -240,14 +247,14 @@ NS_IMETHODIMP nsDefaultEncoder::Encode(nsISOAPEncoding* aEncoding,
else {
typevalue = nsISchemaType::SCHEMA_TYPE_COMPLEX;
}
nsAutoString schemaType;
nsAutoString encodingKey;
if (typevalue == nsISchemaType::SCHEMA_TYPE_COMPLEX) {
schemaType.Assign(kAnyTypeSchemaType);
SOAPEncodingKey(nsSOAPUtils::kXSDURI, kAnyTypeSchemaType, encodingKey);
}
else {
schemaType.Assign(kAnySimpleTypeSchemaType);
SOAPEncodingKey(nsSOAPUtils::kXSDURI, kAnySimpleTypeSchemaType, encodingKey);
}
nsresult rc = aEncoding->GetEncoder(nsSOAPUtils::kXSDURI, schemaType, getter_AddRefs(encoder));
nsresult rc = aEncoding->GetEncoder(encodingKey, getter_AddRefs(encoder));
if (NS_FAILED(rc)) return rc;
}
if (encoder) {
@ -256,10 +263,11 @@ NS_IMETHODIMP nsDefaultEncoder::Encode(nsISOAPEncoding* aEncoding,
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsAnyTypeEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -370,7 +378,9 @@ NS_IMETHODIMP nsAnyTypeEncoder::Encode(nsISOAPEncoding* aEncoding,
}
if (!nativeSchemaType.IsEmpty()) {
nsCOMPtr<nsISOAPEncoder> encoder;
nsresult rc = aEncoding->GetEncoder(nativeSchemaURI, nativeSchemaType, getter_AddRefs(encoder));
nsAutoString encodingKey;
SOAPEncodingKey(nativeSchemaURI, nativeSchemaType, encodingKey);
nsresult rc = aEncoding->GetEncoder(encodingKey, getter_AddRefs(encoder));
if (NS_FAILED(rc)) return rc;
if (encoder) {
nsresult rc = encoder->Encode(aEncoding, aSource, aNamespaceURI, aName, aSchemaType, aAttachments, aDestination, aReturnValue);
@ -397,8 +407,8 @@ NS_IMETHODIMP nsAnyTypeEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsAnySimpleTypeEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -426,8 +436,8 @@ NS_IMETHODIMP nsAnySimpleTypeEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsArrayEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -534,8 +544,8 @@ NS_IMETHODIMP nsArrayEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsStringEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -563,8 +573,8 @@ NS_IMETHODIMP nsStringEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsBooleanEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -592,8 +602,8 @@ NS_IMETHODIMP nsBooleanEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsDoubleEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -626,8 +636,8 @@ NS_IMETHODIMP nsDoubleEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsFloatEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -660,8 +670,8 @@ NS_IMETHODIMP nsFloatEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsLongEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -694,8 +704,8 @@ NS_IMETHODIMP nsLongEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsIntEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -728,8 +738,8 @@ NS_IMETHODIMP nsIntEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsShortEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -762,8 +772,8 @@ NS_IMETHODIMP nsShortEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsByteEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -796,8 +806,8 @@ NS_IMETHODIMP nsByteEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsUnsignedLongEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -830,8 +840,8 @@ NS_IMETHODIMP nsUnsignedLongEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsUnsignedIntEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -864,8 +874,8 @@ NS_IMETHODIMP nsUnsignedIntEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsUnsignedShortEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -898,8 +908,8 @@ NS_IMETHODIMP nsUnsignedShortEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsUnsignedByteEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -985,7 +995,9 @@ NS_IMETHODIMP nsDefaultEncoder::Decode(nsISOAPEncoding* aEncoding,
if (NS_FAILED(rc)) return rc;
rc = lookupType->GetTargetNamespace(schemaURI);
if (NS_FAILED(rc)) return rc;
rc = aEncoding->GetDecoder(schemaURI, schemaType, getter_AddRefs(decoder));
nsAutoString encodingKey;
SOAPEncodingKey(schemaURI, schemaType, encodingKey);
rc = aEncoding->GetDecoder(encodingKey, getter_AddRefs(decoder));
if (NS_FAILED(rc)) return rc;
if (decoder) break;
PRUint16 typevalue;
@ -1009,14 +1021,14 @@ NS_IMETHODIMP nsDefaultEncoder::Decode(nsISOAPEncoding* aEncoding,
else {
typevalue = nsISchemaType::SCHEMA_TYPE_COMPLEX;
}
nsAutoString schemaType;
nsAutoString encodingKey;
if (typevalue == nsISchemaType::SCHEMA_TYPE_COMPLEX) {
schemaType.Assign(kAnyTypeSchemaType);
SOAPEncodingKey(nsSOAPUtils::kXSDURI, kAnyTypeSchemaType, encodingKey);
}
else {
schemaType.Assign(kAnySimpleTypeSchemaType);
SOAPEncodingKey(nsSOAPUtils::kXSDURI, kAnySimpleTypeSchemaType, encodingKey);
}
nsresult rc = aEncoding->GetDecoder(nsSOAPUtils::kXSDURI, schemaType, getter_AddRefs(decoder));
nsresult rc = aEncoding->GetDecoder(encodingKey, getter_AddRefs(decoder));
if (NS_FAILED(rc)) return rc;
}
if (decoder) {

View File

@ -48,7 +48,7 @@ NS_IMPL_ISUPPORTS3(nsSOAPBlock,
nsIJSNativeInitializer)
/* attribute AString namespaceURI; */
NS_IMETHODIMP nsSOAPBlock::GetNamespaceURI(nsAWritableString & aNamespaceURI)
NS_IMETHODIMP nsSOAPBlock::GetNamespaceURI(nsAString & aNamespaceURI)
{
NS_ENSURE_ARG_POINTER(&aNamespaceURI);
if (mElement) {
@ -59,7 +59,7 @@ NS_IMETHODIMP nsSOAPBlock::GetNamespaceURI(nsAWritableString & aNamespaceURI)
}
return NS_OK;
}
NS_IMETHODIMP nsSOAPBlock::SetNamespaceURI(const nsAReadableString & aNamespaceURI)
NS_IMETHODIMP nsSOAPBlock::SetNamespaceURI(const nsAString & aNamespaceURI)
{
nsresult rc = SetElement(nsnull);
if (NS_FAILED(rc)) return rc;
@ -68,7 +68,7 @@ NS_IMETHODIMP nsSOAPBlock::SetNamespaceURI(const nsAReadableString & aNamespaceU
}
/* attribute AString name; */
NS_IMETHODIMP nsSOAPBlock::GetName(nsAWritableString & aName)
NS_IMETHODIMP nsSOAPBlock::GetName(nsAString & aName)
{
NS_ENSURE_ARG_POINTER(&aName);
if (mElement) {
@ -79,7 +79,7 @@ NS_IMETHODIMP nsSOAPBlock::GetName(nsAWritableString & aName)
}
return NS_OK;
}
NS_IMETHODIMP nsSOAPBlock::SetName(const nsAReadableString & aName)
NS_IMETHODIMP nsSOAPBlock::SetName(const nsAString & aName)
{
nsresult rc = SetElement(nsnull);
if (NS_FAILED(rc)) return rc;

View File

@ -52,13 +52,13 @@ NS_IMPL_QUERY_CLASSINFO(nsSOAPCall)
NS_INTERFACE_MAP_END_INHERITING(nsSOAPMessage)
/* attribute DOMString transportURI; */
NS_IMETHODIMP nsSOAPCall::GetTransportURI(nsAWritableString & aTransportURI)
NS_IMETHODIMP nsSOAPCall::GetTransportURI(nsAString & aTransportURI)
{
NS_ENSURE_ARG_POINTER(&aTransportURI);
aTransportURI.Assign(mTransportURI);
return NS_OK;
}
NS_IMETHODIMP nsSOAPCall::SetTransportURI(const nsAReadableString & aTransportURI)
NS_IMETHODIMP nsSOAPCall::SetTransportURI(const nsAString & aTransportURI)
{
mTransportURI.Assign(aTransportURI);
return NS_OK;

View File

@ -102,26 +102,26 @@ NS_IMETHODIMP nsSOAPEncodingRegistry::GetStyleURI(nsAString & aStyleURI)
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsISOAPEncoder setEncoder (in AString aSchemaNamespaceURI, in AString aSchemaType, in nsISOAPEncoder aEncoder); */
NS_IMETHODIMP nsSOAPEncodingRegistry::SetEncoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPEncoder *aEncoder)
/* nsISOAPEncoder setEncoder (in AString aKey, in nsISOAPEncoder aEncoder); */
NS_IMETHODIMP nsSOAPEncodingRegistry::SetEncoder(const nsAString & aKey, nsISOAPEncoder *aEncoder)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsISOAPEncoder getEncoder (in AString aSchemaNamespaceURI, in AString aSchemaType); */
NS_IMETHODIMP nsSOAPEncodingRegistry::GetEncoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPEncoder **_retval)
/* nsISOAPEncoder getEncoder (in AString aKey); */
NS_IMETHODIMP nsSOAPEncodingRegistry::GetEncoder(const nsAString & aKey, nsISOAPEncoder **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsISOAPDecoder setDecoder (in AString aSchemaNamespaceURI, in AString aSchemaType, in nsISOAPDecoder aDecoder); */
NS_IMETHODIMP nsSOAPEncodingRegistry::SetDecoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPDecoder *aDecoder)
/* nsISOAPDecoder setDecoder (in AString aKey, in nsISOAPDecoder aDecoder); */
NS_IMETHODIMP nsSOAPEncodingRegistry::SetDecoder(const nsAString & aKey, nsISOAPDecoder *aDecoder)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsISOAPDecoder getDecoder (in AString aSchemaNamespaceURI, in AString aSchemaType); */
NS_IMETHODIMP nsSOAPEncodingRegistry::GetDecoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPDecoder **_retval)
/* nsISOAPDecoder getDecoder (in AString aKey); */
NS_IMETHODIMP nsSOAPEncodingRegistry::GetDecoder(const nsAString & aKey, nsISOAPDecoder **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -220,16 +220,12 @@ NS_IMETHODIMP nsSOAPEncoding::GetAssociatedEncoding(const nsAString & aStyleURI,
return mRegistry->GetAssociatedEncoding(aStyleURI, aCreateIf, _retval);
}
/* nsISOAPEncoder setEncoder (in AString aSchemaNamespaceURI, in AString aSchemaType, in nsISOAPEncoder aEncoder); */
NS_IMETHODIMP nsSOAPEncoding::SetEncoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPEncoder *aEncoder)
/* nsISOAPEncoder setEncoder (in AString aKey, in nsISOAPEncoder aEncoder); */
NS_IMETHODIMP nsSOAPEncoding::SetEncoder(const nsAString & aKey, nsISOAPEncoder *aEncoder)
{
NS_SOAP_ENSURE_ARG_STRING(aSchemaNamespaceURI);
NS_SOAP_ENSURE_ARG_STRING(aSchemaType);
NS_SOAP_ENSURE_ARG_STRING(aKey);
NS_ENSURE_ARG(aEncoder);
nsAutoString name(aSchemaNamespaceURI);
name.Append(nsSOAPUtils::kEncodingSeparator);
name.Append(aSchemaType);
nsStringKey nameKey(name);
nsStringKey nameKey(aKey);
if (aEncoder) {
mEncoders->Put(&nameKey, aEncoder, nsnull);
}
@ -239,32 +235,25 @@ NS_IMETHODIMP nsSOAPEncoding::SetEncoder(const nsAString & aSchemaNamespaceURI,
return NS_OK;
}
/* nsISOAPEncoder getEncoder (in AString aSchemaNamespaceURI, in AString aSchemaType); */
NS_IMETHODIMP nsSOAPEncoding::GetEncoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPEncoder **_retval)
/* nsISOAPEncoder getEncoder (in AString aKey); */
NS_IMETHODIMP nsSOAPEncoding::GetEncoder(const nsAString & aKey, nsISOAPEncoder **_retval)
{
NS_SOAP_ENSURE_ARG_STRING(aSchemaNamespaceURI);
NS_SOAP_ENSURE_ARG_STRING(aSchemaType);
NS_SOAP_ENSURE_ARG_STRING(aKey);
NS_ENSURE_ARG_POINTER(_retval);
nsAutoString name(aSchemaNamespaceURI);
name.Append(nsSOAPUtils::kEncodingSeparator);
name.Append(aSchemaType);
nsStringKey nameKey(name);
nsStringKey nameKey(aKey);
*_retval = (nsISOAPEncoder*)mEncoders->Get(&nameKey);
if (*_retval == nsnull && mDefaultEncoding != nsnull) {
return mDefaultEncoding->GetEncoder(aSchemaNamespaceURI, aSchemaType, _retval);
return mDefaultEncoding->GetEncoder(aKey, _retval);
}
return NS_OK;
}
/* nsISOAPDecoder setDecoder (in AString aSchemaNamespaceURI, in AString aSchemaType, in nsISOAPDecoder aDecoder); */
NS_IMETHODIMP nsSOAPEncoding::SetDecoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPDecoder *aDecoder)
/* nsISOAPDecoder setDecoder (in AString aKey, in nsISOAPDecoder aDecoder); */
NS_IMETHODIMP nsSOAPEncoding::SetDecoder(const nsAString & aKey, nsISOAPDecoder *aDecoder)
{
NS_SOAP_ENSURE_ARG_STRING(aSchemaNamespaceURI);
NS_SOAP_ENSURE_ARG_STRING(aSchemaType);
nsAutoString name(aSchemaNamespaceURI);
name.Append(nsSOAPUtils::kEncodingSeparator);
name.Append(aSchemaType);
nsStringKey nameKey(name);
NS_SOAP_ENSURE_ARG_STRING(aKey);
NS_ENSURE_ARG(aDecoder);
nsStringKey nameKey(aKey);
if (aDecoder) {
mDecoders->Put(&nameKey, aDecoder, nsnull);
}
@ -274,19 +263,15 @@ NS_IMETHODIMP nsSOAPEncoding::SetDecoder(const nsAString & aSchemaNamespaceURI,
return NS_OK;
}
/* nsISOAPDecoder getDecoder (in AString aSchemaNamespaceURI, in AString aSchemaType); */
NS_IMETHODIMP nsSOAPEncoding::GetDecoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPDecoder **_retval)
/* nsISOAPDecoder getDecoder (in AString aKey); */
NS_IMETHODIMP nsSOAPEncoding::GetDecoder(const nsAString & aKey, nsISOAPDecoder **_retval)
{
NS_SOAP_ENSURE_ARG_STRING(aSchemaNamespaceURI);
NS_SOAP_ENSURE_ARG_STRING(aSchemaType);
NS_SOAP_ENSURE_ARG_STRING(aKey);
NS_ENSURE_ARG_POINTER(_retval);
nsAutoString name(aSchemaNamespaceURI);
name.Append(nsSOAPUtils::kEncodingSeparator);
name.Append(aSchemaType);
nsStringKey nameKey(name);
nsStringKey nameKey(aKey);
*_retval = (nsISOAPDecoder*)mDecoders->Get(&nameKey);
if (*_retval == nsnull && mDefaultEncoding != nsnull) {
return mDefaultEncoding->GetDecoder(aSchemaNamespaceURI, aSchemaType, _retval);
return mDefaultEncoding->GetDecoder(aKey, _retval);
}
return NS_OK;
}

View File

@ -51,7 +51,7 @@ NS_IMETHODIMP nsSOAPFault::GetElement(nsIDOMElement * *aElement)
}
/* readonly attribute wstring faultCode; */
NS_IMETHODIMP nsSOAPFault::GetFaultCode(nsAWritableString & aFaultCode)
NS_IMETHODIMP nsSOAPFault::GetFaultCode(nsAString & aFaultCode)
{
NS_ENSURE_ARG_POINTER(&aFaultCode);
aFaultCode.Truncate();
@ -67,7 +67,7 @@ NS_IMETHODIMP nsSOAPFault::GetFaultCode(nsAWritableString & aFaultCode)
}
/* readonly attribute wstring faultString; */
NS_IMETHODIMP nsSOAPFault::GetFaultString(nsAWritableString & aFaultString)
NS_IMETHODIMP nsSOAPFault::GetFaultString(nsAString & aFaultString)
{
NS_ENSURE_ARG_POINTER(&aFaultString);
@ -82,7 +82,7 @@ NS_IMETHODIMP nsSOAPFault::GetFaultString(nsAWritableString & aFaultString)
}
/* readonly attribute wstring faultActor; */
NS_IMETHODIMP nsSOAPFault::GetFaultActor(nsAWritableString & aFaultActor)
NS_IMETHODIMP nsSOAPFault::GetFaultActor(nsAString & aFaultActor)
{
NS_ENSURE_ARG_POINTER(&aFaultActor);

View File

@ -50,7 +50,7 @@ nsSOAPHeaderBlock::~nsSOAPHeaderBlock()
}
/* attribute AString actorURI; */
NS_IMETHODIMP nsSOAPHeaderBlock::GetActorURI(nsAWritableString & aActorURI)
NS_IMETHODIMP nsSOAPHeaderBlock::GetActorURI(nsAString & aActorURI)
{
NS_ENSURE_ARG_POINTER(&aActorURI);
if (mElement) {
@ -61,7 +61,7 @@ NS_IMETHODIMP nsSOAPHeaderBlock::GetActorURI(nsAWritableString & aActorURI)
}
return NS_OK;
}
NS_IMETHODIMP nsSOAPHeaderBlock::SetActorURI(const nsAReadableString & aActorURI)
NS_IMETHODIMP nsSOAPHeaderBlock::SetActorURI(const nsAString & aActorURI)
{
nsresult rc = SetElement(nsnull);
if (NS_FAILED(rc)) return rc;

View File

@ -127,13 +127,13 @@ NS_IMETHODIMP nsSOAPMessage::GetBody(nsIDOMElement * *aBody)
}
/* attribute DOMString actionURI; */
NS_IMETHODIMP nsSOAPMessage::GetActionURI(nsAWritableString & aActionURI)
NS_IMETHODIMP nsSOAPMessage::GetActionURI(nsAString & aActionURI)
{
NS_ENSURE_ARG_POINTER(&aActionURI);
aActionURI.Assign(mActionURI);
return NS_OK;
}
NS_IMETHODIMP nsSOAPMessage::SetActionURI(const nsAReadableString & aActionURI)
NS_IMETHODIMP nsSOAPMessage::SetActionURI(const nsAString & aActionURI)
{
mActionURI.Assign(aActionURI);
return NS_OK;

View File

@ -27,75 +27,105 @@
NS_NAMED_LITERAL_STRING(realSOAPEnvURI,"http://schemas.xmlsoap.org/soap/envelope/");
const nsAString& nsSOAPUtils::kSOAPEnvURI = realSOAPEnvURI;
NS_NAMED_LITERAL_STRING(realSOAPEncodingURI,"http://schemas.xmlsoap.org/soap/encoding/");
const nsAString& nsSOAPUtils::kSOAPEncodingURI = realSOAPEncodingURI;
NS_NAMED_LITERAL_STRING(realSOAPEnvPrefix,"SOAP-ENV");
const nsAString& nsSOAPUtils::kSOAPEnvPrefix = realSOAPEnvPrefix;
NS_NAMED_LITERAL_STRING(realSOAPEncodingPrefix,"SOAP-ENC");
const nsAString& nsSOAPUtils::kSOAPEncodingPrefix = realSOAPEncodingPrefix;
NS_NAMED_LITERAL_STRING(realXSURI,"http://www.w3.org/2001/XMLSchema");
const nsAString& nsSOAPUtils::kXSURI = realXSURI;
NS_NAMED_LITERAL_STRING(realXSIURI,"http://www.w3.org/2001/XMLSchema-instance");
const nsAString& nsSOAPUtils::kXSIURI = realXSIURI;
NS_NAMED_LITERAL_STRING(realXSDURI,"http://www.w3.org/2001/XMLSchema-datatypes");
const nsAString& nsSOAPUtils::kXSDURI = realXSDURI;
NS_NAMED_LITERAL_STRING(realXSIPrefix,"xsi");
const nsAString& nsSOAPUtils::kXSIPrefix = realXSIPrefix;
NS_NAMED_LITERAL_STRING(realXSITypeAttribute,"type");
const nsAString& nsSOAPUtils::kXSITypeAttribute = realXSITypeAttribute;
NS_NAMED_LITERAL_STRING(realXSPrefix,"xs");
const nsAString& nsSOAPUtils::kXSPrefix = realXSPrefix;
NS_NAMED_LITERAL_STRING(realXSDPrefix,"xsd");
const nsAString& nsSOAPUtils::kXSDPrefix = realXSDPrefix;
NS_NAMED_LITERAL_STRING(realEncodingStyleAttribute,"encodingStyle");
const nsAString& nsSOAPUtils::kEncodingStyleAttribute = realEncodingStyleAttribute;
NS_NAMED_LITERAL_STRING(realActorAttribute,"actor");
const nsAString& nsSOAPUtils::kActorAttribute = realActorAttribute;
NS_NAMED_LITERAL_STRING(realMustUnderstandAttribute,"mustUnderstand");
const nsAString& nsSOAPUtils::kMustUnderstandAttribute = realMustUnderstandAttribute;
NS_NAMED_LITERAL_STRING(realEnvelopeTagName,"Envelope");
const nsAString& nsSOAPUtils::kEnvelopeTagName = realEnvelopeTagName;
NS_NAMED_LITERAL_STRING(realHeaderTagName,"Header");
const nsAString& nsSOAPUtils::kHeaderTagName = realHeaderTagName;
NS_NAMED_LITERAL_STRING(realBodyTagName,"Body");
const nsAString& nsSOAPUtils::kBodyTagName = realBodyTagName;
NS_NAMED_LITERAL_STRING(realFaultTagName,"Fault");
const nsAString& nsSOAPUtils::kFaultTagName = realFaultTagName;
NS_NAMED_LITERAL_STRING(realFaultCodeTagName,"faultcode");
const nsAString& nsSOAPUtils::kFaultCodeTagName = realFaultCodeTagName;
NS_NAMED_LITERAL_STRING(realFaultStringTagName,"faultstring");
const nsAString& nsSOAPUtils::kFaultStringTagName = realFaultStringTagName;
NS_NAMED_LITERAL_STRING(realFaultActorTagName,"faultactor");
const nsAString& nsSOAPUtils::kFaultActorTagName = realFaultActorTagName;
NS_NAMED_LITERAL_STRING(realFaultDetailTagName,"detail");
const nsAString& nsSOAPUtils::kFaultDetailTagName = realFaultDetailTagName;
NS_NAMED_LITERAL_STRING(realEncodingSeparator,"#");
const nsAString& nsSOAPUtils::kEncodingSeparator = realEncodingSeparator;
NS_NAMED_LITERAL_STRING(realQualifiedSeparator,":");
const nsAString& nsSOAPUtils::kQualifiedSeparator = realQualifiedSeparator;
NS_NAMED_LITERAL_STRING(realXMLNamespaceNamespaceURI, "htp://www.w3.org/2000/xmlns/");
const nsAString& nsSOAPUtils::kXMLNamespaceNamespaceURI = realXMLNamespaceNamespaceURI;
NS_NAMED_LITERAL_STRING(realXMLNamespaceURI, "htp://www.w3.org/XML/1998/namespace");
const nsAString& nsSOAPUtils::kXMLNamespaceURI = realXMLNamespaceURI;
NS_NAMED_LITERAL_STRING(realXMLPrefix, "xml:");
const nsAString& nsSOAPUtils::kXMLPrefix = realXMLPrefix;
NS_NAMED_LITERAL_STRING(realXMLNamespacePrefix, "xmlns:");
const nsAString& nsSOAPUtils::kXMLNamespacePrefix = realXMLNamespacePrefix;
NS_NAMED_LITERAL_STRING(realTrue, "true");
const nsAString& nsSOAPUtils::kTrue = realTrue;
NS_NAMED_LITERAL_STRING(realFalse, "false");
const nsAString& nsSOAPUtils::kFalse = realFalse;
NS_NAMED_LITERAL_STRING(realTrueA, "1");
const nsAString& nsSOAPUtils::kTrueA = realTrueA;
NS_NAMED_LITERAL_STRING(realFalseA, "0");
const nsAString& nsSOAPUtils::kFalseA = realFalseA;
void
nsSOAPUtils::GetSpecificChildElement(
nsIDOMElement *aParent,
const nsAReadableString& aNamespace,
const nsAReadableString& aType,
const nsAString& aNamespace,
const nsAString& aType,
nsIDOMElement * *aElement)
{
nsCOMPtr<nsIDOMElement> sibling;
@ -112,8 +142,8 @@ nsSOAPUtils::GetSpecificChildElement(
void
nsSOAPUtils::GetSpecificSiblingElement(
nsIDOMElement *aSibling,
const nsAReadableString& aNamespace,
const nsAReadableString& aType,
const nsAString& aNamespace,
const nsAString& aType,
nsIDOMElement * *aElement)
{
nsCOMPtr<nsIDOMElement> sibling;
@ -178,7 +208,7 @@ nsSOAPUtils::GetNextSiblingElement(nsIDOMElement* aStart,
nsresult
nsSOAPUtils::GetElementTextContent(nsIDOMElement* aElement,
nsAWritableString& aText)
nsAString& aText)
{
nsCOMPtr<nsIDOMNode> child;
nsAutoString rtext;
@ -260,8 +290,8 @@ nsSOAPUtils::GetNextSibling(nsIDOMNode* aSibling, nsIDOMNode **aNext)
NS_IF_ADDREF(*aNext);
}
nsresult nsSOAPUtils::GetNamespaceURI(nsIDOMElement* aScope,
const nsAReadableString & aQName,
nsAWritableString & aURI)
const nsAString & aQName,
nsAString & aURI)
{
aURI.Truncate(0);
PRInt32 i = aQName.FindChar(':');
@ -297,8 +327,8 @@ nsresult nsSOAPUtils::GetNamespaceURI(nsIDOMElement* aScope,
return NS_ERROR_FAILURE;
}
nsresult nsSOAPUtils::GetLocalName(const nsAReadableString & aQName,
nsAWritableString & aLocalName)
nsresult nsSOAPUtils::GetLocalName(const nsAString & aQName,
nsAString & aLocalName)
{
PRInt32 i = aQName.FindChar(':');
if (i < 0)
@ -310,8 +340,8 @@ nsresult nsSOAPUtils::GetLocalName(const nsAReadableString & aQName,
nsresult
nsSOAPUtils::MakeNamespacePrefix(nsIDOMElement* aScope,
const nsAReadableString & aURI,
nsAWritableString & aPrefix)
const nsAString & aURI,
nsAString & aPrefix)
{
// This may change for level 3 serialization, so be sure to gut this
// and call the standardized level 3 method when it is available.
@ -427,8 +457,8 @@ nsSOAPUtils::MakeNamespacePrefix(nsIDOMElement* aScope,
nsresult
nsSOAPUtils::MakeNamespacePrefixFixed(nsIDOMElement* aScope,
const nsAReadableString & aURI,
nsAWritableString & aPrefix)
const nsAString & aURI,
nsAString & aPrefix)
{
if (aURI.Equals(kSOAPEncodingURI))
aPrefix = kSOAPEncodingPrefix;
@ -444,8 +474,8 @@ nsSOAPUtils::MakeNamespacePrefixFixed(nsIDOMElement* aScope,
return NS_OK;
}
PRBool nsSOAPUtils::StartsWith(nsAReadableString& aSuper,
nsAReadableString& aSub)
PRBool nsSOAPUtils::StartsWith(nsAString& aSuper,
nsAString& aSub)
{
PRUint32 c1 = aSuper.Length();
PRUint32 c2 = aSub.Length();
@ -462,3 +492,4 @@ PRBool nsSOAPUtils::StartsWith(nsAReadableString& aSuper,
}
return PR_TRUE;
}

View File

@ -29,39 +29,39 @@
class nsSOAPUtils {
public:
static void GetSpecificChildElement(nsIDOMElement *aParent,
const nsAReadableString& aNamespace,
const nsAReadableString& aType,
const nsAString& aNamespace,
const nsAString& aType,
nsIDOMElement * *aElement);
static void GetSpecificSiblingElement(nsIDOMElement *aSibling,
const nsAReadableString& aNamespace,
const nsAReadableString& aType,
const nsAString& aNamespace,
const nsAString& aType,
nsIDOMElement * *aElement);
static void GetFirstChildElement(nsIDOMElement* aParent,
nsIDOMElement** aElement);
static void GetNextSiblingElement(nsIDOMElement* aStart,
nsIDOMElement** aElement);
static nsresult GetElementTextContent(nsIDOMElement* aElement,
nsAWritableString& aText);
nsAString& aText);
static PRBool HasChildElements(nsIDOMElement* aElement);
static void GetNextSibling(nsIDOMNode* aSibling,
nsIDOMNode **aNext);
static nsresult MakeNamespacePrefix(nsIDOMElement* aElement,
const nsAReadableString & aURI,
nsAWritableString & aPrefix);
const nsAString & aURI,
nsAString & aPrefix);
static nsresult MakeNamespacePrefixFixed(nsIDOMElement* aElement,
const nsAReadableString & aURI,
nsAWritableString & aPrefix);
const nsAString & aURI,
nsAString & aPrefix);
static nsresult GetNamespaceURI(nsIDOMElement* aElement,
const nsAReadableString & aQName,
nsAWritableString & aURI);
static nsresult GetLocalName(const nsAReadableString & aQName,
nsAWritableString & aLocalName);
const nsAString & aQName,
nsAString & aURI);
static nsresult GetLocalName(const nsAString & aQName,
nsAString & aLocalName);
// All those missing string functions have to come from somewhere...
static PRBool StartsWith(nsAReadableString& aSuper,
nsAReadableString& aSub);
static PRBool StartsWith(nsAString& aSuper,
nsAString& aSub);
static const nsAString& kSOAPEnvURI;
static const nsAString& kSOAPEncodingURI;
static const nsAString& kSOAPEnvPrefix;
@ -98,12 +98,12 @@ public:
// Used to support null strings.
inline PRBool AStringIsNull(const nsAReadableString& aString)
inline PRBool AStringIsNull(const nsAString& aString)
{
return aString.IsVoid() || aString.IsEmpty(); // Get rid of empty hack when string implementations support.
}
inline void SetAStringToNull(nsAWritableString& aString)
inline void SetAStringToNull(nsAString& aString)
{
aString.Truncate();
aString.SetIsVoid(PR_TRUE);
@ -112,5 +112,11 @@ inline void SetAStringToNull(nsAWritableString& aString)
#define NS_SOAP_ENSURE_ARG_STRING(arg) \
NS_ENSURE_FALSE(AStringIsNull(arg), NS_ERROR_INVALID_ARG)
inline void SOAPEncodingKey(const nsAString& aURI, const nsAString& aType, nsAString& result)
{
result.Assign(aURI);
result.Append(nsSOAPUtils::kEncodingSeparator);
result.Append(aType);
}
#endif

View File

@ -78,56 +78,40 @@ interface nsISOAPEncoding : nsISupports {
/**
* Set an encoder in the encoding.
*
* @param aSchemaNamespaceURI The schema namespace URI to serve as key.
*
* @param aSchemaType The schema type to serve as key.
* @param aKey The key to be associated with the encoder.
*
* @param aEncoder The encoder to be specified or null to eliminate
* the encoder.
*
* @return Old encoder registered under that type in the encoding, which
* should be kept by the new encoder if it is to be called back.
*/
void setEncoder(in AString aSchemaNamespaceURI, in AString aSchemaType,
in nsISOAPEncoder aEncoder);
void setEncoder(in AString aKey, in nsISOAPEncoder aEncoder);
/**
* Get an encoder from the encoding.
*
* @param aSchemaNamespaceURI The schema namespace URI to serve as key.
*
* @param aSchemaType The schema type to serve as key.
* @param aKey The key to be used to look up the encoder.
*
* @return The encoder.
*/
nsISOAPEncoder getEncoder(in AString aSchemaNamespaceURI, in AString aSchemaType);
nsISOAPEncoder getEncoder(in AString aKey);
/**
* Set a decoder in the encoding.
*
* @param aSchemaNamespaceURI The schema namespace URI to serve as key.
*
* @param aSchemaType The schema type to serve as key.
* @param aKey The key to be associated with the decoder.
*
* @param aDecoder The decoder to be specified or null to eliminate
* the decoder.
*
* @return Old decoder registered under that type in the encoding, which
* should be kept by the new decoder if it is to be called back.
*/
void setDecoder(in AString aSchemaNamespaceURI, in AString aSchemaType,
in nsISOAPDecoder aDecoder);
void setDecoder(in AString aKey, in nsISOAPDecoder aDecoder);
/**
* Get a decoder from the encoding.
*
* @param aSchemaNamespaceURI The schema namespace URI to serve as key.
*
* @param aSchemaType The schema type to serve as key.
* @param aKey The key to be used to look up the decoder.
*
* @return The decoder.
*/
nsISOAPDecoder getDecoder(in AString aSchemaNamespaceURI, in AString aSchemaType);
nsISOAPDecoder getDecoder(in AString aKey);
/**
* The default encoder invoked by all encoding calls. Appropriate calls

View File

@ -134,10 +134,13 @@ DECLARE_ENCODER(UnsignedByte)
#define REGISTER_ENCODER(name) \
{\
ns##name##Encoder *handler = new ns##name##Encoder();\
SetEncoder(nsSOAPUtils::kXSURI, k##name##SchemaType, handler); \
SetEncoder(nsSOAPUtils::kXSDURI, k##name##SchemaType, handler); \
SetDecoder(nsSOAPUtils::kXSURI, k##name##SchemaType, handler); \
SetDecoder(nsSOAPUtils::kXSDURI, k##name##SchemaType, handler); \
nsAutoString encodingKey;\
SOAPEncodingKey(nsSOAPUtils::kXSURI, k##name##SchemaType, encodingKey);\
SetEncoder(encodingKey, handler); \
SetDecoder(encodingKey, handler); \
SOAPEncodingKey(nsSOAPUtils::kXSDURI, k##name##SchemaType, encodingKey);\
SetEncoder(encodingKey, handler); \
SetDecoder(encodingKey, handler); \
}
nsDefaultSOAPEncoder::nsDefaultSOAPEncoder(): nsSOAPEncoding(nsSOAPUtils::kSOAPEncodingURI, nsnull, nsnull)
@ -151,8 +154,10 @@ nsDefaultSOAPEncoder::nsDefaultSOAPEncoder(): nsSOAPEncoding(nsSOAPUtils::kSOAPE
REGISTER_ENCODER(AnySimpleType)
{
nsArrayEncoder *handler = new nsArrayEncoder();
SetEncoder(nsSOAPUtils::kSOAPEncodingURI, kArraySOAPType, handler);
SetDecoder(nsSOAPUtils::kSOAPEncodingURI, kArraySOAPType, handler);
nsAutoString encodingKey;
SOAPEncodingKey(nsSOAPUtils::kSOAPEncodingURI, kArraySOAPType, encodingKey);
SetEncoder(encodingKey, handler);
SetDecoder(encodingKey, handler);
}
REGISTER_ENCODER(String)
REGISTER_ENCODER(Boolean)
@ -169,9 +174,9 @@ nsDefaultSOAPEncoder::nsDefaultSOAPEncoder(): nsSOAPEncoding(nsSOAPUtils::kSOAPE
}
// Here is the implementation of the encoders.
static nsresult EncodeSimpleValue(
const nsAReadableString & aValue,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aValue,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsIDOMElement* aDestination,
nsIDOMElement** _retval)
{
@ -199,8 +204,8 @@ static nsresult EncodeSimpleValue(
NS_IMETHODIMP nsDefaultEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -212,11 +217,13 @@ NS_IMETHODIMP nsDefaultEncoder::Encode(nsISOAPEncoding* aEncoding,
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;
rc = aEncoding->GetEncoder(schemaURI, schemaType, getter_AddRefs(encoder));
SOAPEncodingKey(schemaURI, schemaType, encodingKey);
rc = aEncoding->GetEncoder(encodingKey, getter_AddRefs(encoder));
if (NS_FAILED(rc)) return rc;
if (encoder) break;
PRUint16 typevalue;
@ -240,14 +247,14 @@ NS_IMETHODIMP nsDefaultEncoder::Encode(nsISOAPEncoding* aEncoding,
else {
typevalue = nsISchemaType::SCHEMA_TYPE_COMPLEX;
}
nsAutoString schemaType;
nsAutoString encodingKey;
if (typevalue == nsISchemaType::SCHEMA_TYPE_COMPLEX) {
schemaType.Assign(kAnyTypeSchemaType);
SOAPEncodingKey(nsSOAPUtils::kXSDURI, kAnyTypeSchemaType, encodingKey);
}
else {
schemaType.Assign(kAnySimpleTypeSchemaType);
SOAPEncodingKey(nsSOAPUtils::kXSDURI, kAnySimpleTypeSchemaType, encodingKey);
}
nsresult rc = aEncoding->GetEncoder(nsSOAPUtils::kXSDURI, schemaType, getter_AddRefs(encoder));
nsresult rc = aEncoding->GetEncoder(encodingKey, getter_AddRefs(encoder));
if (NS_FAILED(rc)) return rc;
}
if (encoder) {
@ -256,10 +263,11 @@ NS_IMETHODIMP nsDefaultEncoder::Encode(nsISOAPEncoding* aEncoding,
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsAnyTypeEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -370,7 +378,9 @@ NS_IMETHODIMP nsAnyTypeEncoder::Encode(nsISOAPEncoding* aEncoding,
}
if (!nativeSchemaType.IsEmpty()) {
nsCOMPtr<nsISOAPEncoder> encoder;
nsresult rc = aEncoding->GetEncoder(nativeSchemaURI, nativeSchemaType, getter_AddRefs(encoder));
nsAutoString encodingKey;
SOAPEncodingKey(nativeSchemaURI, nativeSchemaType, encodingKey);
nsresult rc = aEncoding->GetEncoder(encodingKey, getter_AddRefs(encoder));
if (NS_FAILED(rc)) return rc;
if (encoder) {
nsresult rc = encoder->Encode(aEncoding, aSource, aNamespaceURI, aName, aSchemaType, aAttachments, aDestination, aReturnValue);
@ -397,8 +407,8 @@ NS_IMETHODIMP nsAnyTypeEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsAnySimpleTypeEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -426,8 +436,8 @@ NS_IMETHODIMP nsAnySimpleTypeEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsArrayEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -534,8 +544,8 @@ NS_IMETHODIMP nsArrayEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsStringEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -563,8 +573,8 @@ NS_IMETHODIMP nsStringEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsBooleanEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -592,8 +602,8 @@ NS_IMETHODIMP nsBooleanEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsDoubleEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -626,8 +636,8 @@ NS_IMETHODIMP nsDoubleEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsFloatEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -660,8 +670,8 @@ NS_IMETHODIMP nsFloatEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsLongEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -694,8 +704,8 @@ NS_IMETHODIMP nsLongEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsIntEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -728,8 +738,8 @@ NS_IMETHODIMP nsIntEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsShortEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -762,8 +772,8 @@ NS_IMETHODIMP nsShortEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsByteEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -796,8 +806,8 @@ NS_IMETHODIMP nsByteEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsUnsignedLongEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -830,8 +840,8 @@ NS_IMETHODIMP nsUnsignedLongEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsUnsignedIntEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -864,8 +874,8 @@ NS_IMETHODIMP nsUnsignedIntEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsUnsignedShortEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -898,8 +908,8 @@ NS_IMETHODIMP nsUnsignedShortEncoder::Encode(nsISOAPEncoding* aEncoding,
NS_IMETHODIMP nsUnsignedByteEncoder::Encode(nsISOAPEncoding* aEncoding,
nsIVariant* aSource,
const nsAReadableString & aNamespaceURI,
const nsAReadableString & aName,
const nsAString & aNamespaceURI,
const nsAString & aName,
nsISchemaType *aSchemaType,
nsISOAPAttachments* aAttachments,
nsIDOMElement* aDestination,
@ -985,7 +995,9 @@ NS_IMETHODIMP nsDefaultEncoder::Decode(nsISOAPEncoding* aEncoding,
if (NS_FAILED(rc)) return rc;
rc = lookupType->GetTargetNamespace(schemaURI);
if (NS_FAILED(rc)) return rc;
rc = aEncoding->GetDecoder(schemaURI, schemaType, getter_AddRefs(decoder));
nsAutoString encodingKey;
SOAPEncodingKey(schemaURI, schemaType, encodingKey);
rc = aEncoding->GetDecoder(encodingKey, getter_AddRefs(decoder));
if (NS_FAILED(rc)) return rc;
if (decoder) break;
PRUint16 typevalue;
@ -1009,14 +1021,14 @@ NS_IMETHODIMP nsDefaultEncoder::Decode(nsISOAPEncoding* aEncoding,
else {
typevalue = nsISchemaType::SCHEMA_TYPE_COMPLEX;
}
nsAutoString schemaType;
nsAutoString encodingKey;
if (typevalue == nsISchemaType::SCHEMA_TYPE_COMPLEX) {
schemaType.Assign(kAnyTypeSchemaType);
SOAPEncodingKey(nsSOAPUtils::kXSDURI, kAnyTypeSchemaType, encodingKey);
}
else {
schemaType.Assign(kAnySimpleTypeSchemaType);
SOAPEncodingKey(nsSOAPUtils::kXSDURI, kAnySimpleTypeSchemaType, encodingKey);
}
nsresult rc = aEncoding->GetDecoder(nsSOAPUtils::kXSDURI, schemaType, getter_AddRefs(decoder));
nsresult rc = aEncoding->GetDecoder(encodingKey, getter_AddRefs(decoder));
if (NS_FAILED(rc)) return rc;
}
if (decoder) {

View File

@ -48,7 +48,7 @@ NS_IMPL_ISUPPORTS3(nsSOAPBlock,
nsIJSNativeInitializer)
/* attribute AString namespaceURI; */
NS_IMETHODIMP nsSOAPBlock::GetNamespaceURI(nsAWritableString & aNamespaceURI)
NS_IMETHODIMP nsSOAPBlock::GetNamespaceURI(nsAString & aNamespaceURI)
{
NS_ENSURE_ARG_POINTER(&aNamespaceURI);
if (mElement) {
@ -59,7 +59,7 @@ NS_IMETHODIMP nsSOAPBlock::GetNamespaceURI(nsAWritableString & aNamespaceURI)
}
return NS_OK;
}
NS_IMETHODIMP nsSOAPBlock::SetNamespaceURI(const nsAReadableString & aNamespaceURI)
NS_IMETHODIMP nsSOAPBlock::SetNamespaceURI(const nsAString & aNamespaceURI)
{
nsresult rc = SetElement(nsnull);
if (NS_FAILED(rc)) return rc;
@ -68,7 +68,7 @@ NS_IMETHODIMP nsSOAPBlock::SetNamespaceURI(const nsAReadableString & aNamespaceU
}
/* attribute AString name; */
NS_IMETHODIMP nsSOAPBlock::GetName(nsAWritableString & aName)
NS_IMETHODIMP nsSOAPBlock::GetName(nsAString & aName)
{
NS_ENSURE_ARG_POINTER(&aName);
if (mElement) {
@ -79,7 +79,7 @@ NS_IMETHODIMP nsSOAPBlock::GetName(nsAWritableString & aName)
}
return NS_OK;
}
NS_IMETHODIMP nsSOAPBlock::SetName(const nsAReadableString & aName)
NS_IMETHODIMP nsSOAPBlock::SetName(const nsAString & aName)
{
nsresult rc = SetElement(nsnull);
if (NS_FAILED(rc)) return rc;

View File

@ -52,13 +52,13 @@ NS_IMPL_QUERY_CLASSINFO(nsSOAPCall)
NS_INTERFACE_MAP_END_INHERITING(nsSOAPMessage)
/* attribute DOMString transportURI; */
NS_IMETHODIMP nsSOAPCall::GetTransportURI(nsAWritableString & aTransportURI)
NS_IMETHODIMP nsSOAPCall::GetTransportURI(nsAString & aTransportURI)
{
NS_ENSURE_ARG_POINTER(&aTransportURI);
aTransportURI.Assign(mTransportURI);
return NS_OK;
}
NS_IMETHODIMP nsSOAPCall::SetTransportURI(const nsAReadableString & aTransportURI)
NS_IMETHODIMP nsSOAPCall::SetTransportURI(const nsAString & aTransportURI)
{
mTransportURI.Assign(aTransportURI);
return NS_OK;

View File

@ -102,26 +102,26 @@ NS_IMETHODIMP nsSOAPEncodingRegistry::GetStyleURI(nsAString & aStyleURI)
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsISOAPEncoder setEncoder (in AString aSchemaNamespaceURI, in AString aSchemaType, in nsISOAPEncoder aEncoder); */
NS_IMETHODIMP nsSOAPEncodingRegistry::SetEncoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPEncoder *aEncoder)
/* nsISOAPEncoder setEncoder (in AString aKey, in nsISOAPEncoder aEncoder); */
NS_IMETHODIMP nsSOAPEncodingRegistry::SetEncoder(const nsAString & aKey, nsISOAPEncoder *aEncoder)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsISOAPEncoder getEncoder (in AString aSchemaNamespaceURI, in AString aSchemaType); */
NS_IMETHODIMP nsSOAPEncodingRegistry::GetEncoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPEncoder **_retval)
/* nsISOAPEncoder getEncoder (in AString aKey); */
NS_IMETHODIMP nsSOAPEncodingRegistry::GetEncoder(const nsAString & aKey, nsISOAPEncoder **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsISOAPDecoder setDecoder (in AString aSchemaNamespaceURI, in AString aSchemaType, in nsISOAPDecoder aDecoder); */
NS_IMETHODIMP nsSOAPEncodingRegistry::SetDecoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPDecoder *aDecoder)
/* nsISOAPDecoder setDecoder (in AString aKey, in nsISOAPDecoder aDecoder); */
NS_IMETHODIMP nsSOAPEncodingRegistry::SetDecoder(const nsAString & aKey, nsISOAPDecoder *aDecoder)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsISOAPDecoder getDecoder (in AString aSchemaNamespaceURI, in AString aSchemaType); */
NS_IMETHODIMP nsSOAPEncodingRegistry::GetDecoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPDecoder **_retval)
/* nsISOAPDecoder getDecoder (in AString aKey); */
NS_IMETHODIMP nsSOAPEncodingRegistry::GetDecoder(const nsAString & aKey, nsISOAPDecoder **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -220,16 +220,12 @@ NS_IMETHODIMP nsSOAPEncoding::GetAssociatedEncoding(const nsAString & aStyleURI,
return mRegistry->GetAssociatedEncoding(aStyleURI, aCreateIf, _retval);
}
/* nsISOAPEncoder setEncoder (in AString aSchemaNamespaceURI, in AString aSchemaType, in nsISOAPEncoder aEncoder); */
NS_IMETHODIMP nsSOAPEncoding::SetEncoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPEncoder *aEncoder)
/* nsISOAPEncoder setEncoder (in AString aKey, in nsISOAPEncoder aEncoder); */
NS_IMETHODIMP nsSOAPEncoding::SetEncoder(const nsAString & aKey, nsISOAPEncoder *aEncoder)
{
NS_SOAP_ENSURE_ARG_STRING(aSchemaNamespaceURI);
NS_SOAP_ENSURE_ARG_STRING(aSchemaType);
NS_SOAP_ENSURE_ARG_STRING(aKey);
NS_ENSURE_ARG(aEncoder);
nsAutoString name(aSchemaNamespaceURI);
name.Append(nsSOAPUtils::kEncodingSeparator);
name.Append(aSchemaType);
nsStringKey nameKey(name);
nsStringKey nameKey(aKey);
if (aEncoder) {
mEncoders->Put(&nameKey, aEncoder, nsnull);
}
@ -239,32 +235,25 @@ NS_IMETHODIMP nsSOAPEncoding::SetEncoder(const nsAString & aSchemaNamespaceURI,
return NS_OK;
}
/* nsISOAPEncoder getEncoder (in AString aSchemaNamespaceURI, in AString aSchemaType); */
NS_IMETHODIMP nsSOAPEncoding::GetEncoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPEncoder **_retval)
/* nsISOAPEncoder getEncoder (in AString aKey); */
NS_IMETHODIMP nsSOAPEncoding::GetEncoder(const nsAString & aKey, nsISOAPEncoder **_retval)
{
NS_SOAP_ENSURE_ARG_STRING(aSchemaNamespaceURI);
NS_SOAP_ENSURE_ARG_STRING(aSchemaType);
NS_SOAP_ENSURE_ARG_STRING(aKey);
NS_ENSURE_ARG_POINTER(_retval);
nsAutoString name(aSchemaNamespaceURI);
name.Append(nsSOAPUtils::kEncodingSeparator);
name.Append(aSchemaType);
nsStringKey nameKey(name);
nsStringKey nameKey(aKey);
*_retval = (nsISOAPEncoder*)mEncoders->Get(&nameKey);
if (*_retval == nsnull && mDefaultEncoding != nsnull) {
return mDefaultEncoding->GetEncoder(aSchemaNamespaceURI, aSchemaType, _retval);
return mDefaultEncoding->GetEncoder(aKey, _retval);
}
return NS_OK;
}
/* nsISOAPDecoder setDecoder (in AString aSchemaNamespaceURI, in AString aSchemaType, in nsISOAPDecoder aDecoder); */
NS_IMETHODIMP nsSOAPEncoding::SetDecoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPDecoder *aDecoder)
/* nsISOAPDecoder setDecoder (in AString aKey, in nsISOAPDecoder aDecoder); */
NS_IMETHODIMP nsSOAPEncoding::SetDecoder(const nsAString & aKey, nsISOAPDecoder *aDecoder)
{
NS_SOAP_ENSURE_ARG_STRING(aSchemaNamespaceURI);
NS_SOAP_ENSURE_ARG_STRING(aSchemaType);
nsAutoString name(aSchemaNamespaceURI);
name.Append(nsSOAPUtils::kEncodingSeparator);
name.Append(aSchemaType);
nsStringKey nameKey(name);
NS_SOAP_ENSURE_ARG_STRING(aKey);
NS_ENSURE_ARG(aDecoder);
nsStringKey nameKey(aKey);
if (aDecoder) {
mDecoders->Put(&nameKey, aDecoder, nsnull);
}
@ -274,19 +263,15 @@ NS_IMETHODIMP nsSOAPEncoding::SetDecoder(const nsAString & aSchemaNamespaceURI,
return NS_OK;
}
/* nsISOAPDecoder getDecoder (in AString aSchemaNamespaceURI, in AString aSchemaType); */
NS_IMETHODIMP nsSOAPEncoding::GetDecoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPDecoder **_retval)
/* nsISOAPDecoder getDecoder (in AString aKey); */
NS_IMETHODIMP nsSOAPEncoding::GetDecoder(const nsAString & aKey, nsISOAPDecoder **_retval)
{
NS_SOAP_ENSURE_ARG_STRING(aSchemaNamespaceURI);
NS_SOAP_ENSURE_ARG_STRING(aSchemaType);
NS_SOAP_ENSURE_ARG_STRING(aKey);
NS_ENSURE_ARG_POINTER(_retval);
nsAutoString name(aSchemaNamespaceURI);
name.Append(nsSOAPUtils::kEncodingSeparator);
name.Append(aSchemaType);
nsStringKey nameKey(name);
nsStringKey nameKey(aKey);
*_retval = (nsISOAPDecoder*)mDecoders->Get(&nameKey);
if (*_retval == nsnull && mDefaultEncoding != nsnull) {
return mDefaultEncoding->GetDecoder(aSchemaNamespaceURI, aSchemaType, _retval);
return mDefaultEncoding->GetDecoder(aKey, _retval);
}
return NS_OK;
}

View File

@ -51,7 +51,7 @@ NS_IMETHODIMP nsSOAPFault::GetElement(nsIDOMElement * *aElement)
}
/* readonly attribute wstring faultCode; */
NS_IMETHODIMP nsSOAPFault::GetFaultCode(nsAWritableString & aFaultCode)
NS_IMETHODIMP nsSOAPFault::GetFaultCode(nsAString & aFaultCode)
{
NS_ENSURE_ARG_POINTER(&aFaultCode);
aFaultCode.Truncate();
@ -67,7 +67,7 @@ NS_IMETHODIMP nsSOAPFault::GetFaultCode(nsAWritableString & aFaultCode)
}
/* readonly attribute wstring faultString; */
NS_IMETHODIMP nsSOAPFault::GetFaultString(nsAWritableString & aFaultString)
NS_IMETHODIMP nsSOAPFault::GetFaultString(nsAString & aFaultString)
{
NS_ENSURE_ARG_POINTER(&aFaultString);
@ -82,7 +82,7 @@ NS_IMETHODIMP nsSOAPFault::GetFaultString(nsAWritableString & aFaultString)
}
/* readonly attribute wstring faultActor; */
NS_IMETHODIMP nsSOAPFault::GetFaultActor(nsAWritableString & aFaultActor)
NS_IMETHODIMP nsSOAPFault::GetFaultActor(nsAString & aFaultActor)
{
NS_ENSURE_ARG_POINTER(&aFaultActor);

View File

@ -50,7 +50,7 @@ nsSOAPHeaderBlock::~nsSOAPHeaderBlock()
}
/* attribute AString actorURI; */
NS_IMETHODIMP nsSOAPHeaderBlock::GetActorURI(nsAWritableString & aActorURI)
NS_IMETHODIMP nsSOAPHeaderBlock::GetActorURI(nsAString & aActorURI)
{
NS_ENSURE_ARG_POINTER(&aActorURI);
if (mElement) {
@ -61,7 +61,7 @@ NS_IMETHODIMP nsSOAPHeaderBlock::GetActorURI(nsAWritableString & aActorURI)
}
return NS_OK;
}
NS_IMETHODIMP nsSOAPHeaderBlock::SetActorURI(const nsAReadableString & aActorURI)
NS_IMETHODIMP nsSOAPHeaderBlock::SetActorURI(const nsAString & aActorURI)
{
nsresult rc = SetElement(nsnull);
if (NS_FAILED(rc)) return rc;

View File

@ -127,13 +127,13 @@ NS_IMETHODIMP nsSOAPMessage::GetBody(nsIDOMElement * *aBody)
}
/* attribute DOMString actionURI; */
NS_IMETHODIMP nsSOAPMessage::GetActionURI(nsAWritableString & aActionURI)
NS_IMETHODIMP nsSOAPMessage::GetActionURI(nsAString & aActionURI)
{
NS_ENSURE_ARG_POINTER(&aActionURI);
aActionURI.Assign(mActionURI);
return NS_OK;
}
NS_IMETHODIMP nsSOAPMessage::SetActionURI(const nsAReadableString & aActionURI)
NS_IMETHODIMP nsSOAPMessage::SetActionURI(const nsAString & aActionURI)
{
mActionURI.Assign(aActionURI);
return NS_OK;

View File

@ -27,75 +27,105 @@
NS_NAMED_LITERAL_STRING(realSOAPEnvURI,"http://schemas.xmlsoap.org/soap/envelope/");
const nsAString& nsSOAPUtils::kSOAPEnvURI = realSOAPEnvURI;
NS_NAMED_LITERAL_STRING(realSOAPEncodingURI,"http://schemas.xmlsoap.org/soap/encoding/");
const nsAString& nsSOAPUtils::kSOAPEncodingURI = realSOAPEncodingURI;
NS_NAMED_LITERAL_STRING(realSOAPEnvPrefix,"SOAP-ENV");
const nsAString& nsSOAPUtils::kSOAPEnvPrefix = realSOAPEnvPrefix;
NS_NAMED_LITERAL_STRING(realSOAPEncodingPrefix,"SOAP-ENC");
const nsAString& nsSOAPUtils::kSOAPEncodingPrefix = realSOAPEncodingPrefix;
NS_NAMED_LITERAL_STRING(realXSURI,"http://www.w3.org/2001/XMLSchema");
const nsAString& nsSOAPUtils::kXSURI = realXSURI;
NS_NAMED_LITERAL_STRING(realXSIURI,"http://www.w3.org/2001/XMLSchema-instance");
const nsAString& nsSOAPUtils::kXSIURI = realXSIURI;
NS_NAMED_LITERAL_STRING(realXSDURI,"http://www.w3.org/2001/XMLSchema-datatypes");
const nsAString& nsSOAPUtils::kXSDURI = realXSDURI;
NS_NAMED_LITERAL_STRING(realXSIPrefix,"xsi");
const nsAString& nsSOAPUtils::kXSIPrefix = realXSIPrefix;
NS_NAMED_LITERAL_STRING(realXSITypeAttribute,"type");
const nsAString& nsSOAPUtils::kXSITypeAttribute = realXSITypeAttribute;
NS_NAMED_LITERAL_STRING(realXSPrefix,"xs");
const nsAString& nsSOAPUtils::kXSPrefix = realXSPrefix;
NS_NAMED_LITERAL_STRING(realXSDPrefix,"xsd");
const nsAString& nsSOAPUtils::kXSDPrefix = realXSDPrefix;
NS_NAMED_LITERAL_STRING(realEncodingStyleAttribute,"encodingStyle");
const nsAString& nsSOAPUtils::kEncodingStyleAttribute = realEncodingStyleAttribute;
NS_NAMED_LITERAL_STRING(realActorAttribute,"actor");
const nsAString& nsSOAPUtils::kActorAttribute = realActorAttribute;
NS_NAMED_LITERAL_STRING(realMustUnderstandAttribute,"mustUnderstand");
const nsAString& nsSOAPUtils::kMustUnderstandAttribute = realMustUnderstandAttribute;
NS_NAMED_LITERAL_STRING(realEnvelopeTagName,"Envelope");
const nsAString& nsSOAPUtils::kEnvelopeTagName = realEnvelopeTagName;
NS_NAMED_LITERAL_STRING(realHeaderTagName,"Header");
const nsAString& nsSOAPUtils::kHeaderTagName = realHeaderTagName;
NS_NAMED_LITERAL_STRING(realBodyTagName,"Body");
const nsAString& nsSOAPUtils::kBodyTagName = realBodyTagName;
NS_NAMED_LITERAL_STRING(realFaultTagName,"Fault");
const nsAString& nsSOAPUtils::kFaultTagName = realFaultTagName;
NS_NAMED_LITERAL_STRING(realFaultCodeTagName,"faultcode");
const nsAString& nsSOAPUtils::kFaultCodeTagName = realFaultCodeTagName;
NS_NAMED_LITERAL_STRING(realFaultStringTagName,"faultstring");
const nsAString& nsSOAPUtils::kFaultStringTagName = realFaultStringTagName;
NS_NAMED_LITERAL_STRING(realFaultActorTagName,"faultactor");
const nsAString& nsSOAPUtils::kFaultActorTagName = realFaultActorTagName;
NS_NAMED_LITERAL_STRING(realFaultDetailTagName,"detail");
const nsAString& nsSOAPUtils::kFaultDetailTagName = realFaultDetailTagName;
NS_NAMED_LITERAL_STRING(realEncodingSeparator,"#");
const nsAString& nsSOAPUtils::kEncodingSeparator = realEncodingSeparator;
NS_NAMED_LITERAL_STRING(realQualifiedSeparator,":");
const nsAString& nsSOAPUtils::kQualifiedSeparator = realQualifiedSeparator;
NS_NAMED_LITERAL_STRING(realXMLNamespaceNamespaceURI, "htp://www.w3.org/2000/xmlns/");
const nsAString& nsSOAPUtils::kXMLNamespaceNamespaceURI = realXMLNamespaceNamespaceURI;
NS_NAMED_LITERAL_STRING(realXMLNamespaceURI, "htp://www.w3.org/XML/1998/namespace");
const nsAString& nsSOAPUtils::kXMLNamespaceURI = realXMLNamespaceURI;
NS_NAMED_LITERAL_STRING(realXMLPrefix, "xml:");
const nsAString& nsSOAPUtils::kXMLPrefix = realXMLPrefix;
NS_NAMED_LITERAL_STRING(realXMLNamespacePrefix, "xmlns:");
const nsAString& nsSOAPUtils::kXMLNamespacePrefix = realXMLNamespacePrefix;
NS_NAMED_LITERAL_STRING(realTrue, "true");
const nsAString& nsSOAPUtils::kTrue = realTrue;
NS_NAMED_LITERAL_STRING(realFalse, "false");
const nsAString& nsSOAPUtils::kFalse = realFalse;
NS_NAMED_LITERAL_STRING(realTrueA, "1");
const nsAString& nsSOAPUtils::kTrueA = realTrueA;
NS_NAMED_LITERAL_STRING(realFalseA, "0");
const nsAString& nsSOAPUtils::kFalseA = realFalseA;
void
nsSOAPUtils::GetSpecificChildElement(
nsIDOMElement *aParent,
const nsAReadableString& aNamespace,
const nsAReadableString& aType,
const nsAString& aNamespace,
const nsAString& aType,
nsIDOMElement * *aElement)
{
nsCOMPtr<nsIDOMElement> sibling;
@ -112,8 +142,8 @@ nsSOAPUtils::GetSpecificChildElement(
void
nsSOAPUtils::GetSpecificSiblingElement(
nsIDOMElement *aSibling,
const nsAReadableString& aNamespace,
const nsAReadableString& aType,
const nsAString& aNamespace,
const nsAString& aType,
nsIDOMElement * *aElement)
{
nsCOMPtr<nsIDOMElement> sibling;
@ -178,7 +208,7 @@ nsSOAPUtils::GetNextSiblingElement(nsIDOMElement* aStart,
nsresult
nsSOAPUtils::GetElementTextContent(nsIDOMElement* aElement,
nsAWritableString& aText)
nsAString& aText)
{
nsCOMPtr<nsIDOMNode> child;
nsAutoString rtext;
@ -260,8 +290,8 @@ nsSOAPUtils::GetNextSibling(nsIDOMNode* aSibling, nsIDOMNode **aNext)
NS_IF_ADDREF(*aNext);
}
nsresult nsSOAPUtils::GetNamespaceURI(nsIDOMElement* aScope,
const nsAReadableString & aQName,
nsAWritableString & aURI)
const nsAString & aQName,
nsAString & aURI)
{
aURI.Truncate(0);
PRInt32 i = aQName.FindChar(':');
@ -297,8 +327,8 @@ nsresult nsSOAPUtils::GetNamespaceURI(nsIDOMElement* aScope,
return NS_ERROR_FAILURE;
}
nsresult nsSOAPUtils::GetLocalName(const nsAReadableString & aQName,
nsAWritableString & aLocalName)
nsresult nsSOAPUtils::GetLocalName(const nsAString & aQName,
nsAString & aLocalName)
{
PRInt32 i = aQName.FindChar(':');
if (i < 0)
@ -310,8 +340,8 @@ nsresult nsSOAPUtils::GetLocalName(const nsAReadableString & aQName,
nsresult
nsSOAPUtils::MakeNamespacePrefix(nsIDOMElement* aScope,
const nsAReadableString & aURI,
nsAWritableString & aPrefix)
const nsAString & aURI,
nsAString & aPrefix)
{
// This may change for level 3 serialization, so be sure to gut this
// and call the standardized level 3 method when it is available.
@ -427,8 +457,8 @@ nsSOAPUtils::MakeNamespacePrefix(nsIDOMElement* aScope,
nsresult
nsSOAPUtils::MakeNamespacePrefixFixed(nsIDOMElement* aScope,
const nsAReadableString & aURI,
nsAWritableString & aPrefix)
const nsAString & aURI,
nsAString & aPrefix)
{
if (aURI.Equals(kSOAPEncodingURI))
aPrefix = kSOAPEncodingPrefix;
@ -444,8 +474,8 @@ nsSOAPUtils::MakeNamespacePrefixFixed(nsIDOMElement* aScope,
return NS_OK;
}
PRBool nsSOAPUtils::StartsWith(nsAReadableString& aSuper,
nsAReadableString& aSub)
PRBool nsSOAPUtils::StartsWith(nsAString& aSuper,
nsAString& aSub)
{
PRUint32 c1 = aSuper.Length();
PRUint32 c2 = aSub.Length();
@ -462,3 +492,4 @@ PRBool nsSOAPUtils::StartsWith(nsAReadableString& aSuper,
}
return PR_TRUE;
}

View File

@ -29,39 +29,39 @@
class nsSOAPUtils {
public:
static void GetSpecificChildElement(nsIDOMElement *aParent,
const nsAReadableString& aNamespace,
const nsAReadableString& aType,
const nsAString& aNamespace,
const nsAString& aType,
nsIDOMElement * *aElement);
static void GetSpecificSiblingElement(nsIDOMElement *aSibling,
const nsAReadableString& aNamespace,
const nsAReadableString& aType,
const nsAString& aNamespace,
const nsAString& aType,
nsIDOMElement * *aElement);
static void GetFirstChildElement(nsIDOMElement* aParent,
nsIDOMElement** aElement);
static void GetNextSiblingElement(nsIDOMElement* aStart,
nsIDOMElement** aElement);
static nsresult GetElementTextContent(nsIDOMElement* aElement,
nsAWritableString& aText);
nsAString& aText);
static PRBool HasChildElements(nsIDOMElement* aElement);
static void GetNextSibling(nsIDOMNode* aSibling,
nsIDOMNode **aNext);
static nsresult MakeNamespacePrefix(nsIDOMElement* aElement,
const nsAReadableString & aURI,
nsAWritableString & aPrefix);
const nsAString & aURI,
nsAString & aPrefix);
static nsresult MakeNamespacePrefixFixed(nsIDOMElement* aElement,
const nsAReadableString & aURI,
nsAWritableString & aPrefix);
const nsAString & aURI,
nsAString & aPrefix);
static nsresult GetNamespaceURI(nsIDOMElement* aElement,
const nsAReadableString & aQName,
nsAWritableString & aURI);
static nsresult GetLocalName(const nsAReadableString & aQName,
nsAWritableString & aLocalName);
const nsAString & aQName,
nsAString & aURI);
static nsresult GetLocalName(const nsAString & aQName,
nsAString & aLocalName);
// All those missing string functions have to come from somewhere...
static PRBool StartsWith(nsAReadableString& aSuper,
nsAReadableString& aSub);
static PRBool StartsWith(nsAString& aSuper,
nsAString& aSub);
static const nsAString& kSOAPEnvURI;
static const nsAString& kSOAPEncodingURI;
static const nsAString& kSOAPEnvPrefix;
@ -98,12 +98,12 @@ public:
// Used to support null strings.
inline PRBool AStringIsNull(const nsAReadableString& aString)
inline PRBool AStringIsNull(const nsAString& aString)
{
return aString.IsVoid() || aString.IsEmpty(); // Get rid of empty hack when string implementations support.
}
inline void SetAStringToNull(nsAWritableString& aString)
inline void SetAStringToNull(nsAString& aString)
{
aString.Truncate();
aString.SetIsVoid(PR_TRUE);
@ -112,5 +112,11 @@ inline void SetAStringToNull(nsAWritableString& aString)
#define NS_SOAP_ENSURE_ARG_STRING(arg) \
NS_ENSURE_FALSE(AStringIsNull(arg), NS_ERROR_INVALID_ARG)
inline void SOAPEncodingKey(const nsAString& aURI, const nsAString& aType, nsAString& result)
{
result.Assign(aURI);
result.Append(nsSOAPUtils::kEncodingSeparator);
result.Append(aType);
}
#endif