webservices/wsdescription/src/senxmlservicedescription.cpp
changeset 0 62f9d29f7211
child 1 272b002df977
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:           
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 // INCLUDE FILESS
       
    29 #include <e32base.h>
       
    30 #include <e32des8.h>    // HBufC8
       
    31 
       
    32 #include "SenDateUtils.h"
       
    33 
       
    34 #include "SenXmlServiceDescription.h"
       
    35 #include "SenBaseFragment.h"
       
    36 #include "SenXmlUtils.h"
       
    37 #include "sendebug.h"
       
    38 
       
    39 #include "SenCredential.h"
       
    40 #include "senproviderpolicy.h"
       
    41 #include "senservicepolicy.h"
       
    42 #include "SenFacet.h"
       
    43 #include "SenXmlUtils.h"
       
    44 
       
    45 #include <SenServiceConnection.h> // for KErrSenNoEndpoint
       
    46 
       
    47 
       
    48 namespace
       
    49     {
       
    50     // Local names for XML element: 
       
    51     _LIT8(KServiceDescriptionLocalName, "ServiceDescription");
       
    52     _LIT8(KEndpointLocalname,           "Endpoint");
       
    53     _LIT8(KContractLocalname,           "Contract");
       
    54     _LIT8(KProviderPolicyLocalName,     "ProviderPolicy");
       
    55     _LIT8(KServicePolicyLocalName,      "ServicePolicy");
       
    56     _LIT8(KClientServicePolicyLocalName, "ClientPolicy");
       
    57     _LIT8(KSenIdpProviderIdLocalname,       "ProviderID");
       
    58     // Names for XML attributes:
       
    59     _LIT8(KNotOnOrAfter,                "notOnOrAfter");
       
    60     _LIT8(KFramework,                   "framework");
       
    61     _LIT8(KCue,                         "cue");
       
    62     _LIT8(KTouch, 						"touch");
       
    63     }
       
    64 
       
    65 
       
    66 EXPORT_C CSenXmlServiceDescription* CSenXmlServiceDescription::NewL()
       
    67     {
       
    68     CSenXmlServiceDescription* pNew = NewLC();
       
    69     CleanupStack::Pop();
       
    70     return(pNew) ;
       
    71     }
       
    72 
       
    73 EXPORT_C CSenXmlServiceDescription* CSenXmlServiceDescription::NewLC()
       
    74     {
       
    75     CSenXmlServiceDescription* pNew =
       
    76         new (ELeave) CSenXmlServiceDescription(EXmlServiceDescription);
       
    77     CleanupStack::PushL(pNew);
       
    78     pNew->ConstructL();
       
    79     return pNew;
       
    80     }
       
    81 
       
    82 EXPORT_C void CSenXmlServiceDescription::ConstructL()
       
    83     {
       
    84     BaseConstructL(NewElementName());
       
    85     // Create empty policy
       
    86     iProviderPolicy = CSenProviderPolicy::NewL();
       
    87     CSenElement& element = iProviderPolicy->AsElement();
       
    88     AsElement().AddElementL(element);
       
    89     iServicePolicy = CSenServicePolicy::NewL();
       
    90     CSenElement& servicePolicyElement = iServicePolicy->AsElement();
       
    91     AsElement().AddElementL(servicePolicyElement);
       
    92     }
       
    93 
       
    94 EXPORT_C const TDesC8& CSenXmlServiceDescription::NewElementName()
       
    95     {
       
    96     return KServiceDescriptionLocalName();
       
    97     }
       
    98 
       
    99 EXPORT_C CSenXmlServiceDescription* CSenXmlServiceDescription::NewL(
       
   100                                                 const TDesC8& aNamespaceURI)
       
   101     {
       
   102     CSenXmlServiceDescription* pNew = NewLC(aNamespaceURI);
       
   103     CleanupStack::Pop();
       
   104     return(pNew) ;
       
   105     }
       
   106 
       
   107 EXPORT_C CSenXmlServiceDescription* CSenXmlServiceDescription::NewLC(
       
   108                                                 const TDesC8& aNamespaceURI)
       
   109     {
       
   110     CSenXmlServiceDescription* pNew =
       
   111                 new (ELeave) CSenXmlServiceDescription(EXmlServiceDescription);
       
   112     CleanupStack::PushL(pNew);
       
   113     pNew->ConstructL(aNamespaceURI);
       
   114     return pNew;
       
   115     }
       
   116 
       
   117 EXPORT_C void CSenXmlServiceDescription::ConstructL(const TDesC8& aNamespaceURI)
       
   118     {
       
   119     BaseConstructL(aNamespaceURI, NewElementName());
       
   120     // create empty policy
       
   121     iProviderPolicy = CSenProviderPolicy::NewL();
       
   122     CSenElement& element = iProviderPolicy->AsElement();
       
   123     AsElement().AddElementL(element);
       
   124     iServicePolicy = CSenServicePolicy::NewL();
       
   125     CSenElement& servicePolicyElement = iServicePolicy->AsElement();
       
   126     AsElement().AddElementL(servicePolicyElement);
       
   127     }
       
   128 
       
   129 EXPORT_C CSenXmlServiceDescription* CSenXmlServiceDescription::NewL(
       
   130                                                     const TDesC8& aEndPoint,
       
   131                                                     const TDesC8& aContract)
       
   132     {
       
   133     CSenXmlServiceDescription* pNew = NewLC(aEndPoint, aContract);
       
   134     CleanupStack::Pop();
       
   135     return(pNew) ;
       
   136     }
       
   137 
       
   138 EXPORT_C CSenXmlServiceDescription* CSenXmlServiceDescription::NewLC(
       
   139                                                      const TDesC8& aEndPoint,
       
   140                                                      const TDesC8& aContract)
       
   141     {
       
   142     CSenXmlServiceDescription* pNew =
       
   143         new (ELeave) CSenXmlServiceDescription(EXmlServiceDescription);
       
   144     CleanupStack::PushL(pNew);
       
   145     pNew->ConstructL(aEndPoint, aContract);
       
   146     return pNew;
       
   147     }
       
   148 
       
   149 EXPORT_C void CSenXmlServiceDescription::ConstructL(const TDesC8& aEndPoint,
       
   150                                                     const TDesC8& aContract)
       
   151     {
       
   152     BaseConstructL(NewElementName());
       
   153     if(aEndPoint.Length()>0)
       
   154         {
       
   155         SetContentOfL(KEndpointLocalname, aEndPoint);
       
   156         }
       
   157 
       
   158     if(aContract.Length()>0)
       
   159         {
       
   160         SetContentOfL(KContractLocalname, aContract);
       
   161         }
       
   162     // create empty policy
       
   163     iProviderPolicy = CSenProviderPolicy::NewL();
       
   164     CSenElement& element = iProviderPolicy->AsElement();
       
   165     AsElement().AddElementL(element);
       
   166     iServicePolicy = CSenServicePolicy::NewL();
       
   167     CSenElement& servicePolicyElement = iServicePolicy->AsElement();
       
   168     AsElement().AddElementL(servicePolicyElement);
       
   169     }
       
   170 
       
   171 
       
   172 EXPORT_C CSenXmlServiceDescription::CSenXmlServiceDescription(
       
   173                                                 TDescriptionClassType aType)
       
   174 :   
       
   175     iType(aType),
       
   176     iServicePolicy(NULL),   
       
   177     iCredential(NULL),
       
   178     iNotOnOrAfter(Time::NullTTime()), // sets this session to be valid if read from db
       
   179     iProviderPolicy(NULL)
       
   180     
       
   181     {
       
   182     }
       
   183 
       
   184 EXPORT_C CSenXmlServiceDescription::~CSenXmlServiceDescription()
       
   185     {
       
   186     // Bugfix 2004-07-27
       
   187     if(iCredential)
       
   188         {
       
   189         TInt index(KErrNotFound);
       
   190         index = iCredentialList.Find(iCredential);
       
   191         if(index==KErrNotFound)
       
   192             {
       
   193             delete iCredential; // otherwise deleted by ResetAndDestroy()
       
   194             }
       
   195         }
       
   196 
       
   197 
       
   198     iCredentialList.ResetAndDestroy(); // owns
       
   199 
       
   200     if( iProviderPolicy )
       
   201         {
       
   202         iProviderPolicy->ExtractElement();
       
   203         }    
       
   204     delete iProviderPolicy;
       
   205      if( iServicePolicy )
       
   206         {
       
   207         iServicePolicy->ExtractElement();
       
   208         }
       
   209          delete iServicePolicy;            
       
   210     }
       
   211 
       
   212 EXPORT_C MSenServiceDescription::TDescriptionClassType
       
   213                             CSenXmlServiceDescription::DescriptionClassType()
       
   214     {
       
   215     return iType;
       
   216     }
       
   217 
       
   218 
       
   219 EXPORT_C void CSenXmlServiceDescription::SetAttributesL(const RAttributeArray& aAttributes)
       
   220     {
       
   221     // Call superclass for namespace attributes only
       
   222     CSenBaseFragment::SetAttributesL(aAttributes); 
       
   223 
       
   224     // SenXmlUtils::AttrValue returns KNullDesC8 if attribute is not found:
       
   225     const TDesC8& id = SenXmlUtils::AttrValue(aAttributes, KFramework);
       
   226     if( id.Length()>0 )
       
   227         {
       
   228         // Add real attribute for ServiceDescription -element. If "framework"
       
   229         // attribute already exists, it's value will be overwritten:
       
   230         SenXmlUtils::AddAttributeL(AsElement(), KFramework, id); 
       
   231         }
       
   232     const TDesC8& touch = SenXmlUtils::AttrValue(aAttributes, KTouch);
       
   233     if( touch.Length()>0 )
       
   234         {
       
   235         // Add touch attribute for ServiceDescription -element. If "touch"
       
   236         // attribute already exists, it's value will be overwritten:
       
   237 
       
   238         CSenElement* elem = &AsElement();
       
   239         elem->AddAttrL(KTouch, touch);
       
   240         
       
   241         }
       
   242     const TDesC8& userInfoPrompt = SenXmlUtils::AttrValue(aAttributes, KSenAttrPromptUserInfo);
       
   243     if( userInfoPrompt.Length() > 0 )
       
   244         {
       
   245         SenXmlUtils::AddAttributeL(AsElement(), KSenAttrPromptUserInfo, userInfoPrompt ); 
       
   246         }
       
   247     }
       
   248 
       
   249 EXPORT_C RCredentialList& CSenXmlServiceDescription::Credentials()
       
   250     {
       
   251     return iCredentialList;
       
   252     }
       
   253 
       
   254 EXPORT_C TBool CSenXmlServiceDescription::Matches( MSenServiceDescription& aOtherServiceDescription )
       
   255     {
       
   256     TPtrC8 patternEndpoint = aOtherServiceDescription.Endpoint();
       
   257     TPtrC8 thisEndpoint = Endpoint();
       
   258 
       
   259     if(patternEndpoint.Length()>0)
       
   260         {
       
   261         if(!(thisEndpoint.Length()>0 && patternEndpoint == thisEndpoint))
       
   262             {
       
   263             return EFalse;
       
   264             }
       
   265         }
       
   266 
       
   267     TPtrC8 patternContract = aOtherServiceDescription.Contract();
       
   268     TPtrC8 thisContract = Contract();
       
   269 
       
   270     if(patternContract.Length()>0)
       
   271         {
       
   272         if(!(thisContract.Length()>0 && patternContract == thisContract))
       
   273             {
       
   274             return EFalse;
       
   275             }
       
   276         }
       
   277 		
       
   278     TBool match(ETrue);
       
   279     
       
   280 		TRAPD(retVal,
       
   281 		    RFacetArray otherFacets;
       
   282 		    CleanupClosePushL(otherFacets);
       
   283 		    aOtherServiceDescription.FacetsL(otherFacets);
       
   284 		
       
   285 		    TPtrC8 facetName;
       
   286 		    TInt leave(KErrNone);
       
   287 		    TInt count(otherFacets.Count());
       
   288 		    for (TInt i=0; i<count && match; i++)
       
   289 		        {
       
   290 		        facetName.Set(otherFacets[i]->Name());
       
   291 		        TRAP( leave, HasFacetL(facetName, match); )
       
   292 		        }
       
   293 		    otherFacets.ResetAndDestroy();
       
   294 		    CleanupStack::Pop(); // otherFacets
       
   295 				);
       
   296 				
       
   297     return match;
       
   298     }
       
   299 
       
   300 
       
   301 EXPORT_C TPtrC8 CSenXmlServiceDescription::Contract()
       
   302     {
       
   303     return ContentOf(KContractLocalname());
       
   304     }
       
   305 
       
   306 
       
   307 EXPORT_C TPtrC8 CSenXmlServiceDescription::Endpoint()
       
   308     {
       
   309     return ContentOf(KEndpointLocalname());
       
   310     }
       
   311 
       
   312 EXPORT_C TPtrC8 CSenXmlServiceDescription::FrameworkId()
       
   313     {
       
   314     const TDesC8* value = AsElement().AttrValue(KFramework);
       
   315     if(value)
       
   316         {
       
   317         return *value;
       
   318         }
       
   319     else
       
   320         {
       
   321         return KNullDesC8();
       
   322         }
       
   323     }
       
   324 
       
   325 EXPORT_C TPtrC8 CSenXmlServiceDescription::FrameworkVersion()
       
   326     {
       
   327     return KNullDesC8();
       
   328     }
       
   329 
       
   330 EXPORT_C void CSenXmlServiceDescription::SetContractL(const TDesC8& aContract)
       
   331     {
       
   332     SetContentOfL(KContractLocalname(), aContract);
       
   333     }
       
   334 
       
   335 
       
   336 EXPORT_C void CSenXmlServiceDescription::SetEndPointL(const TDesC8& aEndPoint)
       
   337     {
       
   338     SetContentOfL(KEndpointLocalname(), aEndPoint);
       
   339     }
       
   340 
       
   341 EXPORT_C void CSenXmlServiceDescription::SetFrameworkIdL(const TDesC8& aFrameworkId)
       
   342     {
       
   343     if ( aFrameworkId != KNullDesC8 )
       
   344         {
       
   345         // overwrites the value of "framework" attribute, if such attribute exists
       
   346         SenXmlUtils::AddAttributeL(AsElement(), KFramework, aFrameworkId);
       
   347         }
       
   348     else
       
   349         {
       
   350         // If there would not have been RemoveAttributeL() method, 
       
   351         // then AddAtributeL(KNullDesC8) could have been used
       
   352         delete SenXmlUtils::RemoveAttributeL(AsElement(), KFramework);
       
   353         }
       
   354     }
       
   355 
       
   356 EXPORT_C HBufC8* CSenXmlServiceDescription::AsXmlL()
       
   357     {
       
   358     return AsElement().AsXmlL();
       
   359     }
       
   360 
       
   361 EXPORT_C HBufC* CSenXmlServiceDescription::AsXmlUnicodeL()
       
   362     {
       
   363     return AsElement().AsXmlUnicodeL();
       
   364     }
       
   365 
       
   366 EXPORT_C void CSenXmlServiceDescription::WriteAsXMLToL(RWriteStream& aWriteStream)
       
   367     {
       
   368     AsElement().WriteAsXMLToL(aWriteStream);
       
   369     }
       
   370 
       
   371 
       
   372 EXPORT_C void CSenXmlServiceDescription::StartElementL(const TDesC8& aNsUri,
       
   373                                                        const TDesC8& aLocalName,
       
   374                                                        const TDesC8& aQName,
       
   375                                                        const RAttributeArray& aAttributes)
       
   376     {
       
   377 
       
   378     switch (iState)
       
   379         {
       
   380         case KStateSave: // IOP(!)
       
   381             {
       
   382             if(aLocalName.Compare(KCredentialsName) == 0)
       
   383                 {
       
   384                 iState = KStateParsingCredentials;
       
   385 
       
   386                 TPtrC8 attValue = SenXmlUtils::AttrValue(aAttributes, 
       
   387                                                     KNotOnOrAfter);
       
   388                 if(attValue.Length()>0)
       
   389                     {
       
   390                     iNotOnOrAfter = SenDateUtils::FromXmlDateTimeL(attValue);
       
   391                     }
       
   392                 }
       
   393             else if(aLocalName.Compare(KProviderPolicyLocalName) == 0)
       
   394                 {
       
   395                 iState = KStateParsingProviderPolicy;
       
   396                 
       
   397                 TPtrC8 prefix(KNullDesC8);
       
   398                 if(aQName.Length()>0)
       
   399                     {
       
   400                     TInt colon = aQName.Locate(':');
       
   401                     if(colon>0) // Note: 0 also treated as no prefix
       
   402                         {
       
   403                         prefix.Set(aQName.Ptr(), colon);
       
   404                         }
       
   405                     }
       
   406                 iProviderPolicy->AsElement().SetNamespaceL(prefix, aNsUri);
       
   407 
       
   408                 DelegateParsingL(*iProviderPolicy);
       
   409                 }
       
   410              else if(aLocalName.Compare(KServicePolicyLocalName) == 0)
       
   411                 {
       
   412                 iState = KStateParsingServicePolicy;
       
   413                 
       
   414                 TPtrC8 prefix(KNullDesC8);
       
   415                 if(aQName.Length()>0)
       
   416                     {
       
   417                     TInt colon = aQName.Locate(':');
       
   418                     if(colon>0) // Note: 0 also treated as no prefix
       
   419                         {
       
   420                         prefix.Set(aQName.Ptr(), colon);
       
   421                         }
       
   422                    }
       
   423                 iServicePolicy->AsElement().SetNamespaceL(prefix, aNsUri);
       
   424                 DelegateParsingL(*iServicePolicy);
       
   425                 }
       
   426             else
       
   427                 {
       
   428                 CSenDomFragment::StartElementL( aNsUri,
       
   429                                                 aLocalName,
       
   430                                                 aQName,
       
   431                                                 aAttributes );
       
   432 
       
   433                 // For each endpoint, preserve the "cue" attribute
       
   434                 if( aLocalName == KEndpointLocalname )
       
   435                     {
       
   436                     const TDesC8& cue = SenXmlUtils::AttrValue(aAttributes, KCue);
       
   437                     CSenElement* pEndpointElement = AsElement().Element( aLocalName );
       
   438                     if( cue.Length() > 0 && pEndpointElement)
       
   439                         {
       
   440                         SenXmlUtils::AddAttributeL(*pEndpointElement, KCue, cue );
       
   441                         }
       
   442                     }
       
   443                 }
       
   444             break;
       
   445             }
       
   446         case KStateParsingCredentials:
       
   447             {
       
   448             iState = KStateParsingSingleCredential;
       
   449 
       
   450             // see destructor: iCredentialList.ResetAndDestroy(); // owns
       
   451             iCredential = CSenCredential::NewL( aNsUri,
       
   452                                                 aLocalName,
       
   453                                                 aQName,
       
   454                                                 aAttributes,
       
   455                                                 AsElement());
       
   456             iCredential->SetValidUntil(iNotOnOrAfter);
       
   457 
       
   458             DelegateParsingL(*iCredential);
       
   459             break;
       
   460             }
       
   461         default: // iState is KStateIgnore or some other..
       
   462             {
       
   463             // 2005-11: changed
       
   464             if(aLocalName == KServiceDescriptionLocalName())
       
   465                 {
       
   466                 SetAttributesL(aAttributes);
       
   467                 }
       
   468 
       
   469             CSenDomFragment::StartElementL( aNsUri,
       
   470                                             aLocalName,
       
   471                                             aQName,
       
   472                                             aAttributes);
       
   473             }
       
   474         }
       
   475     }
       
   476 
       
   477 EXPORT_C void CSenXmlServiceDescription::EndElementL(const TDesC8& aNsUri,
       
   478                                                      const TDesC8& aLocalName,
       
   479                                                      const TDesC8& aQName )
       
   480     {
       
   481 
       
   482     switch (iState)
       
   483         {
       
   484         case KStateParsingCredentials:
       
   485             {
       
   486             if(aLocalName == KCredentialsName)
       
   487                 {
       
   488                 iState = KStateSave;
       
   489                 }
       
   490             } break;
       
   491         case KStateParsingSingleCredential:
       
   492             {
       
   493             iCredential->DetachL();
       
   494             iCredentialList.Append(iCredential);
       
   495             if(aLocalName == KCredentialsName)
       
   496                 {
       
   497                 iState = KStateIgnore;
       
   498                 }
       
   499             else
       
   500                 {
       
   501                 iState = KStateParsingCredentials;
       
   502                 }
       
   503             break;
       
   504             }
       
   505         case KStateParsingServicePolicy:
       
   506             {
       
   507 //            if(aLocalName == KServicePolicyLocalName)
       
   508                 {
       
   509                 iState = KStateSave;
       
   510                 }
       
   511             } break;            
       
   512         case KStateParsingProviderPolicy:
       
   513             {
       
   514             iState = KStateSave;
       
   515             } break;
       
   516         default:
       
   517             {
       
   518             CSenDomFragment::EndElementL(aNsUri, aLocalName, aQName);
       
   519             }
       
   520         }
       
   521     }
       
   522 
       
   523 // From Provider Policy:
       
   524 // Setter for Internet Access Point (IAP) ID
       
   525 EXPORT_C void CSenXmlServiceDescription::SetIapIdL(TUint32 aIapId)
       
   526     {
       
   527     iProviderPolicy->SetIapIdL(aIapId);
       
   528     }
       
   529 
       
   530 // Getter for IAP ID
       
   531 EXPORT_C TInt CSenXmlServiceDescription::IapId(TUint32& aCurrentIapId)
       
   532     {
       
   533     return iProviderPolicy->IapId(aCurrentIapId);
       
   534     }
       
   535 
       
   536 // Setter for SNAP
       
   537 EXPORT_C void CSenXmlServiceDescription::SetSnapIdL(TUint32 aSnapId)
       
   538     {
       
   539     iProviderPolicy->SetSnapIdL(aSnapId);
       
   540     }
       
   541 
       
   542 // Getter for SNAP
       
   543 EXPORT_C TInt CSenXmlServiceDescription::SnapId(TUint32& aCurrentSnapId)
       
   544     {
       
   545     return iProviderPolicy->SnapId(aCurrentSnapId);
       
   546     }
       
   547 
       
   548 // From Provider Policy:
       
   549 EXPORT_C TInt CSenXmlServiceDescription::SetTransportPropertiesL(const TDesC8& aProperties)
       
   550     {
       
   551     return iProviderPolicy->SetTransportPropertiesL(aProperties);
       
   552     }
       
   553 
       
   554 // Getter for IAP ID
       
   555 EXPORT_C TInt CSenXmlServiceDescription::TransportPropertiesL(HBufC8*& aProperties)
       
   556     {
       
   557     return iProviderPolicy->TransportPropertiesL(aProperties);
       
   558     }
       
   559 
       
   560 // Setter: overrides current values with the given values from the array
       
   561 EXPORT_C void CSenXmlServiceDescription::SetIdentityProviderIdsL( CSenIdentityProviderIdArray8& aList )
       
   562     {
       
   563     iProviderPolicy->SetIdentityProviderIdsL(aList);
       
   564     }
       
   565 
       
   566 
       
   567 // Adder: adds a new IDP ID value at the end of the current list value(s)
       
   568 // Checks for duplicates (does not insert new ID elements with equal content)
       
   569 // @return KErrAlreadyExists, if a duplicate is tried to add
       
   570 //         KErrArgument if a zero-length descriptor is tried to add
       
   571 //         (aProviderId.Length() == 0)
       
   572 
       
   573 EXPORT_C TInt CSenXmlServiceDescription::AddIdentityProviderIdL(
       
   574                                                         TDesC8& aProviderId)
       
   575     {
       
   576     return iProviderPolicy->AddIdentityProviderIdL(aProviderId);
       
   577     }
       
   578 
       
   579 // sets (rebuilds) the IAP ID and IDP ID list values from template
       
   580 // @return  - a error, if at least one addition of new contents has
       
   581 // failed OR KerrNone if every property was successfully reset
       
   582 EXPORT_C TInt CSenXmlServiceDescription::RebuildFrom(
       
   583                                                 MSenProviderPolicy& aTemplate)
       
   584     {
       
   585     return iProviderPolicy->RebuildFrom(aTemplate);
       
   586     }
       
   587 
       
   588 // Getter: return an empty array if no IDP:s have been spesified
       
   589 // or a list of IDP arrays if such value(s) have been set.
       
   590 EXPORT_C const CSenIdentityProviderIdArray8&
       
   591                             CSenXmlServiceDescription::IdentityProviderIds8L()
       
   592     {
       
   593     return iProviderPolicy->IdentityProviderIds8L();
       
   594     }
       
   595 
       
   596 EXPORT_C TBool CSenXmlServiceDescription::Accepts( MSenProviderPolicy& aPolicyPattern )
       
   597     {
       
   598     return iProviderPolicy->Accepts(aPolicyPattern);
       
   599     }
       
   600 
       
   601 // Overridden from CSenDomFragment
       
   602 EXPORT_C void CSenXmlServiceDescription::ResumeParsingFromL( const TDesC8& aNsUri,
       
   603                                                              const TDesC8& aLocalName,
       
   604                                                              const TDesC8& aQName )
       
   605     {
       
   606     iXmlReader->SetContentHandler(*this);
       
   607 
       
   608     switch (iState)
       
   609         {
       
   610         // no other states may be resumed(!)
       
   611         case KStateParsingCredentials:
       
   612         case KStateParsingSingleCredential:
       
   613         case KStateParsingProviderPolicy:
       
   614         case KStateParsingServicePolicy:
       
   615             {
       
   616             EndElementL(aNsUri, aLocalName, aQName);
       
   617             }
       
   618             break;
       
   619         }
       
   620     }
       
   621 
       
   622     
       
   623 EXPORT_C TInt CSenXmlServiceDescription::HasFacetL( const TDesC8& aURI, TBool& aHasFacet )
       
   624     {
       
   625     aHasFacet = EFalse;
       
   626     RPointerArray<CSenElement> elements;
       
   627     CleanupClosePushL(elements);
       
   628     AsElement().ElementsL(elements,KSenFacet);
       
   629 
       
   630     const TDesC8* pValue = NULL;
       
   631 
       
   632     TInt count(elements.Count());
       
   633     for (TInt i=0; i<count && !aHasFacet; i++)
       
   634         {
       
   635         pValue = elements[i]->AttrValue(KFacetAttrName);
       
   636         if (pValue)
       
   637             {
       
   638             if (*pValue == aURI) aHasFacet = ETrue;
       
   639             }
       
   640         }
       
   641 
       
   642     CleanupStack::PopAndDestroy(); // elements
       
   643     return KErrNone;
       
   644     }
       
   645 
       
   646 /*
       
   647 EXPORT_C TInt CSenXmlServiceDescription::FacetValue(TDesC8& aURI,
       
   648                                                     HBufC8*& aValueTo)
       
   649     {
       
   650     delete aValueTo;
       
   651     aValueTo = NULL;
       
   652 
       
   653     TInt retVal = KErrNotFound;
       
   654     RPointerArray<CSenElement> elements;
       
   655     TRAPD(err, CleanupClosePushL(elements);)
       
   656     if (err != KErrNone)
       
   657         {
       
   658         // cleanupstack was emptied when one of the above caused a Leave
       
   659         return err;
       
   660         }
       
   661     
       
   662     TRAP(err, AsElement().ElementsL(elements,KSenFacet);)
       
   663     if (err != KErrNone)
       
   664         {
       
   665         CleanupStack::PopAndDestroy(); // elements
       
   666         return err;
       
   667         }
       
   668 
       
   669     const TDesC8* pValue = NULL;
       
   670 
       
   671     TInt count(elements.Count());
       
   672     for (TInt i=0; i<count && !aValueTo; i++)
       
   673         {
       
   674         pValue = elements[i]->AttrValue(KFacetAttrName);
       
   675         if (pValue)
       
   676             {
       
   677             if (*pValue == aURI)
       
   678                 {
       
   679                 if (elements[i]->Content().Length() < 1)
       
   680                     {
       
   681                     aValueTo = KSenFacetValTrue().Alloc();
       
   682                     }
       
   683                 else
       
   684                     {
       
   685                     aValueTo = elements[i]->Content().Alloc();
       
   686                     }
       
   687                 if (aValueTo == NULL) retVal = KErrNoMemory;
       
   688                 else retVal = KErrNone;
       
   689                 }
       
   690             }
       
   691         }
       
   692 
       
   693     CleanupStack::PopAndDestroy(); // elements
       
   694     return retVal;
       
   695     }
       
   696 */
       
   697 
       
   698 // public, TRAPping version of FacetValue -getter:
       
   699 EXPORT_C TInt CSenXmlServiceDescription::FacetValue(TDesC8& aURI,
       
   700                                                     HBufC8*& aValueTo)
       
   701     {
       
   702     TInt retVal(KErrNone);
       
   703     TInt leaveCode(KErrNone);
       
   704     TRAP(leaveCode, retVal = FacetValueL(aURI, aValueTo);)
       
   705     if (leaveCode != KErrNone) 
       
   706         {
       
   707         retVal = leaveCode;
       
   708         }
       
   709     return retVal;
       
   710     }
       
   711 
       
   712 // private, leaving version of FacetValue -getter:
       
   713 TInt CSenXmlServiceDescription::FacetValueL(TDesC8& aURI,
       
   714                                             HBufC8*& aValueTo)
       
   715     {
       
   716     delete aValueTo;
       
   717     aValueTo = NULL;
       
   718 
       
   719     TInt retVal = KErrNotFound;
       
   720     RPointerArray<CSenElement> elements;
       
   721     CleanupClosePushL(elements);
       
   722     
       
   723     AsElement().ElementsL(elements, KSenFacet);
       
   724 
       
   725     const TDesC8* pValue = NULL;
       
   726 
       
   727     TInt count(elements.Count());
       
   728     for (TInt i=0; i<count && !aValueTo; i++)
       
   729         {
       
   730         pValue = elements[i]->AttrValue(KFacetAttrName);
       
   731         if (pValue)
       
   732             {
       
   733             if (*pValue == aURI)
       
   734                 {
       
   735                 if(elements[i]->Content().Length() < 1)
       
   736                     {
       
   737                     aValueTo = KSenFacetValTrue().Alloc();
       
   738                     }
       
   739                 else
       
   740                     {
       
   741                     aValueTo = elements[i]->Content().Alloc();
       
   742                     }
       
   743                 if(!aValueTo) // OOM
       
   744                     {
       
   745                     retVal = KErrNoMemory;
       
   746                     }
       
   747                 else 
       
   748                     {
       
   749                     retVal = KErrNone;
       
   750                     }
       
   751                 }
       
   752             }
       
   753         }
       
   754 
       
   755     CleanupStack::PopAndDestroy(); // elements
       
   756     return retVal;
       
   757     }
       
   758 
       
   759 /*
       
   760 EXPORT_C TInt CSenXmlServiceDescription::RemoveFacet(const TDesC8& aURI)
       
   761     {
       
   762     RPointerArray<CSenElement> elements;
       
   763     TRAPD(err, 
       
   764             CleanupClosePushL(elements);
       
   765             AsElement().ElementsL(elements,KSenFacet);
       
   766          )
       
   767 
       
   768     if (err != KErrNone)
       
   769         {
       
   770         return err; // nothing needs to be popped from the cleanup stack
       
   771         }
       
   772 
       
   773     const TDesC8* pValue = NULL;
       
   774     CSenElement* pFacet = NULL;
       
   775 
       
   776     TInt count(elements.Count());
       
   777     for (TInt i=0; i<count; i++)
       
   778         {
       
   779         pFacet = elements[i];
       
   780         pValue = pFacet->AttrValue(KFacetAttrName);
       
   781         if (pValue)
       
   782             {
       
   783             if (*pValue == aURI)
       
   784                 {
       
   785                 delete AsElement().RemoveElement(*pFacet);
       
   786                 }
       
   787             }
       
   788         }
       
   789 
       
   790     CleanupStack::PopAndDestroy(); // elements.Close()
       
   791 
       
   792     return KErrNone;
       
   793     }
       
   794 */
       
   795 // public, TRAPping version of FacetValue -getter:
       
   796 EXPORT_C TInt CSenXmlServiceDescription::RemoveFacet(const TDesC8& aURI)
       
   797     {
       
   798     TInt retVal(KErrNone);
       
   799     TInt leaveCode(KErrNone);
       
   800     TRAP(leaveCode, retVal = RemoveFacetL(aURI);)
       
   801     if (leaveCode != KErrNone)
       
   802         {
       
   803         retVal = leaveCode;
       
   804         }
       
   805     return retVal;
       
   806     }
       
   807 
       
   808 // private, leaving version of FacetValue -getter:
       
   809 TInt CSenXmlServiceDescription::RemoveFacetL(const TDesC8& aURI)
       
   810     {
       
   811     RPointerArray<CSenElement> elements;
       
   812     CleanupClosePushL(elements);
       
   813     AsElement().ElementsL(elements,KSenFacet);
       
   814     const TDesC8* pValue = NULL;
       
   815     CSenElement* pFacet = NULL;
       
   816     TInt retVal(KErrNotFound); // returned, if no match
       
   817     TInt count(elements.Count());
       
   818     for(TInt i=0; i<count; i++)
       
   819         {
       
   820         pFacet = elements[i];
       
   821         pValue = pFacet->AttrValue(KFacetAttrName);
       
   822         if(pValue)
       
   823             {
       
   824             if(*pValue == aURI)
       
   825                 {
       
   826                 delete AsElement().RemoveElement(*pFacet);
       
   827                 retVal = KErrNone; // ok: facet removed
       
   828                 }
       
   829             }
       
   830         }
       
   831     CleanupStack::PopAndDestroy(); // elements.Close()
       
   832     return retVal;
       
   833     }
       
   834 
       
   835 
       
   836 EXPORT_C TInt CSenXmlServiceDescription::AddFacetL(const CSenFacet& aFacet)
       
   837     {
       
   838     TInt retVal(KErrNone);
       
   839     RPointerArray<CSenElement> elements;
       
   840     CleanupClosePushL(elements);
       
   841     AsElement().ElementsL(elements,KSenFacet);
       
   842 
       
   843     const TDesC8* pValue = NULL;
       
   844     CSenElement* pFacet = NULL;
       
   845 
       
   846     TInt count(elements.Count());
       
   847     for(TInt i=0; i<count && !pFacet; i++)
       
   848         {
       
   849         pFacet = elements[i];
       
   850         pValue = pFacet->AttrValue(KFacetAttrName);
       
   851         if(pValue)
       
   852             {
       
   853             if(*pValue != ((CSenFacet&)aFacet).Name()) 
       
   854                 {
       
   855                 pFacet = NULL;  
       
   856                 }
       
   857             else // facet with equal name already exists!
       
   858                 {
       
   859                 retVal = KErrAlreadyExists;
       
   860                 }
       
   861             }
       
   862         else
       
   863             {
       
   864             pFacet = NULL;
       
   865             }
       
   866         }
       
   867 
       
   868     CleanupStack::PopAndDestroy(); // elements.Close()
       
   869 
       
   870     if(pFacet && (retVal == KErrAlreadyExists))
       
   871         {
       
   872         return retVal;
       
   873         }
       
   874     else // facet did not already exist
       
   875         {
       
   876         pFacet = &AsElement().AddElementL(KSenFacet);
       
   877         pFacet->AddAttrL(KFacetAttrName,((CSenFacet&)aFacet).Name());   
       
   878         if(((CSenFacet&)aFacet).Type() != KNullDesC8)
       
   879             {
       
   880             pFacet->AddAttrL(KFacetAttrType,((CSenFacet&)aFacet).Type());
       
   881             }
       
   882         pFacet->SetContentL(((CSenFacet&)aFacet).Value());
       
   883         retVal = KErrNone;
       
   884         return retVal;
       
   885         }
       
   886     }
       
   887 
       
   888 EXPORT_C TInt CSenXmlServiceDescription::SetFacetL(const CSenFacet& aFacet)
       
   889     {
       
   890     RPointerArray<CSenElement> elements;
       
   891     CleanupClosePushL(elements);
       
   892     AsElement().ElementsL(elements,KSenFacet);
       
   893 
       
   894     const TDesC8* pValue = NULL;
       
   895     CSenElement* pFacet = NULL;
       
   896 
       
   897     TInt count(elements.Count());
       
   898     for(TInt i=0; i<count && !pFacet; i++)
       
   899         {
       
   900         pFacet = elements[i];
       
   901         pValue = pFacet->AttrValue(KFacetAttrName);
       
   902         if (pValue)
       
   903             {
       
   904             if(*pValue != ((CSenFacet&)aFacet).Name()) pFacet = NULL;
       
   905             }
       
   906         else
       
   907             {
       
   908             pFacet = NULL;
       
   909             }
       
   910         }
       
   911 
       
   912     CleanupStack::PopAndDestroy(); // elements.Close()
       
   913 
       
   914     if(!pFacet) 
       
   915         {
       
   916         // add new facet element
       
   917         pFacet = &AsElement().AddElementL(KSenFacet);
       
   918         }
       
   919 
       
   920     pFacet->AddAttrL(KFacetAttrName,((CSenFacet&)aFacet).Name());
       
   921     if (((CSenFacet&)aFacet).Type() != KNullDesC8)
       
   922         {
       
   923         pFacet->AddAttrL(KFacetAttrType,((CSenFacet&)aFacet).Type());
       
   924         }
       
   925     pFacet->SetContentL(((CSenFacet&)aFacet).Value());
       
   926 
       
   927     return KErrNone;
       
   928     }
       
   929 
       
   930 EXPORT_C TInt CSenXmlServiceDescription::FacetsL(RFacetArray& aFacetArray)
       
   931     {
       
   932     RPointerArray<CSenElement> elements;
       
   933     CleanupClosePushL(elements);
       
   934     AsElement().ElementsL(elements,KSenFacet);
       
   935 
       
   936     CSenFacet* pNewFacet = NULL;
       
   937 
       
   938     TInt count(elements.Count());
       
   939     for(TInt i=0; i<count; i++)
       
   940         {
       
   941         pNewFacet = CSenFacet::NewL(*elements[i]);
       
   942         aFacetArray.Append(pNewFacet);
       
   943         }
       
   944 
       
   945     CleanupStack::PopAndDestroy(); // elements.Close()
       
   946     return KErrNone;
       
   947     }
       
   948 
       
   949 
       
   950 EXPORT_C TInt CSenXmlServiceDescription::ScoreMatchL( MSenServiceDescription& aPattern )
       
   951     {
       
   952     TInt score(0);
       
   953 
       
   954     if ((aPattern.Endpoint().Length() > 0) && (aPattern.Endpoint() == Endpoint()))
       
   955         {
       
   956         score++;
       
   957         }
       
   958     if ((aPattern.Contract().Length() > 0) && (aPattern.Contract() == Contract()))
       
   959         {
       
   960         score++;
       
   961         }
       
   962 
       
   963     RFacetArray otherFacets;
       
   964     CleanupClosePushL(otherFacets);
       
   965     aPattern.FacetsL(otherFacets);
       
   966 
       
   967     HBufC8* pFacetValue = NULL;
       
   968     TPtrC8 facetName;
       
   969     TPtrC8 otherFacetValue;
       
   970 
       
   971     TInt count(otherFacets.Count());
       
   972     for (TInt i=0; i<count; i++)
       
   973         {
       
   974         facetName.Set(otherFacets[i]->Name());
       
   975         FacetValue(facetName,pFacetValue);
       
   976         if (pFacetValue)
       
   977             {
       
   978             if (otherFacets[i]->Value().Length() < 1)
       
   979                 {
       
   980                 otherFacetValue.Set(KSenFacetValTrue());
       
   981                 }
       
   982             else
       
   983                 {
       
   984                 otherFacetValue.Set(otherFacets[i]->Value());
       
   985                 }
       
   986             if (*pFacetValue == otherFacetValue)
       
   987                 {
       
   988                 score++;
       
   989                 }
       
   990             }
       
   991         delete pFacetValue;
       
   992         pFacetValue = NULL;
       
   993         }
       
   994 
       
   995     otherFacets.ResetAndDestroy();
       
   996     CleanupStack::Pop(); // otherFacets
       
   997 
       
   998     return score;
       
   999     }
       
  1000 
       
  1001 EXPORT_C TBool CSenXmlServiceDescription::HasEqualPrimaryKeysL(MSenServiceDescription& aCandidate)
       
  1002     {
       
  1003     TBool retVal(EFalse);
       
  1004     if(aCandidate.Endpoint()  == Endpoint() && 
       
  1005        aCandidate.Contract() == Contract() &&
       
  1006        aCandidate.FrameworkId() == FrameworkId())
       
  1007         {
       
  1008         retVal = ETrue;
       
  1009         }
       
  1010     return retVal;    
       
  1011     }
       
  1012     
       
  1013 EXPORT_C TBool CSenXmlServiceDescription::IsLocalL()
       
  1014     {
       
  1015     TBool local(EFalse);
       
  1016 
       
  1017     // Check transport cue; if such XML attribute
       
  1018     // has been set to <Endpoint element, it is
       
  1019     // "stronger" than actual endpoint scheme
       
  1020     if(ipElement)
       
  1021         {
       
  1022         CSenElement* child = AsElement().Element(KEndpointLocalname());
       
  1023         if(child)
       
  1024             {
       
  1025             const TDesC8* cue = child->AttrValue(KCue);
       
  1026             TInt length(KSenTransportSchemeLocal().Length());
       
  1027             if(cue && cue->Length()>=length && cue->Left(length) == KSenTransportSchemeLocal)
       
  1028                 {
       
  1029                 local = ETrue; // match!
       
  1030                 }
       
  1031             }
       
  1032         }
       
  1033     
       
  1034     if(!local) // no match yet
       
  1035         {
       
  1036         // Resolve the endpoint scheme
       
  1037         TPtrC8 uri = Endpoint();
       
  1038         if(uri.Length()>0)
       
  1039             {
       
  1040             TInt index = uri.Locate(':');
       
  1041             if(index!=KErrNotFound)
       
  1042                 {
       
  1043                 TPtrC8 uriScheme = uri.Left(index);
       
  1044                 if(uriScheme == KSenTransportSchemeLocal)
       
  1045                     {
       
  1046                     local = ETrue;
       
  1047                     }
       
  1048                 }
       
  1049             }
       
  1050         }
       
  1051     return local;            
       
  1052     }
       
  1053 
       
  1054 EXPORT_C TInt CSenXmlServiceDescription::SetTransportCueL(const TDesC8& aTransportCue)
       
  1055     {
       
  1056     TInt retVal(KErrSenNoEndpoint);
       
  1057     if(ipElement)
       
  1058         {
       
  1059         CSenElement* child = AsElement().Element(KEndpointLocalname());
       
  1060         if(child)
       
  1061             {
       
  1062             // Method either adds new attribute or updates existing one:
       
  1063             SenXmlUtils::AddAttributeL(*child, KCue, aTransportCue);
       
  1064             retVal = KErrNone;
       
  1065             }
       
  1066         }
       
  1067     return retVal;
       
  1068     }
       
  1069 
       
  1070 EXPORT_C TPtrC8 CSenXmlServiceDescription::TransportCue()
       
  1071     {
       
  1072     if(ipElement)
       
  1073         {
       
  1074         CSenElement* child = AsElement().Element(KEndpointLocalname());
       
  1075         if(child)
       
  1076             {
       
  1077             const TDesC8* value = child->AttrValue(KCue);
       
  1078             if(value)
       
  1079                 {
       
  1080                 return *value;
       
  1081                 }
       
  1082             }
       
  1083         }
       
  1084     return KNullDesC8();
       
  1085     }
       
  1086 
       
  1087 EXPORT_C MSenServicePolicy* CSenXmlServiceDescription::ServicePolicy()
       
  1088     {
       
  1089     if(iServicePolicy)
       
  1090         {
       
  1091         return (MSenServicePolicy*)iServicePolicy;
       
  1092         }
       
  1093     else
       
  1094         {
       
  1095         return NULL;
       
  1096         }
       
  1097     }
       
  1098 
       
  1099 EXPORT_C TInt CSenXmlServiceDescription::SetPolicyL(const TDesC8& aName)
       
  1100     {
       
  1101     if(aName==KNullDesC8())
       
  1102         return KErrArgument;
       
  1103     
       
  1104     CSenElement* servicePolicy = AsElement().Element(KServicePolicyLocalName); 
       
  1105     CSenElement* clientPolicy = servicePolicy->Element(KClientServicePolicyLocalName);     
       
  1106     if( clientPolicy == NULL )
       
  1107         {
       
  1108         clientPolicy = &(servicePolicy->AddElementL( KClientServicePolicyLocalName ));
       
  1109         }
       
  1110     clientPolicy->AddElementL(aName);        
       
  1111     return KErrNone;
       
  1112     }
       
  1113 
       
  1114 EXPORT_C TInt CSenXmlServiceDescription::SetPolicyL(const TDesC8& aName, const TDesC8& aValue)
       
  1115     {
       
  1116     if(aName==KNullDesC8() || aValue == KNullDesC8())
       
  1117         return KErrArgument;
       
  1118     
       
  1119     CSenElement* servicePolicy = AsElement().Element(KServicePolicyLocalName); 
       
  1120     CSenElement* clientPolicy = servicePolicy->Element(KClientServicePolicyLocalName);     
       
  1121     if( clientPolicy == NULL )
       
  1122         {
       
  1123         clientPolicy = & (servicePolicy->AddElementL( KClientServicePolicyLocalName ));
       
  1124         }
       
  1125     clientPolicy->AddElementL(aName).SetContentL(aValue);       
       
  1126     return KErrNone;
       
  1127     }
       
  1128 
       
  1129 EXPORT_C TInt CSenXmlServiceDescription::SetPolicyL(const TDesC8& aName, const TDesC8& aValue, const TDesC8& aAttribName, const TDesC8& aAttribValue)
       
  1130     {
       
  1131 
       
  1132     if(aName==KNullDesC8() || aValue == KNullDesC8() || aAttribName == KNullDesC8() || aAttribValue == KNullDesC8())
       
  1133         return KErrArgument;
       
  1134     
       
  1135     CSenElement* servicePolicy = AsElement().Element(KServicePolicyLocalName); 
       
  1136     CSenElement* clientPolicy = servicePolicy->Element(KClientServicePolicyLocalName);     
       
  1137     if( clientPolicy == NULL )
       
  1138         {
       
  1139         clientPolicy = & (servicePolicy->AddElementL( KClientServicePolicyLocalName ));
       
  1140         }
       
  1141     CSenElement& ele = clientPolicy->AddElementL(aName);
       
  1142     ele.SetContentL(aValue);           
       
  1143     SenXmlUtils::AddAttributeL(ele, aAttribName, aAttribValue);
       
  1144     return KErrNone;
       
  1145     }
       
  1146 
       
  1147 EXPORT_C TInt CSenXmlServiceDescription::SetProviderIdL( const TDesC8& aProviderID )
       
  1148     {
       
  1149     if ( aProviderID.Length() == 0 )
       
  1150         {
       
  1151         return KErrArgument; // zero-length provider ID
       
  1152         }
       
  1153     else 
       
  1154         {
       
  1155         SetContentOfL(KSenIdpProviderIdLocalname, aProviderID);
       
  1156         return KErrNone;
       
  1157         }
       
  1158     }
       
  1159     
       
  1160 EXPORT_C TPtrC8 CSenXmlServiceDescription::ProviderId()
       
  1161     {
       
  1162     return ContentOf( KSenIdpProviderIdLocalname );
       
  1163     }
       
  1164 
       
  1165 EXPORT_C void CSenXmlServiceDescription::SetPromptUserInfoL( TBool aPromptUserInfoMode )
       
  1166     {
       
  1167     if( aPromptUserInfoMode )
       
  1168         {
       
  1169 #ifndef _RD_SEN_WS_STAR_DO_NOT_PROMPT_AUTHINFO_BY_DEFAULT
       
  1170 
       
  1171         // macro is disabled
       
  1172 
       
  1173         // When attribute does not exist, by default, the userinfo prompt is displayed:
       
  1174         // (when authentication service tells that authentication fails)
       
  1175         delete SenXmlUtils::RemoveAttributeL(AsElement(), KSenAttrPromptUserInfo);
       
  1176 
       
  1177 #else 
       
  1178         // macro is not in effect
       
  1179 				_LIT8(KTrue,"true");
       
  1180         // Attribute with "true" value must *explicitely* exist, since default is "do not prompt":
       
  1181         SenXmlUtils::AddAttributeL(AsElement(), KSenAttrPromptUserInfo, KTrue );	//CodeScannerWarnings
       
  1182 #endif        
       
  1183         }
       
  1184     else
       
  1185         {
       
  1186 				_LIT8(KFalse,"false");
       
  1187         // Attribute is needed only (with value "false"), when API caller wants to disable
       
  1188         // end-user prompt from being displayed
       
  1189         SenXmlUtils::AddAttributeL(AsElement(), KSenAttrPromptUserInfo, KFalse );	//CodeScannerWarnings
       
  1190         }
       
  1191     }
       
  1192 
       
  1193 EXPORT_C TBool CSenXmlServiceDescription::PromptUserInfo()
       
  1194     {
       
  1195     _LIT8(KFalse,"false");
       
  1196     TBool retVal(ETrue); // by default, prompting is enabled
       
  1197     const TDesC8* value = AsElement().AttrValue( KSenAttrPromptUserInfo );
       
  1198     if( value && *value == KFalse )	//CodeScannerWarnings
       
  1199         {
       
  1200         // Only, and only if attribute EXISTS AND it HAS value "false", 
       
  1201         // the user info should NOT be prompted from end-user(!)
       
  1202         retVal = EFalse;
       
  1203         }
       
  1204     // else retVal = ETrue;
       
  1205     return retVal;    
       
  1206     }
       
  1207     
       
  1208 // End of File