presadap12/impsplugin/src/pimpsadapxmltools.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Various tools for XML
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  INCLUDES
       
    20 #include "PImpsAdapXMLTools.h"
       
    21 
       
    22 
       
    23 #include "PEngXMLTags.h"
       
    24 #include "MPEngXMLParser.h"
       
    25 #include "MPEngXMLSerializer.h"
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // NImpsAdapXMLTools::LeaveIfMajorErrorL()
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 void NImpsAdapXMLTools::LeaveIfMajorErrorL( TInt aError )
       
    34     {
       
    35     if ( ( aError < 0 ) &&
       
    36          ( aError != KErrAlreadyExists ) )
       
    37         {
       
    38         User::Leave( aError );
       
    39         }
       
    40     }
       
    41 
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // NImpsAdapXMLTools::ParseContactListNickListL()
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // NImpsAdapXMLTools::AppendTransactionContentTagXmlL()
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 void NImpsAdapXMLTools::AppendTransactionContentTagXmlL(
       
    53     MPEngXMLSerializer& aXMLSerializer,
       
    54     TImpsAdapWVCspVersion aCSPVersion )
       
    55     {
       
    56     if ( aCSPVersion == EWVCspV11 )
       
    57         {
       
    58         aXMLSerializer.StartTagL(  KTransactionContent );
       
    59         aXMLSerializer.AttributeL( KXmlXmlns, KTransactionContentNS );
       
    60         }
       
    61     else if ( aCSPVersion == EWVCspV12 )
       
    62         {
       
    63         aXMLSerializer.StartTagL( KTransactionContent );
       
    64         aXMLSerializer.AttributeL( KXmlXmlns, KTransactionContentNS_CSP12 );
       
    65         }
       
    66     // add for EWVCspV13
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // NImpsAdapXMLTools::AppendUserIdXmlL()
       
    71 // -----------------------------------------------------------------------------
       
    72 //
       
    73 void NImpsAdapXMLTools::AppendUserIdXmlL(
       
    74     MPEngXMLSerializer& aXmlSerializer,
       
    75     const TDesC16& aUserId )
       
    76     {
       
    77     // <UserID>
       
    78     // Contact list name value
       
    79     // </UserID>
       
    80     aXmlSerializer.StartTagL( KUserIDXMLTag
       
    81                             ).NarrowTextL( KWVXMLTag
       
    82                                          ).WvAddressL( aUserId
       
    83                                                      ).EndTagL( KUserIDXMLTag );
       
    84     }
       
    85 
       
    86 
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // NImpsAdapXMLTools::ApppendReceiveListTagL()
       
    90 // -----------------------------------------------------------------------------
       
    91 //
       
    92 void NImpsAdapXMLTools::ApppendReceiveListTagL(
       
    93     MPEngXMLSerializer& aXmlSerializer,
       
    94     TImpsAdapWVCspVersion& aCSPVersion,
       
    95     TBool aValue )
       
    96     {
       
    97     // Only 1.2 version supports ReceiveList tag
       
    98     if ( aCSPVersion != EWVCspV12 )
       
    99         {
       
   100         return;
       
   101         }
       
   102 
       
   103     aXmlSerializer.StartTagL( KReceiveList ).
       
   104     NarrowTextL( aValue ? KXMLValueTrue : KXMLValueFalse ).
       
   105     EndTagL( KReceiveList );
       
   106 
       
   107     }
       
   108 
       
   109 
       
   110 // -----------------------------------------------------------------------------
       
   111 // NImpsAdapXMLTools::AppendContactListNameXmlL()
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 void NImpsAdapXMLTools::AppendContactListNameXmlL( MPEngXMLSerializer& aXmlSerializer,
       
   115                                                    const TDesC16& aContactListName )
       
   116     {
       
   117     // <ContactList>
       
   118     // Contact list name value
       
   119     // </ContactList>
       
   120     aXmlSerializer.StartTagL( KContactList
       
   121                             ).WvAddressL( aContactListName
       
   122                                         ).EndTagL( KContactList );
       
   123     }
       
   124 
       
   125 
       
   126 
       
   127 
       
   128 //  End of File
       
   129