websrv_pub/xml_fragment_api/tsrc/senfragmentTester/src/SenFragmentTesterBlocks.cpp
changeset 0 62f9d29f7211
child 23 a1df79fa35b4
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2002 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:        ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // [INCLUDE FILES] - do not remove
       
    20 #include <e32svr.h>
       
    21 #include <StifParser.h>
       
    22 #include <StifTestInterface.h>
       
    23 #include "SenFragmentTester.h"
       
    24 //  EXTERNAL INCLUDES
       
    25 #include <SenDomFragmentBase.h>
       
    26 #include <SenFragmentBase.h>
       
    27 #include <SenParser.h>
       
    28 #include <RSenDocument.h>
       
    29 #include <xmlengdomutils.h>
       
    30 
       
    31 #if defined( __SERIES60_31__ ) || (!defined( __SERIES60_30__ ) && defined( SYMBIAN_SWI_POST_INSTALL_REVOCATION) )
       
    32     #include <xml/matchdata.h>
       
    33 #endif    
       
    34 
       
    35 #include <xml/parserfeature.h>           // for TParserFeature enumeration
       
    36 #include <xmlengserializationoptions.h> // needed for TSerializationOptions
       
    37 #include <xmlengbinarycontainer.h>
       
    38 #include <s32mem.h>
       
    39 #include <xmlengdom.h>
       
    40 
       
    41 //  INTERNAL INCLUDES
       
    42 #include "maindomfragment.h"
       
    43 #include "mainfragment.h"
       
    44 // EXTERNAL DATA STRUCTURES
       
    45 //extern  ?external_data;
       
    46 
       
    47 // EXTERNAL FUNCTION PROTOTYPES  
       
    48 //extern ?external_function( ?arg_type,?arg_type );
       
    49 
       
    50 // CONSTANTS
       
    51 //const ?type ?constant_var = ?constant;
       
    52 
       
    53 // MACROS
       
    54 //#define ?macro ?macro_def
       
    55 #define LOCAL_ASSERT(expression)	{if(!(expression)){return KErrArgument;}}
       
    56 
       
    57 // LOCAL CONSTANTS AND MACROS
       
    58 //const ?type ?constant_var = ?constant;
       
    59 //#define ?macro_name ?macro_def
       
    60 
       
    61 // MODULE DATA STRUCTURES
       
    62 //enum ?declaration
       
    63 //typedef ?declaration
       
    64 
       
    65 // LOCAL FUNCTION PROTOTYPES
       
    66 //?type ?function_name( ?arg_type, ?arg_type );
       
    67 
       
    68 // FORWARD DECLARATIONS
       
    69 //class ?FORWARD_CLASSNAME;
       
    70 
       
    71 // ============================= LOCAL FUNCTIONS ===============================
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // ?function_name ?description.
       
    75 // ?description
       
    76 // Returns: ?value_1: ?description
       
    77 //          ?value_n: ?description_line1
       
    78 //                    ?description_line2
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 /*
       
    82 ?type ?function_name(
       
    83     ?arg_type arg,  // ?description
       
    84     ?arg_type arg)  // ?description
       
    85     {
       
    86 
       
    87     ?code  // ?comment
       
    88 
       
    89     // ?comment
       
    90     ?code
       
    91     }
       
    92 */
       
    93 
       
    94 // ============================ MEMBER FUNCTIONS ===============================
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CSenFragmentTester::Delete
       
    98 // Delete here all resources allocated and opened from test methods. 
       
    99 // Called from destructor. 
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 void CSenFragmentTester::Delete() 
       
   103     {
       
   104 
       
   105     }
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // CSenFragmentTester::RunMethodL
       
   109 // Run specified method. Contains also table of test mothods and their names.
       
   110 // -----------------------------------------------------------------------------
       
   111 //
       
   112 TInt CSenFragmentTester::RunMethodL( 
       
   113     CStifItemParser& aItem ) 
       
   114     {
       
   115 
       
   116     static TStifFunctionInfo const KFunctions[] =
       
   117         {  
       
   118         // First string is the function name used in TestScripter script file.
       
   119         // Second is the actual implementation member function. 
       
   120 		ENTRY("SDFB-NewL-test_CSenDomFragmentBase_NewL", MT_CSenDomFragmentBase_NewLL),
       
   121 		ENTRY("SDFB-NewL1-test_CSenDomFragmentBase_NewL", MT_CSenDomFragmentBase_NewL_1L),
       
   122 		ENTRY("SDFB-NewL2-test_CSenDomFragmentBase_NewL", CSenFragmentTester::MT_CSenDomFragmentBase_NewL_2L),
       
   123 		ENTRY("SDFB-NewL3-test_CSenDomFragmentBase_NewL", CSenFragmentTester::MT_CSenDomFragmentBase_NewL_3L),
       
   124 		ENTRY("SDFB-NewL4-test_CSenDomFragmentBase_NewL", CSenFragmentTester::MT_CSenDomFragmentBase_NewL_4L),
       
   125 		ENTRY("SDFB-NewL5-test_CSenDomFragmentBase_NewL", CSenFragmentTester::MT_CSenDomFragmentBase_NewL_5L),
       
   126 		ENTRY("SDFB-NewL6-test_CSenDomFragmentBase_NewL", CSenFragmentTester::MT_CSenDomFragmentBase_NewL_6L),
       
   127 		ENTRY("SDFB-NewL7-test_CSenDomFragmentBase_NewL", CSenFragmentTester::MT_CSenDomFragmentBase_NewL_7L),
       
   128 		ENTRY("SDFB-ExpandL-test_CSenDomFragmentBase_ExpandL", CSenFragmentTester::MT_CSenDomFragmentBase_ExpandLL),
       
   129 		ENTRY("SDFB-OnResumeParsingFromL-test_CSenDomFragmentBase_OnResumeParsingFromL", CSenFragmentTester::MT_CSenDomFragmentBase_OnResumeParsingFromLL),
       
   130 		ENTRY("SDFB-AddAttributesL-test_CSenDomFragmentBase_AddAttributesL", CSenFragmentTester::MT_CSenDomFragmentBase_AddAttributesLL),
       
   131 		ENTRY("SDFB-AsXmlL-test_CSenDomFragmentBase_AsXmlL", CSenFragmentTester::MT_CSenDomFragmentBase_AsXmlLL),
       
   132 		ENTRY("SDFB-OnStartElementL-test_CSenDomFragmentBase_OnStartElementL", CSenFragmentTester::MT_CSenDomFragmentBase_OnStartElementLL),
       
   133 		ENTRY("SDFB-OnContentL-test_CSenDomFragmentBase_OnContentL", CSenFragmentTester::MT_CSenDomFragmentBase_OnContentLL),
       
   134 		ENTRY("SDFB-OnWriteStartElementL-test_CSenDomFragmentBase_OnWriteStartElementL", CSenFragmentTester::MT_CSenDomFragmentBase_OnWriteStartElementLL),
       
   135 		ENTRY("SDFB-OnWriteEndElementL-test_CSenDomFragmentBase_OnWriteEndElementL", CSenFragmentTester::MT_CSenDomFragmentBase_OnWriteEndElementLL),
       
   136 		ENTRY("SDFB-OnEndElementL-test_CSenDomFragmentBase_OnEndElementL", CSenFragmentTester::MT_CSenDomFragmentBase_OnEndElementLL),
       
   137 		ENTRY("SDFB-OnStartDocumentL-test_CSenDomFragmentBase_OnStartDocumentL", CSenFragmentTester::MT_CSenDomFragmentBase_OnStartDocumentLL),
       
   138 		ENTRY("SDFB-OnEndDocumentL-test_CSenDomFragmentBase_OnEndDocumentL", CSenFragmentTester::MT_CSenDomFragmentBase_OnEndDocumentLL),
       
   139 		ENTRY("SDFB-OnStartPrefixMappingL-test_CSenDomFragmentBase_OnStartPrefixMappingL", CSenFragmentTester::MT_CSenDomFragmentBase_OnStartPrefixMappingLL),
       
   140 		ENTRY("SDFB-OnEndPrefixMappingL-test_CSenDomFragmentBase_OnEndPrefixMappingL", CSenFragmentTester::MT_CSenDomFragmentBase_OnEndPrefixMappingLL),
       
   141 		ENTRY("SDFB-OnIgnorableWhiteSpaceL-test_CSenDomFragmentBase_OnIgnorableWhiteSpaceL", CSenFragmentTester::MT_CSenDomFragmentBase_OnIgnorableWhiteSpaceLL),
       
   142 		ENTRY("SDFB-OnSkippedEntityL-test_CSenDomFragmentBase_OnSkippedEntityL", CSenFragmentTester::MT_CSenDomFragmentBase_OnSkippedEntityLL),
       
   143 		ENTRY("SDFB-OnProcessingInstructionL-test_CSenDomFragmentBase_OnProcessingInstructionL", CSenFragmentTester::MT_CSenDomFragmentBase_OnProcessingInstructionLL),
       
   144 		ENTRY("SDFB-OnError-test_CSenDomFragmentBase_OnError", CSenFragmentTester::MT_CSenDomFragmentBase_OnErrorL),
       
   145 		ENTRY("SDFB-GetExtendedInterface-test_CSenDomFragmentBase_GetExtendedInterface", CSenFragmentTester::MT_CSenDomFragmentBase_GetExtendedInterfaceL),
       
   146 		ENTRY("SDFB-ContentL-test_CSenDomFragmentBase_ContentL", CSenFragmentTester::MT_CSenDomFragmentBase_ContentLL),
       
   147 		ENTRY("SDFB-Namespace-test_CSenDomFragmentBase_Namespace", CSenFragmentTester::MT_CSenDomFragmentBase_NamespaceL),
       
   148 		ENTRY("SDFB-ResetContentL-test_CSenDomFragmentBase_ResetContentL", CSenFragmentTester::MT_CSenDomFragmentBase_ResetContentLL),
       
   149 		ENTRY("SDFB-LocalName-test_CSenDomFragmentBase_LocalName", CSenFragmentTester::MT_CSenDomFragmentBase_LocalNameL),
       
   150 		ENTRY("SDFB-NsUri-test_CSenDomFragmentBase_NsUri", CSenFragmentTester::MT_CSenDomFragmentBase_NsUriL),
       
   151 		ENTRY("SDFB-NsPrefix-test_CSenDomFragmentBase_NsPrefix", CSenFragmentTester::MT_CSenDomFragmentBase_NsPrefixL),
       
   152 		ENTRY("SDFB-AsElementL-test_CSenDomFragmentBase_AsElementL", CSenFragmentTester::MT_CSenDomFragmentBase_AsElementLL),
       
   153 		ENTRY("SDFB-AsDocumentL-test_CSenDomFragmentBase_AsDocumentL", CSenFragmentTester::MT_CSenDomFragmentBase_AsDocumentLL),
       
   154 		ENTRY("SDFB-ExtractElement-test_CSenDomFragmentBase_ExtractElement", CSenFragmentTester::MT_CSenDomFragmentBase_ExtractElementL),
       
   155 		ENTRY("SDFB-OnDelegateParsingL-test_CSenDomFragmentBase_OnDelegateParsingL", CSenFragmentTester::MT_CSenDomFragmentBase_OnDelegateParsingLL),
       
   156 		ENTRY("SDFB-OnDelegateParsingL-test_CSenDomFragmentBase_OnDelegateParsingL", CSenFragmentTester::MT_CSenDomFragmentBase_OnDelegateParsingL_1L),
       
   157 		ENTRY("SDFB-SetOwner-test_CSenDomFragmentBase_SetOwner", CSenFragmentTester::MT_CSenDomFragmentBase_SetOwnerL),
       
   158 		ENTRY("SDFB-AsXmlUnicodeL-test_CSenDomFragmentBase_AsXmlUnicodeL", CSenFragmentTester::MT_CSenDomFragmentBase_AsXmlUnicodeLL),
       
   159 		ENTRY("SDFB-WriteAsXMLToL-test_CSenDomFragmentBase_WriteAsXMLToL", CSenFragmentTester::MT_CSenDomFragmentBase_WriteAsXMLToLL),
       
   160 		ENTRY("SDFB-ConsistsOfL-test_CSenDomFragmentBase_ConsistsOfL", CSenFragmentTester::MT_CSenDomFragmentBase_ConsistsOfLL),
       
   161 		ENTRY("SDFB-SetContentHandler-test_CSenDomFragmentBase_SetContentHandler", CSenFragmentTester::MT_CSenDomFragmentBase_SetContentHandlerL),
       
   162 		ENTRY("SDFB-Parsing-test_CSenDomFragmentBase_Parsing", CSenFragmentTester::MT_CSenDomFragmentBase_Parsing1L),
       
   163 		ENTRY("SDFB-Parsingdelegate-test_CSenDomFragmentBase_Parsing", CSenFragmentTester::MT_CSenDomFragmentBase_Parsing2L),
       
   164 		ENTRY("SDFB-Parsingnamespaces-test_CSenDomFragmentBase_Parsing", CSenFragmentTester::MT_CSenDomFragmentBase_Parsing3L),
       
   165 		ENTRY("SDFB-Parsingnestedelements-test_CSenDomFragmentBase_Parsing", CSenFragmentTester::MT_CSenDomFragmentBase_Parsing4L),
       
   166 		ENTRY("SDFB-Parsingnullednamespaces-test_CSenDomFragmentBase_Parsing", CSenFragmentTester::MT_CSenDomFragmentBase_Parsing5L),
       
   167 		ENTRY("SDFB-Parsingusingemptyfragment-test_CSenDomFragmentBase_Parsing", CSenFragmentTester::MT_CSenDomFragmentBase_Parsing6L),
       
   168 		ENTRY("SDFB-ParsingWSmessage-test_CSenDomFragmentBase_Parsing", CSenFragmentTester::MT_CSenDomFragmentBase_Parsing7L),
       
   169 		ENTRY("SDFB-Parsing2.WSmessage-test_CSenDomFragmentBase_Parsing", CSenFragmentTester::MT_CSenDomFragmentBase_Parsing8L),
       
   170 		ENTRY("SFB-NewL-test_CSenFragmentBase_NewL", CSenFragmentTester::MT_CSenFragmentBase_NewLL),
       
   171 		ENTRY("SFB-NewL1-test_CSenFragmentBase_NewL", CSenFragmentTester::MT_CSenFragmentBase_NewL_1L),
       
   172 		ENTRY("SFB-NewL2-test_CSenFragmentBase_NewL", CSenFragmentTester::MT_CSenFragmentBase_NewL_2L),
       
   173 		ENTRY("SFB-NewL3-test_CSenFragmentBase_NewL", CSenFragmentTester::MT_CSenFragmentBase_NewL_3L),
       
   174 		ENTRY("SFB-NewL4-test_CSenFragmentBase_NewL", CSenFragmentTester::MT_CSenFragmentBase_NewL_4L),
       
   175 		ENTRY("SFB-NewL5-test_CSenFragmentBase_NewL", CSenFragmentTester::MT_CSenFragmentBase_NewL_5L),
       
   176 		ENTRY("SFB-NewL6-test_CSenFragmentBase_NewL", CSenFragmentTester::MT_CSenFragmentBase_NewL_6L),
       
   177 		ENTRY("SFB-NewL7-test_CSenFragmentBase_NewL", CSenFragmentTester::MT_CSenFragmentBase_NewL_7L),
       
   178 		ENTRY("SFB-OnStartElementL-test_CSenFragmentBase_OnStartElementL", CSenFragmentTester::MT_CSenFragmentBase_OnStartElementLL),
       
   179 		ENTRY("SFB-OnEndElementL-test_CSenFragmentBase_OnEndElementL", CSenFragmentTester::MT_CSenFragmentBase_OnEndElementLL),
       
   180 		ENTRY("SFB-OnStartDocumentL-test_CSenFragmentBase_OnStartDocumentL", CSenFragmentTester::MT_CSenFragmentBase_OnStartDocumentLL),
       
   181 		ENTRY("SFB-OnEndDocumentL-test_CSenFragmentBase_OnEndDocumentL", CSenFragmentTester::MT_CSenFragmentBase_OnEndDocumentLL),
       
   182 		ENTRY("SFB-OnContentL-test_CSenFragmentBase_OnContentL", CSenFragmentTester::MT_CSenFragmentBase_OnContentLL),
       
   183 		ENTRY("SFB-OnStartPrefixMappingL-test_CSenFragmentBase_OnStartPrefixMappingL", CSenFragmentTester::MT_CSenFragmentBase_OnStartPrefixMappingLL),
       
   184 		ENTRY("SFB-OnEndPrefixMappingL-test_CSenFragmentBase_OnEndPrefixMappingL", CSenFragmentTester::MT_CSenFragmentBase_OnEndPrefixMappingLL),
       
   185 		ENTRY("SFB-OnIgnorableWhiteSpaceL-test_CSenFragmentBase_OnIgnorableWhiteSpaceL", CSenFragmentTester::MT_CSenFragmentBase_OnIgnorableWhiteSpaceLL),
       
   186 		ENTRY("SFB-OnSkippedEntityL-test_CSenFragmentBase_OnSkippedEntityL", CSenFragmentTester::MT_CSenFragmentBase_OnSkippedEntityLL),
       
   187 		ENTRY("SFB-OnProcessingInstructionL-test_CSenFragmentBase_OnProcessingInstructionL", CSenFragmentTester::MT_CSenFragmentBase_OnProcessingInstructionLL),
       
   188 		ENTRY("SFB-OnError-test_CSenFragmentBase_OnError", CSenFragmentTester::MT_CSenFragmentBase_OnErrorL),
       
   189 		ENTRY("SFB-GetExtendedInterface-test_CSenFragmentBase_GetExtendedInterface", CSenFragmentTester::MT_CSenFragmentBase_GetExtendedInterfaceL),
       
   190 		ENTRY("SFB-ContentL-test_CSenFragmentBase_ContentL", CSenFragmentTester::MT_CSenFragmentBase_ContentLL),
       
   191 		ENTRY("SFB-Namespace-test_CSenFragmentBase_Namespace", CSenFragmentTester::MT_CSenFragmentBase_NamespaceL),
       
   192 		ENTRY("SFB-ResetContentL-test_CSenFragmentBase_ResetContentL", CSenFragmentTester::MT_CSenFragmentBase_ResetContentLL),
       
   193 		ENTRY("SFB-LocalName-test_CSenFragmentBase_LocalName", CSenFragmentTester::MT_CSenFragmentBase_LocalNameL),
       
   194 		ENTRY("SFB-NsUri-test_CSenFragmentBase_NsUri", CSenFragmentTester::MT_CSenFragmentBase_NsUriL),
       
   195 		ENTRY("SFB-NsPrefix-test_CSenFragmentBase_NsPrefix", CSenFragmentTester::MT_CSenFragmentBase_NsPrefixL),
       
   196 		ENTRY("SFB-AsElementL-test_CSenFragmentBase_AsElementL", CSenFragmentTester::MT_CSenFragmentBase_AsElementLL),
       
   197 		ENTRY("SFB-AsDocumentL-test_CSenFragmentBase_AsDocumentL", CSenFragmentTester::MT_CSenFragmentBase_AsDocumentLL),
       
   198 		ENTRY("SFB-ExtractElement-test_CSenFragmentBase_ExtractElement", CSenFragmentTester::MT_CSenFragmentBase_ExtractElementL),
       
   199 		ENTRY("SFB-OnDelegateParsingL-test_CSenFragmentBase_OnDelegateParsingL", CSenFragmentTester::MT_CSenFragmentBase_OnDelegateParsingLL),
       
   200 		ENTRY("SFB-OnDelegateParsingL-test_CSenFragmentBase_OnDelegateParsingL", CSenFragmentTester::MT_CSenFragmentBase_OnDelegateParsingL_1L),
       
   201 		ENTRY("SFB-SetOwner-test_CSenFragmentBase_SetOwner", CSenFragmentTester::MT_CSenFragmentBase_SetOwnerL),
       
   202 		ENTRY("SFB-OnResumeParsingFromL-test_CSenFragmentBase_OnResumeParsingFromL", CSenFragmentTester::MT_CSenFragmentBase_OnResumeParsingFromLL),
       
   203 		ENTRY("SFB-OnWriteStartElementL-test_CSenFragmentBase_OnWriteStartElementL", CSenFragmentTester::MT_CSenFragmentBase_OnWriteStartElementLL),
       
   204 		ENTRY("SFB-OnWriteEndElementL-test_CSenFragmentBase_OnWriteEndElementL", CSenFragmentTester::MT_CSenFragmentBase_OnWriteEndElementLL),
       
   205 		ENTRY("SFB-AsXmlUnicodeL-test_CSenFragmentBase_AsXmlUnicodeL", CSenFragmentTester::MT_CSenFragmentBase_AsXmlUnicodeLL),
       
   206 		ENTRY("SFB-AsXmlL-test_CSenFragmentBase_AsXmlL", CSenFragmentTester::MT_CSenFragmentBase_AsXmlLL),
       
   207 		ENTRY("SFB-WriteAsXMLToL-test_CSenFragmentBase_WriteAsXMLToL", CSenFragmentTester::MT_CSenFragmentBase_WriteAsXMLToLL),
       
   208 		ENTRY("SFB-ConsistsOfL-test_CSenFragmentBase_ConsistsOfL", CSenFragmentTester::MT_CSenFragmentBase_ConsistsOfLL),
       
   209 		ENTRY("SFB-SetContentHandler-test_CSenFragmentBase_SetContentHandler", CSenFragmentTester::MT_CSenFragmentBase_SetContentHandlerL),
       
   210 		ENTRY("SFB-Parsing-test_CSenFragmentBase_Parsing", CSenFragmentTester::MT_CSenFragmentBase_Parsing1L),
       
   211 		ENTRY("SFB-Parsingdelegate-test_CSenFragmentBase_Parsing", CSenFragmentTester::MT_CSenFragmentBase_Parsing2L),
       
   212 		ENTRY("SFB-Parsingnamespaces-test_CSenFragmentBase_Parsing", CSenFragmentTester::MT_CSenFragmentBase_Parsing3L),
       
   213 		ENTRY("SFB-Parsingnestedelements-test_CSenFragmentBase_Parsing", CSenFragmentTester::MT_CSenFragmentBase_Parsing4L),
       
   214 		ENTRY("SFB-ParsingelementinsideDOMtree-test_CSenFragmentBase_Parsing", CSenFragmentTester::MT_CSenFragmentBase_Parsing5L),
       
   215 		ENTRY("CSP-NewL-test_CSenParser_NewL", CSenFragmentTester::MT_CSenParser_NewLL),
       
   216 		ENTRY("CSP-NewLC-test_CSenParser_NewLC", CSenFragmentTester::MT_CSenParser_NewLCL),
       
   217 		ENTRY("CSP-NewL1-test_CSenParser_NewL", CSenFragmentTester::MT_CSenParser_NewL_1L),
       
   218 		ENTRY("CSP-NewLC1-test_CSenParser_NewLC", CSenFragmentTester::MT_CSenParser_NewLC_1L),
       
   219 		ENTRY("CSP-NewL2-test_CSenParser_NewL", CSenFragmentTester::MT_CSenParser_NewL_2L),
       
   220 		ENTRY("CSP-NewLC2-test_CSenParser_NewLC", CSenFragmentTester::MT_CSenParser_NewLC_2L),
       
   221 		ENTRY("RSD-NewL-test_RSenDocument_NewL", MT_RSenDocument_NewLL),
       
   222 		ENTRY("RSD-NewLC-test_RSenDocument_NewLC", MT_RSenDocument_NewLCL),
       
   223 		ENTRY("RSD-NewL2-test_RSenDocument_NewL", MT_RSenDocument_NewL_1L),
       
   224 		ENTRY("RSD-NewLC2-test_RSenDocument_NewLC", MT_RSenDocument_NewLC_1L),
       
   225 		ENTRY("RSD-Copy-test_RSenDocument_Copy", MT_RSenDocument_CopyL),
       
   226 		ENTRY("RSD-Close-test_RSenDocument_Close", MT_RSenDocument_CloseL),
       
   227 		ENTRY("RSD-Destroy-test_RSenDocument_Destroy", MT_RSenDocument_DestroyL),
       
   228 
       
   229         };
       
   230 
       
   231     const TInt count = sizeof( KFunctions ) / 
       
   232                         sizeof( TStifFunctionInfo );
       
   233 
       
   234     return RunInternalL( KFunctions, count, aItem );
       
   235 
       
   236     }
       
   237 
       
   238 TInt CSenFragmentTester::MT_CSenDomFragmentBase_NewLL(  )
       
   239     {
       
   240     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL();
       
   241     delete pFragment;
       
   242     return KErrNone;
       
   243     }
       
   244 
       
   245 TInt CSenFragmentTester::MT_CSenDomFragmentBase_NewL_1L(  )
       
   246     {
       
   247     RSenDocument document = RSenDocument::NewL();
       
   248     CleanupClosePushL(document);
       
   249     TXmlEngElement element = document.CreateDocumentElementL(_L8("Test"));
       
   250     element.SetEscapedTextL(_L8("<Element/>"));
       
   251     
       
   252     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(element);
       
   253     CleanupStack::PushL(pFragment);
       
   254     HBufC8* pAsXml = pFragment->AsXmlL();
       
   255     CleanupStack::PushL(pAsXml);
       
   256     // Test that when CSenDomFragmentBase is serialized '<' and '>' characters
       
   257     // are encoded (as all basic entities in content should be).
       
   258     LOCAL_ASSERT( *pAsXml == _L8("<Test>&lt;Element/&gt;</Test>") );
       
   259     CleanupStack::PopAndDestroy(pAsXml);
       
   260     CleanupStack::PopAndDestroy(pFragment);
       
   261     CleanupStack::PopAndDestroy(&document);
       
   262     return KErrNone;
       
   263     }
       
   264 
       
   265 TInt CSenFragmentTester::MT_CSenDomFragmentBase_NewL_2L(  )
       
   266     {
       
   267     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("Test"));
       
   268     CleanupStack::PushL(pFragment);
       
   269     HBufC8* pAsXml = pFragment->AsXmlL();
       
   270     CleanupStack::PushL(pAsXml);
       
   271     LOCAL_ASSERT( *pAsXml == _L8("<Test/>") );
       
   272     CleanupStack::PopAndDestroy(pAsXml);
       
   273     CleanupStack::PopAndDestroy(pFragment);
       
   274     return KErrNone;
       
   275     }
       
   276 
       
   277 TInt CSenFragmentTester::MT_CSenDomFragmentBase_NewL_3L(  )
       
   278     {
       
   279     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("NsUri"),
       
   280                                                                _L8("Test"));
       
   281     CleanupStack::PushL(pFragment);
       
   282     HBufC8* pAsXml = pFragment->AsXmlL();
       
   283     CleanupStack::PushL(pAsXml);
       
   284     LOCAL_ASSERT( *pAsXml == _L8("<Test xmlns=\"NsUri\"/>") );
       
   285     CleanupStack::PopAndDestroy(pAsXml);
       
   286     CleanupStack::PopAndDestroy(pFragment);
       
   287     return KErrNone;
       
   288     }
       
   289 
       
   290 TInt CSenFragmentTester::MT_CSenDomFragmentBase_NewL_4L(  )
       
   291     {
       
   292     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("NsUri"),
       
   293                                                                _L8("Test"),
       
   294                                                                _L8("t"));
       
   295     CleanupStack::PushL(pFragment);
       
   296     HBufC8* pAsXml = pFragment->AsXmlL();
       
   297     CleanupStack::PushL(pAsXml);
       
   298     LOCAL_ASSERT( *pAsXml == _L8("<t:Test xmlns:t=\"NsUri\"/>") );
       
   299     CleanupStack::PopAndDestroy(pAsXml);
       
   300     CleanupStack::PopAndDestroy(pFragment);
       
   301     return KErrNone;
       
   302     }
       
   303 
       
   304 TInt CSenFragmentTester::MT_CSenDomFragmentBase_NewL_5L(  )
       
   305     {
       
   306     RStringPool stringPool;
       
   307     stringPool.OpenL();
       
   308     CleanupClosePushL(stringPool);
       
   309     
       
   310     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
   311     CleanupClosePushL(nsUriRString);
       
   312     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
   313     CleanupClosePushL(nsPrefixRString);
       
   314     RString localNameRString    = stringPool.OpenStringL(_L8("LocalName"));
       
   315     CleanupClosePushL(localNameRString);
       
   316     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
   317     CleanupClosePushL(valueRString);
       
   318     
       
   319     RAttribute attribute;
       
   320     attribute.Open( nsUriRString, nsPrefixRString, localNameRString,
       
   321                     valueRString );
       
   322     // attribute took ownership of all RStrings
       
   323     // => All RStrings can be pop from CleanupStack
       
   324     CleanupStack::Pop(&valueRString);
       
   325     CleanupStack::Pop(&localNameRString);
       
   326     CleanupStack::Pop(&nsPrefixRString);
       
   327     CleanupStack::Pop(&nsUriRString);
       
   328 
       
   329     CleanupClosePushL(attribute);
       
   330 
       
   331     RAttributeArray attrArray;
       
   332     // append the namespace attribute (declaration)
       
   333     attrArray.AppendL(attribute);
       
   334     CleanupClosePushL(attrArray);
       
   335     
       
   336     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("NsUri"),
       
   337                                                                _L8("Test"),
       
   338                                                                _L8("t"),
       
   339                                                                attrArray);
       
   340     CleanupStack::PushL(pFragment);
       
   341     HBufC8* pAsXml = pFragment->AsXmlL();
       
   342     CleanupStack::PushL(pAsXml);
       
   343     LOCAL_ASSERT( *pAsXml == _L8("<t:Test xmlns:t=\"NsUri\" xmlns:pr=\"nsuri\" pr:LocalName=\"Value\"/>") );
       
   344     CleanupStack::PopAndDestroy(pAsXml);
       
   345     CleanupStack::PopAndDestroy(pFragment);
       
   346     CleanupStack::PopAndDestroy(&attrArray);
       
   347     CleanupStack::PopAndDestroy(&attribute);
       
   348     CleanupStack::PopAndDestroy(&stringPool);
       
   349     return KErrNone;
       
   350     }
       
   351 
       
   352 TInt CSenFragmentTester::MT_CSenDomFragmentBase_NewL_6L(  )
       
   353     {
       
   354     RSenDocument document = RSenDocument::NewL();
       
   355     CleanupClosePushL(document);
       
   356     TXmlEngElement parentElement = document.CreateDocumentElementL(_L8("Parent"));
       
   357     
       
   358     RStringPool stringPool;
       
   359     stringPool.OpenL();
       
   360     CleanupClosePushL(stringPool);
       
   361     
       
   362     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
   363     CleanupClosePushL(nsUriRString);
       
   364     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
   365     CleanupClosePushL(nsPrefixRString);
       
   366     RString localNameRString    = stringPool.OpenStringL(_L8("LocalName"));
       
   367     CleanupClosePushL(localNameRString);
       
   368     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
   369     CleanupClosePushL(valueRString);
       
   370     
       
   371     RAttribute attribute;
       
   372     attribute.Open(nsUriRString, nsPrefixRString, localNameRString, 
       
   373                    valueRString);
       
   374     // attribute took ownership of all RStrings
       
   375     // => All RStrings can be pop from CleanupStack
       
   376     CleanupStack::Pop(&valueRString);
       
   377     CleanupStack::Pop(&localNameRString);
       
   378     CleanupStack::Pop(&nsPrefixRString);
       
   379     CleanupStack::Pop(&nsUriRString);
       
   380     
       
   381     CleanupClosePushL(attribute);
       
   382 
       
   383     RAttributeArray attrArray;
       
   384     // append the namespace attribute (declaration)
       
   385     attrArray.AppendL(attribute);
       
   386     CleanupClosePushL(attrArray);
       
   387         
       
   388     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("NsUri"),
       
   389                                                                _L8("Test"),
       
   390                                                                _L8("t"),
       
   391                                                                attrArray,
       
   392                                                                parentElement);
       
   393     CleanupStack::PushL(pFragment);
       
   394     HBufC8* pAsXml = pFragment->AsXmlL();
       
   395     CleanupStack::PushL(pAsXml);
       
   396     LOCAL_ASSERT( *pAsXml == _L8("<t:Test xmlns:t=\"NsUri\" xmlns:pr=\"nsuri\" pr:LocalName=\"Value\"/>") );
       
   397 
       
   398     RBuf8 buffer;
       
   399     parentElement.OuterXmlL(buffer);
       
   400     
       
   401     LOCAL_ASSERT( buffer == _L8("<Parent><t:Test xmlns:t=\"NsUri\" xmlns:pr=\"nsuri\" pr:LocalName=\"Value\"/></Parent>") );
       
   402     buffer.Close();
       
   403     
       
   404     CleanupStack::PopAndDestroy(pAsXml);
       
   405     CleanupStack::PopAndDestroy(pFragment);
       
   406     CleanupStack::PopAndDestroy(&attrArray);
       
   407     CleanupStack::PopAndDestroy(&attribute);
       
   408     CleanupStack::PopAndDestroy(&stringPool);
       
   409     CleanupStack::PopAndDestroy(&document);
       
   410     return KErrNone;
       
   411     }
       
   412 
       
   413 TInt CSenFragmentTester::MT_CSenDomFragmentBase_NewL_7L(  )
       
   414     {
       
   415     RSenDocument document = RSenDocument::NewL();
       
   416     CleanupClosePushL(document);
       
   417     TXmlEngElement parentElement = document.CreateDocumentElementL(_L8("Parent"));
       
   418     
       
   419     RStringPool stringPool;
       
   420     stringPool.OpenL();
       
   421     CleanupClosePushL(stringPool);
       
   422     
       
   423     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
   424     CleanupClosePushL(nsUriRString);
       
   425     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
   426     CleanupClosePushL(nsPrefixRString);
       
   427     RString localNameRString    = stringPool.OpenStringL(_L8("LocalName"));
       
   428     CleanupClosePushL(localNameRString);
       
   429     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
   430     CleanupClosePushL(valueRString);
       
   431     
       
   432     RAttribute attribute;
       
   433     attribute.Open(nsUriRString, nsPrefixRString, localNameRString, 
       
   434                    valueRString);
       
   435     // attribute took ownership of all RStrings
       
   436     // => All RStrings can be pop from CleanupStack
       
   437     CleanupStack::Pop(&valueRString);
       
   438     CleanupStack::Pop(&localNameRString);
       
   439     CleanupStack::Pop(&nsPrefixRString);
       
   440     CleanupStack::Pop(&nsUriRString);
       
   441 
       
   442     CleanupClosePushL(attribute);
       
   443 
       
   444     RAttributeArray attrArray;
       
   445     // append the namespace attribute (declaration)
       
   446     attrArray.AppendL(attribute);
       
   447     CleanupClosePushL(attrArray);
       
   448         
       
   449     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("NsUri"),
       
   450                                                                _L8("Test"),
       
   451                                                                _L8(""),
       
   452                                                                attrArray,
       
   453                                                                parentElement,
       
   454                                                                document);
       
   455     CleanupStack::PushL(pFragment);
       
   456     HBufC8* pAsXml = pFragment->AsXmlL();
       
   457     CleanupStack::PushL(pAsXml);
       
   458     LOCAL_ASSERT( *pAsXml == _L8("<Test xmlns=\"NsUri\" xmlns:pr=\"nsuri\" pr:LocalName=\"Value\"/>") );
       
   459 
       
   460     RBuf8 buffer;
       
   461     parentElement.OuterXmlL(buffer);
       
   462     
       
   463     LOCAL_ASSERT( buffer == _L8("<Parent><Test xmlns=\"NsUri\" xmlns:pr=\"nsuri\" pr:LocalName=\"Value\"/></Parent>") );
       
   464     buffer.Close();
       
   465     
       
   466     CleanupStack::PopAndDestroy(pAsXml);
       
   467     CleanupStack::PopAndDestroy(pFragment);
       
   468     CleanupStack::PopAndDestroy(&attrArray);
       
   469     CleanupStack::PopAndDestroy(&attribute);
       
   470     CleanupStack::PopAndDestroy(&stringPool);
       
   471     CleanupStack::PopAndDestroy(&document);
       
   472     return KErrNone;
       
   473     }
       
   474 
       
   475 TInt CSenFragmentTester::MT_CSenDomFragmentBase_ExpandLL(  )
       
   476     {
       
   477     LOCAL_ASSERT( ETrue );
       
   478     return KErrNone;
       
   479     }
       
   480 
       
   481 TInt CSenFragmentTester::MT_CSenDomFragmentBase_OnResumeParsingFromLL(  )
       
   482     {
       
   483     LOCAL_ASSERT( ETrue );
       
   484     return KErrNone;
       
   485     }
       
   486 
       
   487 TInt CSenFragmentTester::MT_CSenDomFragmentBase_AddAttributesLL(  )
       
   488     {
       
   489     RStringPool stringPool;
       
   490     stringPool.OpenL();
       
   491     CleanupClosePushL(stringPool);
       
   492     
       
   493     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
   494     CleanupClosePushL(nsUriRString);
       
   495     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
   496     CleanupClosePushL(nsPrefixRString);
       
   497     RString localNameRString    = stringPool.OpenStringL(_L8("LocalName"));
       
   498     CleanupClosePushL(localNameRString);
       
   499     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
   500     CleanupClosePushL(valueRString);
       
   501     
       
   502     RAttribute attribute;
       
   503     attribute.Open(nsUriRString, nsPrefixRString, localNameRString, 
       
   504                    valueRString);
       
   505     // attribute took ownership of all RStrings
       
   506     // => All RStrings can be pop from CleanupStack
       
   507     CleanupStack::Pop(4); // nsUriRString, nsPrefixRString, localNameRString,
       
   508                           // valueRString
       
   509     CleanupClosePushL(attribute);
       
   510 
       
   511     RAttributeArray attrArray;
       
   512     // append the namespace attribute (declaration)
       
   513     attrArray.AppendL(attribute);
       
   514     CleanupClosePushL(attrArray);    
       
   515     
       
   516     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("Test"));
       
   517     CleanupStack::PushL(pFragment);
       
   518     
       
   519     pFragment->AddAttributesL(attrArray);
       
   520     HBufC8* pAsXml = pFragment->AsXmlL();
       
   521     CleanupStack::PushL(pAsXml);
       
   522     LOCAL_ASSERT( *pAsXml == _L8("<Test xmlns:pr=\"nsuri\" pr:LocalName=\"Value\"/>") );
       
   523     CleanupStack::PopAndDestroy(pAsXml);
       
   524 
       
   525     CleanupStack::PopAndDestroy(pFragment);
       
   526     
       
   527     CleanupStack::PopAndDestroy(&attrArray);
       
   528     CleanupStack::PopAndDestroy(&attribute);
       
   529     CleanupStack::PopAndDestroy(&stringPool);
       
   530     return KErrNone;
       
   531     }
       
   532 
       
   533 TInt CSenFragmentTester::MT_CSenDomFragmentBase_AsXmlLL(  )
       
   534     {
       
   535     // Test serialization of Dom tree which has two child elements
       
   536     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("Test"));
       
   537     CleanupStack::PushL(pFragment);
       
   538     TXmlEngElement element = pFragment->AsElementL();
       
   539     
       
   540     TXmlEngElement element2 = element.AddNewElementL(_L8("Child"), _L8("nsuri"), _L8("prefix"));
       
   541 
       
   542     element2.AddNewElementL(_L8("Child2"), _L8("nsuri2"), _L8("prefix2"));
       
   543     
       
   544     HBufC8* pAsXml = pFragment->AsXmlL();
       
   545     CleanupStack::PushL(pAsXml);
       
   546     LOCAL_ASSERT( *pAsXml == _L8("<Test xmlns:prefix=\"nsuri\"><prefix:Child xmlns:prefix2=\"nsuri2\"><prefix2:Child2/></prefix:Child></Test>") );
       
   547     CleanupStack::PopAndDestroy(pAsXml);
       
   548     CleanupStack::PopAndDestroy(pFragment);
       
   549     return KErrNone;
       
   550     }
       
   551 
       
   552 TInt CSenFragmentTester::MT_CSenDomFragmentBase_OnStartElementLL(  )
       
   553     {
       
   554     // Will be tested in Parse test cases
       
   555     LOCAL_ASSERT( ETrue );
       
   556     return KErrNone;
       
   557     }
       
   558 
       
   559 TInt CSenFragmentTester::MT_CSenDomFragmentBase_OnContentLL(  )
       
   560     {
       
   561     // Will be tested in Parse test cases
       
   562     LOCAL_ASSERT( ETrue );
       
   563     return KErrNone;
       
   564     }
       
   565 
       
   566 TInt CSenFragmentTester::MT_CSenDomFragmentBase_OnWriteStartElementLL(  )
       
   567     {
       
   568     // Will be tested in Parse test cases
       
   569     LOCAL_ASSERT( ETrue );
       
   570     return KErrNone;
       
   571     }
       
   572 
       
   573 TInt CSenFragmentTester::MT_CSenDomFragmentBase_OnWriteEndElementLL(  )
       
   574     {
       
   575     // Will be tested in Parse test cases
       
   576     LOCAL_ASSERT( ETrue );
       
   577     return KErrNone;
       
   578     }
       
   579 
       
   580 TInt CSenFragmentTester::MT_CSenDomFragmentBase_OnEndElementLL(  )
       
   581     {
       
   582     // Will be tested in Parse test cases
       
   583     LOCAL_ASSERT( ETrue );
       
   584     return KErrNone;
       
   585     }
       
   586 
       
   587 TInt CSenFragmentTester::MT_CSenDomFragmentBase_OnStartDocumentLL(  )
       
   588     {
       
   589     // Will be tested in Parse test cases
       
   590     LOCAL_ASSERT( ETrue );
       
   591     return KErrNone;
       
   592     }
       
   593 
       
   594 TInt CSenFragmentTester::MT_CSenDomFragmentBase_OnEndDocumentLL(  )
       
   595     {
       
   596     // Will be tested in Parse test cases
       
   597     LOCAL_ASSERT( ETrue );
       
   598     return KErrNone;
       
   599     }
       
   600 
       
   601 TInt CSenFragmentTester::MT_CSenDomFragmentBase_OnStartPrefixMappingLL(  )
       
   602     {
       
   603     // Will be tested in Parse test cases
       
   604     LOCAL_ASSERT( ETrue );
       
   605     return KErrNone;
       
   606     }
       
   607 
       
   608 TInt CSenFragmentTester::MT_CSenDomFragmentBase_OnEndPrefixMappingLL(  )
       
   609     {
       
   610     // Will be tested in Parse test cases
       
   611     LOCAL_ASSERT( ETrue );
       
   612     return KErrNone;
       
   613     }
       
   614 
       
   615 TInt CSenFragmentTester::MT_CSenDomFragmentBase_OnIgnorableWhiteSpaceLL(  )
       
   616     {
       
   617     // Will be tested in Parse test cases
       
   618     LOCAL_ASSERT( ETrue );
       
   619     return KErrNone;
       
   620     }
       
   621 
       
   622 TInt CSenFragmentTester::MT_CSenDomFragmentBase_OnSkippedEntityLL(  )
       
   623     {
       
   624     // Will be tested in Parse test cases
       
   625     LOCAL_ASSERT( ETrue );
       
   626     return KErrNone;
       
   627     }
       
   628 
       
   629 TInt CSenFragmentTester::MT_CSenDomFragmentBase_OnProcessingInstructionLL(  )
       
   630     {
       
   631     // Will be tested in Parse test cases
       
   632     LOCAL_ASSERT( ETrue );
       
   633     return KErrNone;
       
   634     }
       
   635 
       
   636 TInt CSenFragmentTester::MT_CSenDomFragmentBase_OnErrorL(  )
       
   637     {
       
   638     // Will be tested in Parse test cases
       
   639     LOCAL_ASSERT( ETrue );
       
   640     return KErrNone;
       
   641     }
       
   642 
       
   643 TInt CSenFragmentTester::MT_CSenDomFragmentBase_GetExtendedInterfaceL(  )
       
   644     {
       
   645     // Will be tested in Parse test cases
       
   646     LOCAL_ASSERT( ETrue );
       
   647     return KErrNone;
       
   648     }
       
   649 
       
   650 TInt CSenFragmentTester::MT_CSenDomFragmentBase_ContentLL(  )
       
   651     {
       
   652     RSenDocument document = RSenDocument::NewL();
       
   653     CleanupClosePushL(document);
       
   654     TXmlEngElement element = document.CreateDocumentElementL(_L8("Test"));
       
   655     element.SetEscapedTextL(_L8("<Element/>"));
       
   656     
       
   657     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(element);
       
   658     CleanupStack::PushL(pFragment);
       
   659     
       
   660     TPtrC8 content = pFragment->ContentL();
       
   661     LOCAL_ASSERT( content == _L8("<Element/>") );
       
   662     
       
   663     CleanupStack::PopAndDestroy(pFragment);
       
   664     CleanupStack::PopAndDestroy(&document);
       
   665     return KErrNone;
       
   666     }
       
   667 
       
   668 TInt CSenFragmentTester::MT_CSenDomFragmentBase_NamespaceL(  )
       
   669     {
       
   670     RStringPool stringPool;
       
   671     stringPool.OpenL();
       
   672     CleanupClosePushL(stringPool);
       
   673     
       
   674     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
   675     CleanupClosePushL(nsUriRString);
       
   676     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
   677     CleanupClosePushL(nsPrefixRString);
       
   678     RString localNameRString    = stringPool.OpenStringL(_L8("LocalName"));
       
   679     CleanupClosePushL(localNameRString);
       
   680     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
   681     CleanupClosePushL(valueRString);
       
   682     
       
   683     RAttribute attribute;
       
   684     attribute.Open(stringPool.OpenStringL(_L8("nsuri")), 
       
   685                    stringPool.OpenStringL(_L8("pr")),
       
   686                    stringPool.OpenStringL(_L8("LocalName")),
       
   687                    stringPool.OpenStringL(_L8("Value")) );
       
   688     // attribute took copies of all RStrings
       
   689     // => All RStrings can be destroyed
       
   690     CleanupStack::PopAndDestroy(4); // nsUriRString, nsPrefixRString, localNameRString,
       
   691                                     // valueRString
       
   692     CleanupClosePushL(attribute);
       
   693 
       
   694     RAttributeArray attrArray;
       
   695     // append the namespace attribute (declaration)
       
   696     attrArray.AppendL(attribute);
       
   697     CleanupClosePushL(attrArray);
       
   698     
       
   699     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("NsUri"),
       
   700                                                                _L8("Test"),
       
   701                                                                _L8("t"),
       
   702                                                                attrArray);
       
   703     CleanupStack::PushL(pFragment);
       
   704     
       
   705     TXmlEngNamespace ns = pFragment->Namespace(_L8("pr"));
       
   706     LOCAL_ASSERT( ns.Uri() == _L8("nsuri") );
       
   707 
       
   708     TXmlEngNamespace ns2 = pFragment->Namespace(_L8("x"));
       
   709     LOCAL_ASSERT( ns2.IsNull() );
       
   710     
       
   711     CleanupStack::PopAndDestroy(pFragment);
       
   712     CleanupStack::PopAndDestroy(); // attribute
       
   713     CleanupStack::PopAndDestroy(); // attrArray
       
   714     CleanupStack::PopAndDestroy(); // stringPool    
       
   715     return KErrNone;
       
   716     }
       
   717 
       
   718 TInt CSenFragmentTester::MT_CSenDomFragmentBase_ResetContentLL(  )
       
   719     {
       
   720     RSenDocument document = RSenDocument::NewL();
       
   721     CleanupClosePushL(document);
       
   722     TXmlEngElement element = document.CreateDocumentElementL(_L8("Test"));
       
   723     element.SetEscapedTextL(_L8("Content"));
       
   724     
       
   725     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(element);
       
   726     CleanupStack::PushL(pFragment);
       
   727     
       
   728     // Test that CSenFragmentBase has content before reset
       
   729     TPtrC8 content = pFragment->ContentL();
       
   730     LOCAL_ASSERT( content == _L8("Content") );
       
   731     
       
   732     pFragment->ResetContentL();
       
   733     
       
   734     // Test that CSenFragmentBase has no content after reset
       
   735     TPtrC8 content2 = pFragment->ContentL();
       
   736     LOCAL_ASSERT( content2 == KNullDesC8 );
       
   737     
       
   738     CleanupStack::PopAndDestroy(pFragment);
       
   739     CleanupStack::PopAndDestroy(&document);
       
   740     return KErrNone;
       
   741     }
       
   742 
       
   743 TInt CSenFragmentTester::MT_CSenDomFragmentBase_LocalNameL(  )
       
   744     {
       
   745     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("NsUri"),
       
   746                                                                _L8("Test"),
       
   747                                                                _L8("t"));
       
   748     CleanupStack::PushL(pFragment);
       
   749     TPtrC8 localName = pFragment->LocalName();
       
   750     LOCAL_ASSERT( localName == _L8("Test") );
       
   751     CleanupStack::PopAndDestroy(pFragment);
       
   752     return KErrNone;
       
   753     }
       
   754 
       
   755 TInt CSenFragmentTester::MT_CSenDomFragmentBase_NsUriL(  )
       
   756     {
       
   757     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("NsUri"),
       
   758                                                                _L8("Test"),
       
   759                                                                _L8("t"));
       
   760     CleanupStack::PushL(pFragment);
       
   761     TPtrC8 localName = pFragment->NsUri();
       
   762     LOCAL_ASSERT( localName == _L8("NsUri") );
       
   763     CleanupStack::PopAndDestroy(pFragment);
       
   764     return KErrNone;
       
   765     }
       
   766 
       
   767 TInt CSenFragmentTester::MT_CSenDomFragmentBase_NsPrefixL(  )
       
   768     {
       
   769     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("NsUri"),
       
   770                                                                _L8("Test"),
       
   771                                                                _L8("t"));
       
   772     CleanupStack::PushL(pFragment);
       
   773     TPtrC8 localName = pFragment->NsPrefix();
       
   774     LOCAL_ASSERT( localName == _L8("t") );
       
   775     CleanupStack::PopAndDestroy(pFragment);
       
   776     return KErrNone;
       
   777     }
       
   778 
       
   779 TInt CSenFragmentTester::MT_CSenDomFragmentBase_AsElementLL(  )
       
   780     {
       
   781     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("NsUri"),
       
   782                                                                _L8("Test"),
       
   783                                                                _L8("t"));
       
   784     CleanupStack::PushL(pFragment);
       
   785     TXmlEngElement element = pFragment->AsElementL();
       
   786     RBuf8 buffer;
       
   787     CleanupClosePushL(buffer);
       
   788     element.OuterXmlL(buffer);
       
   789     // Serialized element should contain all the Fragment data as XML.
       
   790     LOCAL_ASSERT( buffer == _L8("<t:Test xmlns:t=\"NsUri\"/>") );
       
   791     CleanupStack::PopAndDestroy(&buffer);
       
   792     CleanupStack::PopAndDestroy(pFragment);
       
   793     return KErrNone;
       
   794     }
       
   795 
       
   796 TInt CSenFragmentTester::MT_CSenDomFragmentBase_AsDocumentLL(  )
       
   797     {
       
   798     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("NsUri"),
       
   799                                                                _L8("Test"),
       
   800                                                                _L8("t"));
       
   801     CleanupStack::PushL(pFragment);
       
   802     RSenDocument document = pFragment->AsDocumentL();
       
   803     TXmlEngElement element = document.DocumentElement();
       
   804     
       
   805     TXmlEngSerializationOptions options;
       
   806     // Omit following declarations from the beginning of XML Document:
       
   807     // <?xml version=\"1.0\...
       
   808     //   encoding="..."
       
   809     //   standalone="..."
       
   810     // ?>
       
   811     options.iOptions = options.iOptions |
       
   812                        TXmlEngSerializationOptions::KOptionOmitXMLDeclaration;
       
   813     RBuf8 asXml;
       
   814     document.SaveL(asXml, element, options);
       
   815     CleanupClosePushL(asXml);
       
   816     
       
   817     // Serialized document should contain all the Fragment data as XML.
       
   818     LOCAL_ASSERT( asXml == _L8("<t:Test xmlns:t=\"NsUri\"/>") );
       
   819 
       
   820     CleanupStack::PopAndDestroy(&asXml);
       
   821     CleanupStack::PopAndDestroy(pFragment);
       
   822     return KErrNone;
       
   823     }
       
   824 
       
   825 TInt CSenFragmentTester::MT_CSenDomFragmentBase_ExtractElementL(  )
       
   826     {
       
   827     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("NsUri"),
       
   828                                                                _L8("Test"),
       
   829                                                                _L8("t"));
       
   830     CleanupStack::PushL(pFragment);
       
   831     TXmlEngElement element = pFragment->ExtractElement();
       
   832     LOCAL_ASSERT( element.Name() == _L8("Test") );
       
   833     element.Remove();
       
   834     CleanupStack::PopAndDestroy(pFragment);    
       
   835     return KErrNone;
       
   836     }
       
   837 
       
   838 TInt CSenFragmentTester::MT_CSenDomFragmentBase_OnDelegateParsingLL(  )
       
   839     {
       
   840     // Will be tested in Parse test cases
       
   841     LOCAL_ASSERT( ETrue );
       
   842     return KErrNone;
       
   843     }
       
   844 
       
   845 TInt CSenFragmentTester::MT_CSenDomFragmentBase_OnDelegateParsingL_1L(  )
       
   846     {
       
   847     // Will be tested in Parse test cases
       
   848     LOCAL_ASSERT( ETrue );
       
   849     return KErrNone;
       
   850     }
       
   851 
       
   852 TInt CSenFragmentTester::MT_CSenDomFragmentBase_SetOwnerL(  )
       
   853     {
       
   854     // Will be tested in Parse test cases
       
   855     LOCAL_ASSERT( ETrue );
       
   856     return KErrNone;
       
   857     }
       
   858 
       
   859 TInt CSenFragmentTester::MT_CSenDomFragmentBase_AsXmlUnicodeLL(  )
       
   860     {
       
   861     // Test serialization of Dom tree which has two child elements
       
   862     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("Test"));
       
   863     CleanupStack::PushL(pFragment);
       
   864     TXmlEngElement element = pFragment->AsElementL();
       
   865     
       
   866     TXmlEngElement element2 = element.AddNewElementL(_L8("Child"), _L8("nsuri"), _L8("prefix"));
       
   867 
       
   868     element2.AddNewElementL(_L8("Child2"), _L8("nsuri2"), _L8("prefix2"));
       
   869     
       
   870     HBufC* pAsXml = pFragment->AsXmlUnicodeL();
       
   871     CleanupStack::PushL(pAsXml);
       
   872     LOCAL_ASSERT( *pAsXml == _L("<Test xmlns:prefix=\"nsuri\"><prefix:Child xmlns:prefix2=\"nsuri2\"><prefix2:Child2/></prefix:Child></Test>") );
       
   873     CleanupStack::PopAndDestroy(pAsXml);
       
   874     CleanupStack::PopAndDestroy(pFragment);
       
   875     return KErrNone;
       
   876     }
       
   877 
       
   878 TInt CSenFragmentTester::MT_CSenDomFragmentBase_WriteAsXMLToLL(  )
       
   879     {
       
   880     // Test serialization of Dom tree which has two child elements
       
   881     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("Test"));
       
   882     CleanupStack::PushL(pFragment);
       
   883     TXmlEngElement element = pFragment->AsElementL();
       
   884     
       
   885     TXmlEngElement element2 = element.AddNewElementL(_L8("Child"), _L8("nsuri"), _L8("prefix"));
       
   886 
       
   887     element2.AddNewElementL(_L8("Child2"), _L8("nsuri2"), _L8("prefix2"));
       
   888     CBufFlat* pBuf = CBufFlat::NewL(200);
       
   889     CleanupStack::PushL(pBuf);
       
   890     RBufWriteStream bufWs(*pBuf);
       
   891     CleanupClosePushL(bufWs);
       
   892     pFragment->WriteAsXMLToL(bufWs);
       
   893 
       
   894 
       
   895     LOCAL_ASSERT( pBuf->Ptr(0) == _L8("<Test xmlns:prefix=\"nsuri\"><prefix:Child xmlns:prefix2=\"nsuri2\"><prefix2:Child2/></prefix:Child></Test>") );
       
   896     
       
   897     CleanupStack::PopAndDestroy(&bufWs);
       
   898     CleanupStack::PopAndDestroy(pBuf);
       
   899     
       
   900     CleanupStack::PopAndDestroy(pFragment);
       
   901     return KErrNone;
       
   902     }
       
   903 
       
   904 TInt CSenFragmentTester::MT_CSenDomFragmentBase_ConsistsOfLL(  )
       
   905     {
       
   906     TDomUtils domUtils;
       
   907     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("Test"));
       
   908     CleanupStack::PushL(pFragment);
       
   909     TXmlEngElement element = pFragment->AsElementL();
       
   910     
       
   911     TXmlEngElement elementchild1 = element.AddNewElementL(_L8("DirectChild"));
       
   912     elementchild1.AddNamespaceDeclarationL(_L8("nsuri"), _L8("prefix"));
       
   913     //elementchild1.RenameNodeL(_L8("DirectChild"), _L8("nsuri"), _L8("prefix"));
       
   914     
       
   915     domUtils.XmlEngRenameElementL(elementchild1, _L8("DirectChild"), _L8("nsuri"), _L8("prefix"));
       
   916 
       
   917     TXmlEngElement elementchild2 = element.AddNewElementL(_L8("DirectChild"));
       
   918     elementchild2.AddNamespaceDeclarationL(_L8("nsuri"), _L8("prefix"));
       
   919     //elementchild2.RenameNodeL(_L8("DirectChild"), _L8("nsuri"), _L8("prefix"));
       
   920     domUtils.XmlEngRenameElementL(elementchild2, _L8("DirectChild"), _L8("nsuri"), _L8("prefix"));
       
   921 
       
   922     elementchild2.AddNewElementL(_L8("Child"), _L8("nsuri2"), _L8("prefix2"));
       
   923 
       
   924     CSenDomFragmentBase* pFragment2 = CSenDomFragmentBase::NewL(_L8("Test"));
       
   925     CleanupStack::PushL(pFragment2);
       
   926     TXmlEngElement element2 = pFragment2->AsElementL();
       
   927     
       
   928     TXmlEngElement elementchild22 = element2.AddNewElementL(_L8("DirectChild"));
       
   929     elementchild22.AddNamespaceDeclarationL(_L8("nsuri"), _L8("prefix"));
       
   930     //elementchild22.RenameNodeL(_L8("DirectChild"), _L8("nsuri"), _L8("prefix"));
       
   931     domUtils.XmlEngRenameElementL(elementchild22, _L8("DirectChild"), _L8("nsuri"), _L8("prefix"));
       
   932 
       
   933     elementchild22.AddNewElementL(_L8("Child"), _L8("nsuri2"), _L8("prefix2"));
       
   934 
       
   935     // ConsistOfL should return ETrue because
       
   936     // root elements of both fragments match and the only element
       
   937     // of pFragment2 = elementchild22 is exactly the same element as
       
   938     // elementchild2.
       
   939     LOCAL_ASSERT( pFragment->ConsistsOfL(*pFragment2) );
       
   940 
       
   941     // ConsistOfL should return EFalse because
       
   942     // Even though root elements of both fragments match
       
   943     // there is extra element (= elementchild1) in pFragment.
       
   944     //
       
   945     // elementchild1 (of pFragment) can not be found from pFragment2
       
   946     // and because of that pFragment2 does not consist of pFragment.
       
   947     LOCAL_ASSERT( !pFragment2->ConsistsOfL(*pFragment) );
       
   948     CleanupStack::PopAndDestroy(pFragment2);
       
   949 
       
   950     CSenDomFragmentBase* pFragment3 = CSenDomFragmentBase::NewL(_L8("Test"));
       
   951     CleanupStack::PushL(pFragment3);
       
   952     TXmlEngElement element3 = pFragment3->AsElementL();
       
   953     
       
   954     TXmlEngElement elementchild32 = element3.AddNewElementL(_L8("DirectChild"));
       
   955     elementchild32.AddNamespaceDeclarationL(_L8("nsuri"), _L8("prefix"));
       
   956     //elementchild32.RenameNodeL(_L8("DirectChild"), _L8("nsuri"), _L8("prefix"));
       
   957     domUtils.XmlEngRenameElementL(elementchild32, _L8("DirectChild"), _L8("nsuri"), _L8("prefix"));
       
   958 
       
   959     elementchild32.AddNewElementL(_L8("Child"), _L8("nsuri2"), _L8("prefix2"));
       
   960     elementchild32.SetEscapedTextL(_L8("Text"));
       
   961     
       
   962     // ConsistOfL should return EFalse because
       
   963     // elementchild32 has content ("Text") which doesn't match
       
   964     // to any child element of pFragment.
       
   965     LOCAL_ASSERT( !pFragment->ConsistsOfL(*pFragment3) );
       
   966     CleanupStack::PopAndDestroy(pFragment3);
       
   967     
       
   968     CleanupStack::PopAndDestroy(pFragment);
       
   969     return KErrNone;
       
   970     }
       
   971 
       
   972 TInt CSenFragmentTester::MT_CSenDomFragmentBase_SetContentHandlerL(  )
       
   973     {
       
   974     // Will be tested in Parse test cases
       
   975     LOCAL_ASSERT( ETrue );
       
   976     return KErrNone;
       
   977     }
       
   978 
       
   979 TInt CSenFragmentTester::MT_CSenDomFragmentBase_Parsing1L(  )
       
   980     {
       
   981     // Parsing of XML document to CSenDomFragmentBase
       
   982     _LIT8(KInputString, "<a:Test xmlns=\"nsuri\" xmlns:a=\"nasuria\" \
       
   983 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\">\
       
   984 <Element1 xmlns:c=\"nsuric\" c:x=\"value3\">Content1</Element1>\
       
   985 <Element2 z=\"value4\">Content2</Element2>\
       
   986 <Element3>Content3</Element3>\
       
   987 <Element4/></a:Test>");
       
   988 
       
   989     // Default namespace declaration (xmlns="nsuri") from Parent element (Test)
       
   990     // will be moved to all child elements (Element1, Element2, Element3 and
       
   991     // Element4) when EReportNamespaceMapping is _NOT_ enabled. That's because
       
   992     // the way CParser works <=> Namespaces are reported when namespaces are used
       
   993     // for the first time.
       
   994     _LIT8(KOutputString1, "<a:Test xmlns:a=\"nasuria\" xmlns:b=\"nasurib\" \
       
   995 a:x=\"value1\" b:z=\"value2\">\
       
   996 <Element1 xmlns=\"nsuri\" xmlns:c=\"nsuric\" c:x=\"value3\">Content1</Element1>\
       
   997 <Element2 xmlns=\"nsuri\" z=\"value4\">Content2</Element2>\
       
   998 <Element3 xmlns=\"nsuri\">Content3</Element3>\
       
   999 <Element4 xmlns=\"nsuri\"/></a:Test>");
       
  1000 
       
  1001     // When EReportNamespaceMapping is enabled all the namespace declarations
       
  1002     // are reported in exactly the same element as they are defined in parsed
       
  1003     // XML document.
       
  1004     // Note: The Order of namespace declarations in root element tag may change.
       
  1005     // Namespace declaration for root tag is created when fragment is created
       
  1006     // and because of that namespace declaration for root tag will be the first.
       
  1007     // In this particular case namespace declaration for prefix "a" will be
       
  1008     // the first namespace declaration because it is declared when
       
  1009     // CSenDomFragmentBase is created.
       
  1010     _LIT8(KOutputString2, "<a:Test xmlns:a=\"nasuria\" xmlns=\"nsuri\" \
       
  1011 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\">\
       
  1012 <Element1 xmlns:c=\"nsuric\" c:x=\"value3\">Content1</Element1>\
       
  1013 <Element2 z=\"value4\">Content2</Element2>\
       
  1014 <Element3>Content3</Element3>\
       
  1015 <Element4/></a:Test>"); 
       
  1016     
       
  1017 	CSenParser* pParser = CSenParser::NewLC();
       
  1018 	
       
  1019     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("nasuria"),_L8("Test"),_L8("a"));
       
  1020     CleanupStack::PushL(pFragment);
       
  1021 	
       
  1022 	pParser->ParseL(KInputString, *pFragment);
       
  1023 	
       
  1024 	HBufC8* pAsXml = pFragment->AsXmlL();
       
  1025 	CleanupStack::PushL(pAsXml);
       
  1026 
       
  1027     LOCAL_ASSERT( *pAsXml == KOutputString1 );
       
  1028 
       
  1029     CleanupStack::PopAndDestroy(pAsXml);
       
  1030     CleanupStack::PopAndDestroy(pFragment);
       
  1031 /*
       
  1032 	pParser->EnableFeature(EReportNamespaceMapping);
       
  1033 	//tma
       
  1034 	pParser->DisableFeature(EReportNamespaceMapping);
       
  1035 	TBool fEneabled(EFalse);
       
  1036 	fEneabled = pParser->IsFeatureEnabled(EReportNamespaceMapping);
       
  1037 	LOCAL_ASSERT( fEneabled == EFalse);
       
  1038 	pParser->EnableFeature(EReportNamespaceMapping);
       
  1039 	//tma
       
  1040 */	
       
  1041 	pParser->EnableFeature(EReportNamespaceMapping);
       
  1042 	
       
  1043     CSenDomFragmentBase* pFragment2 = CSenDomFragmentBase::NewL(_L8("nasuria"),_L8("Test"),_L8("a"));
       
  1044     CleanupStack::PushL(pFragment2);
       
  1045 
       
  1046 	pParser->ParseL(KInputString, *pFragment2);
       
  1047 	
       
  1048 	HBufC8* pAsXml2 = pFragment2->AsXmlL();
       
  1049 	CleanupStack::PushL(pAsXml2);
       
  1050 	                   
       
  1051     LOCAL_ASSERT( *pAsXml2 == KOutputString2 );
       
  1052     
       
  1053     CleanupStack::PopAndDestroy(pAsXml2);
       
  1054     CleanupStack::PopAndDestroy(pFragment2);
       
  1055 
       
  1056     CleanupStack::PopAndDestroy(pParser);
       
  1057     return KErrNone;
       
  1058     }
       
  1059     
       
  1060 TInt CSenFragmentTester::MT_CSenDomFragmentBase_Parsing2L(  )
       
  1061     {
       
  1062     // Parsing of XML document to CSenDomFragmentBase which uses
       
  1063     // delegation.
       
  1064     _LIT8(KInputString, "<a:Test xmlns:a=\"nasuria\" xmlns:b=\"nsurib\" \
       
  1065 xmlns=\"nsuri\" a:x=\"value1\" b:z=\"value2\">\
       
  1066 <DelegateFragment>DelegateContent</DelegateFragment>\
       
  1067 <Element1 x=\"value4\">Content1</Element1>\
       
  1068 <Element2>Content2</Element2></a:Test>");
       
  1069 
       
  1070     // Default namespace declaration (xmlns="nsuri") from Parent element (Test)
       
  1071     // will be moved to all child elements (Element1, Element2, Element3 and
       
  1072     // Element4) when EReportNamespaceMapping is _NOT_ enabled. That's because
       
  1073     // the way CParser works <=> Namespaces are reported when namespaces are used
       
  1074     // for the first time.
       
  1075     _LIT8(KOutputString1, "<a:Test xmlns:a=\"nasuria\" xmlns:b=\"nsurib\" \
       
  1076 a:x=\"value1\" b:z=\"value2\">\
       
  1077 <DelegateFragment xmlns=\"nsuri\">DelegateContent</DelegateFragment>\
       
  1078 <Element1 xmlns=\"nsuri\" x=\"value4\">Content1</Element1>\
       
  1079 <Element2 xmlns=\"nsuri\">Content2</Element2></a:Test>");
       
  1080 
       
  1081     // When EReportNamespaceMapping is enabled all the namespace declarations
       
  1082     // are reported in exactly the same element as they are defined in parsed
       
  1083     // XML document.
       
  1084     // Note: The Order of namespace declarations in root element tag may change.
       
  1085     // Namespace declaration for root tag is created when fragment is created
       
  1086     // and because of that namespace declaration for root tag will be the first.
       
  1087     _LIT8(KOutputString2, "<a:Test xmlns:a=\"nasuria\" xmlns:b=\"nsurib\" \
       
  1088 xmlns=\"nsuri\" a:x=\"value1\" b:z=\"value2\">\
       
  1089 <DelegateFragment>DelegateContent</DelegateFragment>\
       
  1090 <Element1 x=\"value4\">Content1</Element1>\
       
  1091 <Element2>Content2</Element2></a:Test>");
       
  1092      
       
  1093 	CSenParser* pParser = CSenParser::NewLC();
       
  1094 	
       
  1095     CMainDomFragment* pFragment = CMainDomFragment::NewL(_L8("nasuria"),_L8("Test"),_L8("a"));
       
  1096     CleanupStack::PushL(pFragment);
       
  1097 	
       
  1098 	pParser->ParseL(KInputString, *pFragment);
       
  1099 	
       
  1100 	HBufC8* pAsXml = pFragment->AsXmlL();
       
  1101 	CleanupStack::PushL(pAsXml);
       
  1102     LOCAL_ASSERT( *pAsXml == KOutputString1 );
       
  1103     CleanupStack::PopAndDestroy(pAsXml);
       
  1104     
       
  1105     CDelegateDomFragment& delegate = pFragment->DelegateFragment();
       
  1106     HBufC8* pDelegateAsXml = delegate.AsXmlL();
       
  1107     CleanupStack::PushL(pDelegateAsXml);
       
  1108     // Note: When EReportNamespaceMapping is _NOT_ enabled namespace declaration
       
  1109     //       is added to delegate even though that namespace declaration was
       
  1110     //       originally declared (but not used) in root element of parsed document. 
       
  1111     LOCAL_ASSERT( *pDelegateAsXml ==
       
  1112                  _L8("<DelegateFragment xmlns=\"nsuri\">DelegateContent</DelegateFragment>") );
       
  1113     CleanupStack::PopAndDestroy(pDelegateAsXml);
       
  1114     
       
  1115     CleanupStack::PopAndDestroy(pFragment);
       
  1116 
       
  1117 	pParser->EnableFeature(EReportNamespaceMapping);
       
  1118 	
       
  1119     CMainDomFragment* pFragment2 = CMainDomFragment::NewL(_L8("nasuria"),_L8("Test"),_L8("a"));
       
  1120     CleanupStack::PushL(pFragment2);
       
  1121 
       
  1122 	pParser->ParseL(KInputString, *pFragment2);
       
  1123 	
       
  1124 	HBufC8* pAsXml2 = pFragment2->AsXmlL();
       
  1125 	CleanupStack::PushL(pAsXml2);
       
  1126     LOCAL_ASSERT( *pAsXml2 == KOutputString2 );
       
  1127     CleanupStack::PopAndDestroy(pAsXml2);
       
  1128     
       
  1129     CDelegateDomFragment& delegate2 = pFragment2->DelegateFragment();
       
  1130     HBufC8* pDelegateAsXml2 = delegate2.AsXmlL();
       
  1131     CleanupStack::PushL(pDelegateAsXml2);
       
  1132     LOCAL_ASSERT( *pDelegateAsXml2 ==
       
  1133                  _L8("<DelegateFragment>DelegateContent</DelegateFragment>") );
       
  1134     CleanupStack::PopAndDestroy(pDelegateAsXml2);
       
  1135     
       
  1136     CleanupStack::PopAndDestroy(pFragment2);
       
  1137 
       
  1138     CleanupStack::PopAndDestroy(pParser);
       
  1139     return KErrNone;
       
  1140     }
       
  1141     
       
  1142 TInt CSenFragmentTester::MT_CSenDomFragmentBase_Parsing3L(  )
       
  1143     {
       
  1144     // Parsing of XML document to CSenDomFragmentBase
       
  1145     // In this test same namespaceuri is defined as default namespace in
       
  1146     // root element and 'c' prefixed namespace in Element2.
       
  1147     _LIT8(KInputString, "<a:Test xmlns=\"nsuri\" xmlns:a=\"nasuria\" \
       
  1148 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\" z=\"value3\">\
       
  1149 <Element1 xmlns:c=\"nsuric\" c:x=\"value4\">Content1</Element1>\
       
  1150 <x:Element2 xmlns:x=\"nsuri\">Content2</x:Element2>\
       
  1151 <Element3>Content3</Element3>\
       
  1152 <Element4/></a:Test>");
       
  1153 
       
  1154     // Namespace declaration for prefix 'x' (and namespaceuri "nsuri")
       
  1155     // disappears from Element2 after parsing because default namespace
       
  1156     // declaration already declares namespace for uri "nsuri".
       
  1157     // => Double declaration for namespaceuri "nsuri" is not needed.
       
  1158     _LIT8(KOutputString, "<a:Test xmlns:a=\"nasuria\" xmlns=\"nsuri\" \
       
  1159 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\" z=\"value3\">\
       
  1160 <Element1 xmlns:c=\"nsuric\" c:x=\"value4\">Content1</Element1>\
       
  1161 <Element2>Content2</Element2>\
       
  1162 <Element3>Content3</Element3>\
       
  1163 <Element4/></a:Test>");
       
  1164     
       
  1165 	CSenParser* pParser = CSenParser::NewLC();
       
  1166 	
       
  1167     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("nasuria"),_L8("Test"),_L8("a"));
       
  1168     CleanupStack::PushL(pFragment);
       
  1169 	pParser->EnableFeature(EReportNamespaceMapping);
       
  1170 	
       
  1171 	pParser->ParseL(KInputString, *pFragment);
       
  1172 	
       
  1173 	HBufC8* pAsXml = pFragment->AsXmlL();
       
  1174 	CleanupStack::PushL(pAsXml);
       
  1175 
       
  1176     LOCAL_ASSERT( *pAsXml == KOutputString );
       
  1177 
       
  1178     CleanupStack::PopAndDestroy(pAsXml);
       
  1179     CleanupStack::PopAndDestroy(pFragment);
       
  1180     CleanupStack::PopAndDestroy(pParser);
       
  1181     return KErrNone;
       
  1182     }    
       
  1183 
       
  1184 TInt CSenFragmentTester::MT_CSenDomFragmentBase_Parsing4L(  )
       
  1185     {
       
  1186     // Parsing of XML document to CSenDomFragmentBase
       
  1187     // In this test nested elements (which have same name) are tested.
       
  1188     _LIT8(KInputString, "<a:Test xmlns=\"nsuri\" xmlns:a=\"nasuria\" \
       
  1189 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\" z=\"value3\">\
       
  1190 <Element1 xmlns:c=\"nsuric\" c:x=\"value4\">\
       
  1191 <Element1>Content</Element1>\
       
  1192 </Element1>\
       
  1193 <Element3>Content3</Element3>\
       
  1194 <Element4/></a:Test>");
       
  1195 
       
  1196     _LIT8(KInputString2, "<Nested xmlns=\"nsuri\">\
       
  1197 <Nested attr=\"attrvalue\"><Nested><Nested>Content</Nested></Nested></Nested>\
       
  1198 </Nested>");
       
  1199 
       
  1200     // Only namespace declaration order changes for output.
       
  1201     _LIT8(KOutputString, "<a:Test xmlns:a=\"nasuria\" xmlns=\"nsuri\" \
       
  1202 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\" z=\"value3\">\
       
  1203 <Element1 xmlns:c=\"nsuric\" c:x=\"value4\">\
       
  1204 <Element1>Content</Element1>\
       
  1205 </Element1>\
       
  1206 <Element3>Content3</Element3>\
       
  1207 <Element4/></a:Test>");
       
  1208 
       
  1209 	CSenParser* pParser = CSenParser::NewLC();
       
  1210 	
       
  1211     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("nasuria"),_L8("Test"),_L8("a"));
       
  1212     CleanupStack::PushL(pFragment);
       
  1213 	pParser->EnableFeature(EReportNamespaceMapping);
       
  1214 	
       
  1215 	pParser->ParseL(KInputString, *pFragment);
       
  1216 	
       
  1217 	HBufC8* pAsXml = pFragment->AsXmlL();
       
  1218 	CleanupStack::PushL(pAsXml);
       
  1219 
       
  1220     LOCAL_ASSERT( *pAsXml == KOutputString );
       
  1221 
       
  1222     CleanupStack::PopAndDestroy(pAsXml);
       
  1223     CleanupStack::PopAndDestroy(pFragment);
       
  1224 
       
  1225     pFragment = CSenDomFragmentBase::NewL(_L8("nsuri"),_L8("Nested"));
       
  1226     CleanupStack::PushL(pFragment);
       
  1227 	pParser->EnableFeature(EReportNamespaceMapping);
       
  1228 	
       
  1229 	pParser->ParseL(KInputString2, *pFragment);
       
  1230 	
       
  1231 	pAsXml = pFragment->AsXmlL();
       
  1232 	CleanupStack::PushL(pAsXml);
       
  1233 
       
  1234     LOCAL_ASSERT( *pAsXml == KInputString2 );
       
  1235 
       
  1236     CleanupStack::PopAndDestroy(pAsXml);
       
  1237     CleanupStack::PopAndDestroy(pFragment);
       
  1238 
       
  1239     CleanupStack::PopAndDestroy(pParser);
       
  1240     return KErrNone;
       
  1241     }
       
  1242     
       
  1243 TInt CSenFragmentTester::MT_CSenDomFragmentBase_Parsing5L(  )
       
  1244     {
       
  1245     // Parsing of XML document to CSenDomFragmentBase
       
  1246     // In this test nulling of default namespace is tested.
       
  1247 /*    
       
  1248     _LIT8(KInputString, "<a:Test xmlns=\"nsuri\" xmlns:a=\"nasuria\" \
       
  1249 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\" z=\"value3\">\
       
  1250 <Element1 xmlns="" xmlns:c=\"nsuric\" c:x=\"value4\">\
       
  1251 <Element1 >Content</Element1>\
       
  1252 </Element1>\
       
  1253 <Element3>Content3</Element3>\
       
  1254 <Element4/></a:Test>");
       
  1255 */
       
  1256 
       
  1257 /*
       
  1258     // Only namespace declaration order changes for output.
       
  1259     _LIT8(KOutputString, "<a:Test xmlns:a=\"nasuria\" xmlns=\"nsuri\" \
       
  1260 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\" z=\"value3\">\
       
  1261 <Element1 xmlns:c=\"nsuric\" c:x=\"value4\">\
       
  1262 <Element1>Content</Element1>\
       
  1263 </Element1>\
       
  1264 <Element3>Content3</Element3>\
       
  1265 <Element4/></a:Test>");
       
  1266 */
       
  1267 
       
  1268 	CSenParser* pParser = CSenParser::NewLC();
       
  1269 	
       
  1270     /*CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL(_L8("nasuria"),_L8("Test"),_L8("a"));
       
  1271     CleanupStack::PushL(pFragment);
       
  1272 	pParser->EnableFeature(EReportNamespaceMapping);
       
  1273 	
       
  1274 	pParser->ParseL(KInputString, *pFragment);
       
  1275 	
       
  1276 	HBufC8* pAsXml = pFragment->AsXmlL();
       
  1277 	CleanupStack::PushL(pAsXml);
       
  1278 
       
  1279     LOCAL_ASSERT( *pAsXml == KOutputString );
       
  1280 
       
  1281     CleanupStack::PopAndDestroy(pAsXml);
       
  1282     CleanupStack::PopAndDestroy(pFragment);*/
       
  1283     CleanupStack::PopAndDestroy(pParser);
       
  1284     return KErrNone;
       
  1285     }  
       
  1286     
       
  1287 TInt CSenFragmentTester::MT_CSenDomFragmentBase_Parsing6L(  )
       
  1288     {
       
  1289     // Parsing of XML document to CSenDomFragmentBase
       
  1290     // when constructor CSenDomFragmentBase::NewL() is used.
       
  1291     _LIT8(KInputString, "<a:Test xmlns=\"nsuri\" xmlns:a=\"nasuria\" \
       
  1292 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\">\
       
  1293 <Element1 xmlns:c=\"nsuric\" c:x=\"value3\">Content1</Element1>\
       
  1294 <Element2 z=\"value4\">Content2</Element2>\
       
  1295 <Element3>Content3</Element3>\
       
  1296 <Element4/></a:Test>");
       
  1297 
       
  1298     // Default namespace declaration (xmlns="nsuri") from Parent element (Test)
       
  1299     // will be moved to all child elements (Element1, Element2, Element3 and
       
  1300     // Element4) when EReportNamespaceMapping is _NOT_ enabled. That's because
       
  1301     // the way CParser works <=> Namespaces are reported when namespaces are used
       
  1302     // for the first time.
       
  1303     _LIT8(KOutputString, "<a:Test xmlns:a=\"nasuria\" xmlns:b=\"nasurib\" \
       
  1304 a:x=\"value1\" b:z=\"value2\">\
       
  1305 <Element1 xmlns=\"nsuri\" xmlns:c=\"nsuric\" c:x=\"value3\">Content1</Element1>\
       
  1306 <Element2 xmlns=\"nsuri\" z=\"value4\">Content2</Element2>\
       
  1307 <Element3 xmlns=\"nsuri\">Content3</Element3>\
       
  1308 <Element4 xmlns=\"nsuri\"/></a:Test>");
       
  1309 
       
  1310 	CSenParser* pParser = CSenParser::NewLC();
       
  1311 	
       
  1312     CSenDomFragmentBase* pFragment = CSenDomFragmentBase::NewL();
       
  1313     CleanupStack::PushL(pFragment);
       
  1314 	
       
  1315 	pParser->ParseL(KInputString, *pFragment);
       
  1316 	
       
  1317 	HBufC8* pAsXml = pFragment->AsXmlL();
       
  1318 	CleanupStack::PushL(pAsXml);
       
  1319 
       
  1320     LOCAL_ASSERT( *pAsXml == KOutputString );
       
  1321 
       
  1322     CleanupStack::PopAndDestroy(pAsXml);
       
  1323     CleanupStack::PopAndDestroy(pFragment);
       
  1324 
       
  1325     CleanupStack::PopAndDestroy(pParser);
       
  1326     return KErrNone;
       
  1327     }
       
  1328 
       
  1329 TInt CSenFragmentTester::MT_CSenDomFragmentBase_Parsing7L(  )
       
  1330     {
       
  1331     // Parsing of XML document to CSenDomFragmentBase
       
  1332     // when constructor CSenDomFragmentBase::NewL() is used.
       
  1333     _LIT8(KInputString, "<S:Envelope xmlns:S=\"http://www.w3.org/2003/05/soap-envelope\" \
       
  1334 xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">\
       
  1335 <S:Header>\
       
  1336 <wsa:MessageID>URN:UUID:ACF914D6-86A4-E5CF-4BD2-BD9CC2AD30E1</wsa:MessageID>\
       
  1337 <wsa:To>http://10.132.11.35/WSStar/STS.aspx</wsa:To>\
       
  1338 <wsa:Action>http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</wsa:Action>\
       
  1339 <wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">\
       
  1340 <wsse:UsernameToken>\
       
  1341 <wsse:Username>PCNSA15\\wsstar</wsse:Username>\
       
  1342 <wsse:Password>jaszmn\\3</wsse:Password>\
       
  1343 </wsse:UsernameToken>\
       
  1344 </wsse:Security>\
       
  1345 </S:Header>\
       
  1346 <S:Body>\
       
  1347 <wst:RequestSecurityToken xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\">\
       
  1348 <wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</wst:RequestType>\
       
  1349 <wst:Renewing/>\
       
  1350 <wst:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</wst:TokenType>\
       
  1351 <wsp:AppliesTo xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\">\
       
  1352 <wsa:EndpointReference>\
       
  1353 <wsa:Address>http://10.132.11.35/WSStar/WSService.aspx</wsa:Address>\
       
  1354 </wsa:EndpointReference>\
       
  1355 </wsp:AppliesTo>\
       
  1356 </wst:RequestSecurityToken>\
       
  1357 </S:Body>\
       
  1358 </S:Envelope>");
       
  1359 
       
  1360     // Note: If EReportNamespaceMapping is not enabled output will be following:
       
  1361     //       (Namespace declaration for prefix "wsa" jumps from root element to
       
  1362     //        elements (MessageID, To, Action and EndpointReference) which actually
       
  1363     //        use above mentioned prefix. <=> Root element Envelope does not use
       
  1364     //        "wsa" prefix.)
       
  1365     _LIT8(KOutputString, "<S:Envelope xmlns:S=\"http://www.w3.org/2003/05/soap-envelope\">\
       
  1366 <S:Header>\
       
  1367 <wsa:MessageID xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">URN:UUID:ACF914D6-86A4-E5CF-4BD2-BD9CC2AD30E1</wsa:MessageID>\
       
  1368 <wsa:To xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">http://10.132.11.35/WSStar/STS.aspx</wsa:To>\
       
  1369 <wsa:Action xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</wsa:Action>\
       
  1370 <wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">\
       
  1371 <wsse:UsernameToken>\
       
  1372 <wsse:Username>PCNSA15\\wsstar</wsse:Username>\
       
  1373 <wsse:Password>jaszmn\\3</wsse:Password>\
       
  1374 </wsse:UsernameToken>\
       
  1375 </wsse:Security>\
       
  1376 </S:Header>\
       
  1377 <S:Body>\
       
  1378 <wst:RequestSecurityToken xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\">\
       
  1379 <wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</wst:RequestType>\
       
  1380 <wst:Renewing/>\
       
  1381 <wst:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</wst:TokenType>\
       
  1382 <wsp:AppliesTo xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\">\
       
  1383 <wsa:EndpointReference xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">\
       
  1384 <wsa:Address>http://10.132.11.35/WSStar/WSService.aspx</wsa:Address>\
       
  1385 </wsa:EndpointReference>\
       
  1386 </wsp:AppliesTo>\
       
  1387 </wst:RequestSecurityToken>\
       
  1388 </S:Body>\
       
  1389 </S:Envelope>");
       
  1390 
       
  1391     CSenParser* parser = CSenParser::NewLC();
       
  1392     //create a CSenDomFragment
       
  1393 	CSenFragmentBase* pBase = CSenDomFragmentBase::NewL();
       
  1394 	CleanupStack::PushL(pBase);
       
  1395 	//do the parsing
       
  1396 	parser->ParseL(KInputString, *pBase);
       
  1397 	
       
  1398     HBufC8* pAsXml = pBase->AsXmlL();
       
  1399     CleanupStack::PushL(pAsXml);
       
  1400     LOCAL_ASSERT( *pAsXml == KOutputString );
       
  1401     CleanupStack::PopAndDestroy(pAsXml);
       
  1402     CleanupStack::PopAndDestroy(pBase);
       
  1403 
       
  1404     pBase = CSenDomFragmentBase::NewL();
       
  1405     CleanupStack::PushL(pBase);
       
  1406     //Enable NamespaceMapping to ensure that namespace declarations will
       
  1407     //remain in exactly the same place as in original XML document
       
  1408     parser->EnableFeature(EReportNamespaceMapping);
       
  1409 	//do the parsing
       
  1410 	parser->ParseL(KInputString, *pBase);
       
  1411 	
       
  1412     pAsXml = pBase->AsXmlL();
       
  1413     CleanupStack::PushL(pAsXml);
       
  1414     LOCAL_ASSERT( *pAsXml == KInputString );
       
  1415     CleanupStack::PopAndDestroy(pAsXml);
       
  1416     
       
  1417     CleanupStack::PopAndDestroy(pBase);
       
  1418     CleanupStack::PopAndDestroy(parser);
       
  1419     return KErrNone;
       
  1420     }
       
  1421 
       
  1422 TInt CSenFragmentTester::MT_CSenDomFragmentBase_Parsing8L(  )
       
  1423     {
       
  1424     // Parsing of XML document to CSenDomFragmentBase
       
  1425     // when constructor CSenDomFragmentBase::NewL() is used.
       
  1426     _LIT8(KInputString, "<S:Envelope xmlns:S=\"http://www.w3.org/2003/05/soap-envelope\" \
       
  1427 xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">\
       
  1428 <S:Header>\
       
  1429 <wsa:MessageID>URN:UUID:ACF914D6-86A4-E5CF-4BD2-BD9CC2AD30E1</wsa:MessageID>\
       
  1430 <wsa:To>http://10.132.11.35/WSStar/STS.aspx</wsa:To>\
       
  1431 <wsa:Action>http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</wsa:Action>\
       
  1432 <wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">\
       
  1433 <wsse:UsernameToken>\
       
  1434 <wsse:Username>PCNSA15\\wsstar</wsse:Username>\
       
  1435 <wsse:Password>jaszmn\\3</wsse:Password>\
       
  1436 </wsse:UsernameToken>\
       
  1437 </wsse:Security>\
       
  1438 </S:Header>\
       
  1439 <S:Body>\
       
  1440 <wst:RequestSecurityToken xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\">\
       
  1441 <wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</wst:RequestType>\
       
  1442 <wst:Renewing/>\
       
  1443 <wst:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</wst:TokenType>\
       
  1444 <wsp:AppliesTo xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\">\
       
  1445 <wsa:EndpointReference>\
       
  1446 <wsa:Address>http://10.132.11.35/WSStar/WSService.aspx</wsa:Address>\
       
  1447 </wsa:EndpointReference>\
       
  1448 </wsp:AppliesTo>\
       
  1449 </wst:RequestSecurityToken>\
       
  1450 </S:Body>\
       
  1451 </S:Envelope>");
       
  1452 
       
  1453     // Note: If EReportNamespaceMapping is not enabled output will be following:
       
  1454     //       (Namespace declaration for prefix "wsa" jumps from root element to
       
  1455     //        elements (MessageID, To, Action and EndpointReference) which actually
       
  1456     //        use above mentioned prefix. <=> Root element Envelope does not use
       
  1457     //        "wsa" prefix.)
       
  1458     _LIT8(KOutputString1, "<S:Body xmlns:S=\"http://www.w3.org/2003/05/soap-envelope\">\
       
  1459 <wst:RequestSecurityToken xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\">\
       
  1460 <wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</wst:RequestType>\
       
  1461 <wst:Renewing/>\
       
  1462 <wst:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</wst:TokenType>\
       
  1463 <wsp:AppliesTo xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\">\
       
  1464 <wsa:EndpointReference xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">\
       
  1465 <wsa:Address>http://10.132.11.35/WSStar/WSService.aspx</wsa:Address>\
       
  1466 </wsa:EndpointReference>\
       
  1467 </wsp:AppliesTo>\
       
  1468 </wst:RequestSecurityToken>\
       
  1469 </S:Body>");
       
  1470 
       
  1471     _LIT8(KOutputString2, "<S:Body xmlns:S=\"http://www.w3.org/2003/05/soap-envelope\">\
       
  1472 <wst:RequestSecurityToken xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\">\
       
  1473 <wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</wst:RequestType>\
       
  1474 <wst:Renewing/>\
       
  1475 <wst:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</wst:TokenType>\
       
  1476 <wsp:AppliesTo xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\">\
       
  1477 <wsa:EndpointReference xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">\
       
  1478 <wsa:Address>http://10.132.11.35/WSStar/WSService.aspx</wsa:Address>\
       
  1479 </wsa:EndpointReference>\
       
  1480 </wsp:AppliesTo>\
       
  1481 </wst:RequestSecurityToken>\
       
  1482 </S:Body>");
       
  1483 
       
  1484     CSenParser* parser = CSenParser::NewLC();
       
  1485     //create a CSenDomFragment
       
  1486 	CSenFragmentBase* pBase = CSenDomFragmentBase::NewL(_L8("http://www.w3.org/2003/05/soap-envelope"),
       
  1487 	                                                    _L8("Body"),
       
  1488 	                                                    _L8("S"));
       
  1489 	CleanupStack::PushL(pBase);
       
  1490 	//do the parsing
       
  1491 	parser->ParseL(KInputString, *pBase);
       
  1492 	
       
  1493     HBufC8* pAsXml = pBase->AsXmlL();
       
  1494     CleanupStack::PushL(pAsXml);
       
  1495     LOCAL_ASSERT( *pAsXml == KOutputString1 );
       
  1496     CleanupStack::PopAndDestroy(pAsXml);
       
  1497     CleanupStack::PopAndDestroy(pBase);
       
  1498 
       
  1499     pBase = CSenDomFragmentBase::NewL(_L8("http://www.w3.org/2003/05/soap-envelope"),
       
  1500 	                                  _L8("Body"),
       
  1501 	                                  _L8("S"));
       
  1502     CleanupStack::PushL(pBase);
       
  1503     //Enable NamespaceMapping to ensure that namespace declarations will
       
  1504     //remain in exactly the same place as in original XML document
       
  1505     parser->EnableFeature(EReportNamespaceMapping);
       
  1506 	//do the parsing
       
  1507 	parser->ParseL(KInputString, *pBase);
       
  1508 	
       
  1509     pAsXml = pBase->AsXmlL();
       
  1510     CleanupStack::PushL(pAsXml);
       
  1511     LOCAL_ASSERT( *pAsXml == KOutputString2 );
       
  1512     CleanupStack::PopAndDestroy(pAsXml);
       
  1513     
       
  1514     CleanupStack::PopAndDestroy(pBase);
       
  1515     CleanupStack::PopAndDestroy(parser);
       
  1516     return KErrNone;
       
  1517     }
       
  1518 
       
  1519 TInt CSenFragmentTester::MT_CSenFragmentBase_NewLL(  )
       
  1520     {
       
  1521     RSenDocument document = RSenDocument::NewL();
       
  1522     CleanupClosePushL(document);
       
  1523     TXmlEngElement element = document.CreateDocumentElementL(_L8("Test"));
       
  1524     _LIT8(KElement, "<Element/>");
       
  1525     element.SetTextNoEncL(KElement);
       
  1526    
       
  1527     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(element);
       
  1528     CleanupStack::PushL(pFragment);
       
  1529     HBufC8* pAsXml = pFragment->AsXmlL();
       
  1530     CleanupStack::PushL(pAsXml);
       
  1531     // Test that when CSenFragmentBase is serialized '<' and '>' characters
       
  1532     // are NOT encoded => The content of CSenFragmentBase can include
       
  1533     // XML elements
       
  1534     LOCAL_ASSERT( *pAsXml == _L8("<Test><Element/></Test>") );
       
  1535     CleanupStack::PopAndDestroy(pAsXml);
       
  1536     CleanupStack::PopAndDestroy(pFragment);
       
  1537     CleanupStack::PopAndDestroy(&document);
       
  1538     return KErrNone;
       
  1539     }
       
  1540 
       
  1541 TInt CSenFragmentTester::MT_CSenFragmentBase_NewL_1L(  )
       
  1542     {
       
  1543     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("Test"));
       
  1544     CleanupStack::PushL(pFragment);
       
  1545     HBufC8* pAsXml = pFragment->AsXmlL();
       
  1546     CleanupStack::PushL(pAsXml);
       
  1547     LOCAL_ASSERT( *pAsXml == _L8("<Test/>") );
       
  1548     CleanupStack::PopAndDestroy(pAsXml);
       
  1549     CleanupStack::PopAndDestroy(pFragment);
       
  1550     return KErrNone;
       
  1551     }
       
  1552 
       
  1553 TInt CSenFragmentTester::MT_CSenFragmentBase_NewL_2L(  )
       
  1554     {
       
  1555     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("NsUri"),
       
  1556                                                          _L8("Test"));
       
  1557     CleanupStack::PushL(pFragment);
       
  1558     HBufC8* pAsXml = pFragment->AsXmlL();
       
  1559     CleanupStack::PushL(pAsXml);
       
  1560     LOCAL_ASSERT( *pAsXml == _L8("<Test xmlns=\"NsUri\"/>") );
       
  1561     CleanupStack::PopAndDestroy(pAsXml);
       
  1562     CleanupStack::PopAndDestroy(pFragment);
       
  1563     return KErrNone;
       
  1564     }
       
  1565 
       
  1566 TInt CSenFragmentTester::MT_CSenFragmentBase_NewL_3L(  )
       
  1567     {
       
  1568     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("NsUri"),
       
  1569                                                          _L8("Test"),
       
  1570                                                          _L8("t"));
       
  1571     CleanupStack::PushL(pFragment);
       
  1572     HBufC8* pAsXml = pFragment->AsXmlL();
       
  1573     CleanupStack::PushL(pAsXml);
       
  1574     LOCAL_ASSERT( *pAsXml == _L8("<t:Test xmlns:t=\"NsUri\"/>") );
       
  1575     CleanupStack::PopAndDestroy(pAsXml);
       
  1576     CleanupStack::PopAndDestroy(pFragment);
       
  1577     return KErrNone;
       
  1578     }
       
  1579 
       
  1580 TInt CSenFragmentTester::MT_CSenFragmentBase_NewL_4L(  )
       
  1581     {
       
  1582     RStringPool stringPool;
       
  1583     stringPool.OpenL();
       
  1584     CleanupClosePushL(stringPool);
       
  1585     
       
  1586     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
  1587     CleanupClosePushL(nsUriRString);
       
  1588     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
  1589     CleanupClosePushL(nsPrefixRString);
       
  1590     RString localNameRString    = stringPool.OpenStringL(_L8("LocalName"));
       
  1591     CleanupClosePushL(localNameRString);
       
  1592     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
  1593     CleanupClosePushL(valueRString);
       
  1594     
       
  1595     RAttribute attribute;
       
  1596     attribute.Open(nsUriRString, nsPrefixRString, localNameRString,
       
  1597                    valueRString );
       
  1598     // attribute took ownership of all RStrings
       
  1599     // => All RStrings can be pop from CleanupStack
       
  1600     CleanupStack::Pop(&valueRString);
       
  1601     CleanupStack::Pop(&localNameRString);
       
  1602     CleanupStack::Pop(&nsPrefixRString);
       
  1603     CleanupStack::Pop(&nsUriRString);
       
  1604     
       
  1605     CleanupClosePushL(attribute);
       
  1606 
       
  1607     RAttributeArray attrArray;
       
  1608     // append the namespace attribute (declaration)
       
  1609     attrArray.AppendL(attribute);
       
  1610     CleanupClosePushL(attrArray);
       
  1611     
       
  1612     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("NsUri"),
       
  1613                                                          _L8("Test"),
       
  1614                                                          _L8("t"),
       
  1615                                                          attrArray);
       
  1616     CleanupStack::PushL(pFragment);
       
  1617     HBufC8* pAsXml = pFragment->AsXmlL();
       
  1618     CleanupStack::PushL(pAsXml);
       
  1619     LOCAL_ASSERT( *pAsXml == _L8("<t:Test xmlns:t=\"NsUri\" xmlns:pr=\"nsuri\" pr:LocalName=\"Value\"/>") );
       
  1620     CleanupStack::PopAndDestroy(pAsXml);
       
  1621     CleanupStack::PopAndDestroy(pFragment);
       
  1622     CleanupStack::PopAndDestroy(&attrArray);
       
  1623     CleanupStack::PopAndDestroy(&attribute);
       
  1624     CleanupStack::PopAndDestroy(&stringPool);    
       
  1625     return KErrNone;
       
  1626     }
       
  1627 
       
  1628 TInt CSenFragmentTester::MT_CSenFragmentBase_NewL_5L(  )
       
  1629     {
       
  1630     RSenDocument document = RSenDocument::NewL();
       
  1631     CleanupClosePushL(document);
       
  1632     TXmlEngElement parentElement = document.CreateDocumentElementL(_L8("Parent"));
       
  1633     
       
  1634     RStringPool stringPool;
       
  1635     stringPool.OpenL();
       
  1636     CleanupClosePushL(stringPool);
       
  1637     
       
  1638     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
  1639     CleanupClosePushL(nsUriRString);
       
  1640     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
  1641     CleanupClosePushL(nsPrefixRString);
       
  1642     RString localNameRString    = stringPool.OpenStringL(_L8("LocalName"));
       
  1643     CleanupClosePushL(localNameRString);
       
  1644     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
  1645     CleanupClosePushL(valueRString);
       
  1646     
       
  1647     RAttribute attribute;
       
  1648     attribute.Open(nsUriRString, nsPrefixRString, localNameRString, 
       
  1649                    valueRString);
       
  1650     // attribute took ownership of all RStrings
       
  1651     // => All RStrings can be pop from CleanupStack
       
  1652     CleanupStack::Pop(&valueRString);
       
  1653     CleanupStack::Pop(&localNameRString);
       
  1654     CleanupStack::Pop(&nsPrefixRString);
       
  1655     CleanupStack::Pop(&nsUriRString);
       
  1656 
       
  1657     CleanupClosePushL(attribute);
       
  1658 
       
  1659     RAttributeArray attrArray;
       
  1660     // append the namespace attribute (declaration)
       
  1661     attrArray.AppendL(attribute);
       
  1662     CleanupClosePushL(attrArray);
       
  1663         
       
  1664     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("NsUri"),
       
  1665                                                          _L8("Test"),
       
  1666                                                          _L8("t"),
       
  1667                                                          attrArray,
       
  1668                                                          parentElement);
       
  1669     CleanupStack::PushL(pFragment);
       
  1670     HBufC8* pAsXml = pFragment->AsXmlL();
       
  1671     CleanupStack::PushL(pAsXml);
       
  1672     LOCAL_ASSERT( *pAsXml == _L8("<t:Test xmlns:t=\"NsUri\" xmlns:pr=\"nsuri\" pr:LocalName=\"Value\"/>") );
       
  1673 
       
  1674     RBuf8 buffer;
       
  1675     parentElement.OuterXmlL(buffer);
       
  1676     
       
  1677     LOCAL_ASSERT( buffer == _L8("<Parent><t:Test xmlns:t=\"NsUri\" xmlns:pr=\"nsuri\" pr:LocalName=\"Value\"/></Parent>") );
       
  1678     buffer.Close();
       
  1679     
       
  1680     CleanupStack::PopAndDestroy(pAsXml);
       
  1681     CleanupStack::PopAndDestroy(pFragment);
       
  1682     CleanupStack::PopAndDestroy(&attrArray);
       
  1683     CleanupStack::PopAndDestroy(&attribute);
       
  1684     CleanupStack::PopAndDestroy(&stringPool); 
       
  1685     CleanupStack::PopAndDestroy(&document);
       
  1686     return KErrNone;
       
  1687     }
       
  1688 
       
  1689 TInt CSenFragmentTester::MT_CSenFragmentBase_NewL_6L(  )
       
  1690     {
       
  1691     RSenDocument document = RSenDocument::NewL();
       
  1692     CleanupClosePushL(document);
       
  1693     TXmlEngElement parentElement = document.CreateDocumentElementL(_L8("Parent"));
       
  1694     
       
  1695     RStringPool stringPool;
       
  1696     stringPool.OpenL();
       
  1697     CleanupClosePushL(stringPool);
       
  1698     
       
  1699     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
  1700     CleanupClosePushL(nsUriRString);
       
  1701     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
  1702     CleanupClosePushL(nsPrefixRString);
       
  1703     RString localNameRString    = stringPool.OpenStringL(_L8("LocalName"));
       
  1704     CleanupClosePushL(localNameRString);
       
  1705     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
  1706     CleanupClosePushL(valueRString);
       
  1707     
       
  1708     RAttribute attribute;
       
  1709     attribute.Open(nsUriRString, nsPrefixRString, localNameRString, 
       
  1710                    valueRString);
       
  1711     // attribute took ownership of all RStrings
       
  1712     // => All RStrings can be pop from CleanupStack
       
  1713     CleanupStack::Pop(&valueRString);
       
  1714     CleanupStack::Pop(&localNameRString);
       
  1715     CleanupStack::Pop(&nsPrefixRString);
       
  1716     CleanupStack::Pop(&nsUriRString);
       
  1717 
       
  1718     CleanupClosePushL(attribute);
       
  1719 
       
  1720     RAttributeArray attrArray;
       
  1721     // append the namespace attribute (declaration)
       
  1722     attrArray.AppendL(attribute);
       
  1723     CleanupClosePushL(attrArray);
       
  1724         
       
  1725     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("NsUri"),
       
  1726                                                          _L8("Test"),
       
  1727                                                          _L8(""),
       
  1728                                                          attrArray,
       
  1729                                                          parentElement,
       
  1730                                                          document);
       
  1731     CleanupStack::PushL(pFragment);
       
  1732     HBufC8* pAsXml = pFragment->AsXmlL();
       
  1733     CleanupStack::PushL(pAsXml);
       
  1734     LOCAL_ASSERT( *pAsXml == _L8("<Test xmlns=\"NsUri\" xmlns:pr=\"nsuri\" pr:LocalName=\"Value\"/>") );
       
  1735 
       
  1736     RBuf8 buffer;
       
  1737     parentElement.OuterXmlL(buffer);
       
  1738     
       
  1739     LOCAL_ASSERT( buffer == _L8("<Parent><Test xmlns=\"NsUri\" xmlns:pr=\"nsuri\" pr:LocalName=\"Value\"/></Parent>") );
       
  1740     buffer.Close();
       
  1741     
       
  1742     CleanupStack::PopAndDestroy(pAsXml);
       
  1743     CleanupStack::PopAndDestroy(pFragment);
       
  1744     CleanupStack::PopAndDestroy(&attrArray);
       
  1745     CleanupStack::PopAndDestroy(&attribute);
       
  1746     CleanupStack::PopAndDestroy(&stringPool); 
       
  1747     CleanupStack::PopAndDestroy(&document);
       
  1748     return KErrNone;
       
  1749     }
       
  1750 
       
  1751 TInt CSenFragmentTester::MT_CSenFragmentBase_NewL_7L(  )
       
  1752     {
       
  1753     RSenDocument document = RSenDocument::NewL();
       
  1754     CleanupClosePushL(document);
       
  1755     TXmlEngElement parentElement = document.CreateDocumentElementL(_L8("Parent"));
       
  1756     
       
  1757     RStringPool stringPool;
       
  1758     stringPool.OpenL();
       
  1759     CleanupClosePushL(stringPool);
       
  1760     
       
  1761     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
  1762     CleanupClosePushL(nsUriRString);
       
  1763     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
  1764     CleanupClosePushL(nsPrefixRString);
       
  1765     RString localNameRString    = stringPool.OpenStringL(_L8("LocalName"));
       
  1766     CleanupClosePushL(localNameRString);
       
  1767     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
  1768     CleanupClosePushL(valueRString);
       
  1769     
       
  1770     RAttribute attribute;
       
  1771     attribute.Open(nsUriRString, nsPrefixRString, localNameRString, 
       
  1772                    valueRString);
       
  1773     // attribute took ownership of all RStrings
       
  1774     // => All RStrings can be pop from CleanupStack
       
  1775     CleanupStack::Pop(&valueRString);
       
  1776     CleanupStack::Pop(&localNameRString);
       
  1777     CleanupStack::Pop(&nsPrefixRString);
       
  1778     CleanupStack::Pop(&nsUriRString);
       
  1779 
       
  1780     CleanupClosePushL(attribute);
       
  1781 
       
  1782     RAttributeArray attrArray;
       
  1783     // append the namespace attribute (declaration)
       
  1784     attrArray.AppendL(attribute);
       
  1785     CleanupClosePushL(attrArray);
       
  1786         
       
  1787     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("NsUri"),
       
  1788                                                          _L8("Test"),
       
  1789                                                          _L8(""),
       
  1790                                                          attrArray,
       
  1791                                                          parentElement,
       
  1792                                                          document);
       
  1793     CleanupStack::PushL(pFragment);
       
  1794     
       
  1795     RSenDocument doc = pFragment->AsDocumentL();
       
  1796     TXmlEngElement el = pFragment->AsElementL();
       
  1797     CSenFragmentBase* pFragment2 = CSenFragmentBase::NewL(el, doc);
       
  1798     
       
  1799     CleanupStack::PopAndDestroy(pFragment);
       
  1800     CleanupStack::PushL(pFragment2);
       
  1801         
       
  1802     HBufC8* pAsXml = pFragment2->AsXmlL();
       
  1803     CleanupStack::PushL(pAsXml);
       
  1804     LOCAL_ASSERT( *pAsXml == _L8("<Test xmlns=\"NsUri\" xmlns:pr=\"nsuri\" pr:LocalName=\"Value\"/>") );
       
  1805 
       
  1806     RBuf8 buffer;
       
  1807     parentElement.OuterXmlL(buffer);
       
  1808     
       
  1809     LOCAL_ASSERT( buffer == _L8("<Parent><Test xmlns=\"NsUri\" xmlns:pr=\"nsuri\" pr:LocalName=\"Value\"/></Parent>") );
       
  1810     buffer.Close();
       
  1811     
       
  1812     CleanupStack::PopAndDestroy(pAsXml);
       
  1813     CleanupStack::PopAndDestroy(pFragment2);
       
  1814     CleanupStack::PopAndDestroy(&attrArray);
       
  1815     CleanupStack::PopAndDestroy(&attribute);
       
  1816     CleanupStack::PopAndDestroy(&stringPool); 
       
  1817     CleanupStack::PopAndDestroy(&document);
       
  1818     return KErrNone;
       
  1819     }
       
  1820 
       
  1821 TInt CSenFragmentTester::MT_CSenFragmentBase_OnStartElementLL(  )
       
  1822     {
       
  1823     // Will be tested in Parse test cases
       
  1824     LOCAL_ASSERT( ETrue );
       
  1825     return KErrNone;
       
  1826     }
       
  1827 
       
  1828 TInt CSenFragmentTester::MT_CSenFragmentBase_OnEndElementLL(  )
       
  1829     {
       
  1830     // Will be tested in Parse test cases
       
  1831     LOCAL_ASSERT( ETrue );
       
  1832     return KErrNone;
       
  1833     }
       
  1834 
       
  1835 TInt CSenFragmentTester::MT_CSenFragmentBase_OnStartDocumentLL(  )
       
  1836     {
       
  1837     // There is no functionality in this method in CSenFragmentBase implementation
       
  1838     LOCAL_ASSERT( ETrue );
       
  1839     return KErrNone;
       
  1840     }
       
  1841 
       
  1842 TInt CSenFragmentTester::MT_CSenFragmentBase_OnEndDocumentLL(  )
       
  1843     {
       
  1844     // There is no functionality in this method in CSenFragmentBase implementation
       
  1845     LOCAL_ASSERT( ETrue );
       
  1846     return KErrNone;
       
  1847     }
       
  1848 
       
  1849 TInt CSenFragmentTester::MT_CSenFragmentBase_OnContentLL(  )
       
  1850     {
       
  1851     // Will be tested in Parse test cases
       
  1852     LOCAL_ASSERT( ETrue );
       
  1853     return KErrNone;
       
  1854     }
       
  1855 
       
  1856 TInt CSenFragmentTester::MT_CSenFragmentBase_OnStartPrefixMappingLL(  )
       
  1857     {
       
  1858     // There is no functionality in this method in CSenFragmentBase implementation
       
  1859     LOCAL_ASSERT( ETrue );
       
  1860     return KErrNone;
       
  1861     }
       
  1862 
       
  1863 TInt CSenFragmentTester::MT_CSenFragmentBase_OnEndPrefixMappingLL(  )
       
  1864     {
       
  1865     // There is no functionality in this method in CSenFragmentBase implementation
       
  1866     LOCAL_ASSERT( ETrue );
       
  1867     return KErrNone;
       
  1868     }
       
  1869 
       
  1870 TInt CSenFragmentTester::MT_CSenFragmentBase_OnIgnorableWhiteSpaceLL(  )
       
  1871     {
       
  1872     // There is no functionality in this method in CSenFragmentBase implementation
       
  1873     LOCAL_ASSERT( ETrue );
       
  1874     return KErrNone;
       
  1875     }
       
  1876 
       
  1877 TInt CSenFragmentTester::MT_CSenFragmentBase_OnSkippedEntityLL(  )
       
  1878     {
       
  1879     // There is no functionality in this method in CSenFragmentBase implementation
       
  1880     LOCAL_ASSERT( ETrue );
       
  1881     return KErrNone;
       
  1882     }
       
  1883 
       
  1884 TInt CSenFragmentTester::MT_CSenFragmentBase_OnProcessingInstructionLL(  )
       
  1885     {
       
  1886     // There is no functionality in this method in CSenFragmentBase implementation
       
  1887     LOCAL_ASSERT( ETrue );
       
  1888     return KErrNone;
       
  1889     }
       
  1890 
       
  1891 TInt CSenFragmentTester::MT_CSenFragmentBase_OnErrorL(  )
       
  1892     {
       
  1893     // There is no functionality in this method in CSenFragmentBase implementation
       
  1894     LOCAL_ASSERT( ETrue );
       
  1895     return KErrNone;
       
  1896     }
       
  1897 
       
  1898 TInt CSenFragmentTester::MT_CSenFragmentBase_GetExtendedInterfaceL(  )
       
  1899     {
       
  1900     // There is no functionality in this method in CSenFragmentBase implementation
       
  1901     LOCAL_ASSERT( ETrue );
       
  1902     return KErrNone;
       
  1903     }
       
  1904 
       
  1905 TInt CSenFragmentTester::MT_CSenFragmentBase_ContentLL(  )
       
  1906     {
       
  1907     RSenDocument document = RSenDocument::NewL();
       
  1908     CleanupClosePushL(document);
       
  1909     TXmlEngElement element = document.CreateDocumentElementL(_L8("Test"));
       
  1910     element.SetEscapedTextL(_L8("<Element/>"));
       
  1911     
       
  1912     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(element);
       
  1913     CleanupStack::PushL(pFragment);
       
  1914     
       
  1915     TPtrC8 content = pFragment->ContentL();
       
  1916     LOCAL_ASSERT( content == _L8("<Element/>") );
       
  1917     
       
  1918     CleanupStack::PopAndDestroy(pFragment);
       
  1919     CleanupStack::PopAndDestroy(&document);
       
  1920     return KErrNone;
       
  1921     }
       
  1922 
       
  1923 TInt CSenFragmentTester::MT_CSenFragmentBase_NamespaceL(  )
       
  1924     {
       
  1925     RStringPool stringPool;
       
  1926     stringPool.OpenL();
       
  1927     CleanupClosePushL(stringPool);
       
  1928     
       
  1929     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
  1930     CleanupClosePushL(nsUriRString);
       
  1931     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
  1932     CleanupClosePushL(nsPrefixRString);
       
  1933     RString localNameRString    = stringPool.OpenStringL(_L8("LocalName"));
       
  1934     CleanupClosePushL(localNameRString);
       
  1935     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
  1936     CleanupClosePushL(valueRString);
       
  1937     
       
  1938     RAttribute attribute;
       
  1939     attribute.Open(stringPool.OpenStringL(_L8("nsuri")), 
       
  1940                    stringPool.OpenStringL(_L8("pr")),
       
  1941                    stringPool.OpenStringL(_L8("LocalName")),
       
  1942                    stringPool.OpenStringL(_L8("Value")) );
       
  1943     // attribute took copies of all RStrings
       
  1944     // => All RStrings can be destroyed
       
  1945     CleanupStack::PopAndDestroy(4); // nsUriRString, nsPrefixRString, localNameRString,
       
  1946                                     // valueRString
       
  1947     CleanupClosePushL(attribute);
       
  1948 
       
  1949     RAttributeArray attrArray;
       
  1950     // append the namespace attribute (declaration)
       
  1951     attrArray.AppendL(attribute);
       
  1952     CleanupClosePushL(attrArray);
       
  1953     
       
  1954     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("NsUri"),
       
  1955                                                          _L8("Test"),
       
  1956                                                          _L8("t"),
       
  1957                                                          attrArray);
       
  1958     CleanupStack::PushL(pFragment);
       
  1959     
       
  1960     TXmlEngNamespace ns = pFragment->Namespace(_L8("pr"));
       
  1961     LOCAL_ASSERT( ns.Uri() == _L8("nsuri") );
       
  1962 
       
  1963     TXmlEngNamespace ns2 = pFragment->Namespace(_L8("x"));
       
  1964     LOCAL_ASSERT( ns2.IsUndefined() );
       
  1965     
       
  1966     CleanupStack::PopAndDestroy(pFragment);
       
  1967     CleanupStack::PopAndDestroy(); // attribute
       
  1968     CleanupStack::PopAndDestroy(); // attrArray
       
  1969     CleanupStack::PopAndDestroy(); // stringPool    
       
  1970     return KErrNone;
       
  1971     }
       
  1972 
       
  1973 TInt CSenFragmentTester::MT_CSenFragmentBase_ResetContentLL(  )
       
  1974     {
       
  1975     RSenDocument document = RSenDocument::NewL();
       
  1976     CleanupClosePushL(document);
       
  1977     TXmlEngElement element = document.CreateDocumentElementL(_L8("Test"));
       
  1978     element.SetEscapedTextL(_L8("Content"));
       
  1979     
       
  1980     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(element);
       
  1981     CleanupStack::PushL(pFragment);
       
  1982     
       
  1983     // Test that CSenFragmentBase has content before reset
       
  1984     TPtrC8 content = pFragment->ContentL();
       
  1985     LOCAL_ASSERT( content == _L8("Content") );
       
  1986     
       
  1987     pFragment->ResetContentL();
       
  1988     
       
  1989     // Test that CSenFragmentBase has no content after reset
       
  1990     TPtrC8 content2 = pFragment->ContentL();
       
  1991     LOCAL_ASSERT( content2 == KNullDesC8 );
       
  1992     
       
  1993     CleanupStack::PopAndDestroy(pFragment);
       
  1994     CleanupStack::PopAndDestroy(&document);
       
  1995     return KErrNone;
       
  1996     }
       
  1997 
       
  1998 TInt CSenFragmentTester::MT_CSenFragmentBase_LocalNameL(  )
       
  1999     {
       
  2000     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("NsUri"),
       
  2001                                                          _L8("Test"),
       
  2002                                                          _L8("t"));
       
  2003     CleanupStack::PushL(pFragment);
       
  2004     TPtrC8 localName = pFragment->LocalName();
       
  2005     LOCAL_ASSERT( localName == _L8("Test") );
       
  2006     CleanupStack::PopAndDestroy(pFragment);
       
  2007     return KErrNone;
       
  2008     }
       
  2009 
       
  2010 TInt CSenFragmentTester::MT_CSenFragmentBase_NsUriL(  )
       
  2011     {
       
  2012     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("NsUri"),
       
  2013                                                          _L8("Test"),
       
  2014                                                          _L8("t"));
       
  2015     CleanupStack::PushL(pFragment);
       
  2016     TPtrC8 localName = pFragment->NsUri();
       
  2017     LOCAL_ASSERT( localName == _L8("NsUri") );
       
  2018     CleanupStack::PopAndDestroy(pFragment);
       
  2019     return KErrNone;
       
  2020     }
       
  2021 
       
  2022 TInt CSenFragmentTester::MT_CSenFragmentBase_NsPrefixL(  )
       
  2023     {
       
  2024     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("NsUri"),
       
  2025                                                          _L8("Test"),
       
  2026                                                          _L8("t"));
       
  2027     CleanupStack::PushL(pFragment);
       
  2028     TPtrC8 localName = pFragment->NsPrefix();
       
  2029     LOCAL_ASSERT( localName == _L8("t") );
       
  2030     CleanupStack::PopAndDestroy(pFragment);
       
  2031     return KErrNone;
       
  2032     }
       
  2033 
       
  2034 TInt CSenFragmentTester::MT_CSenFragmentBase_AsElementLL(  )
       
  2035     {
       
  2036     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("NsUri"),
       
  2037                                                          _L8("Test"),
       
  2038                                                          _L8("t"));
       
  2039     CleanupStack::PushL(pFragment);
       
  2040     TXmlEngElement element = pFragment->AsElementL();
       
  2041     RBuf8 buffer;
       
  2042     CleanupClosePushL(buffer);
       
  2043     element.OuterXmlL(buffer);
       
  2044     // Serialized element should contain all the Fragment data as XML.
       
  2045     LOCAL_ASSERT( buffer == _L8("<t:Test xmlns:t=\"NsUri\"/>") );
       
  2046     CleanupStack::PopAndDestroy(&buffer);
       
  2047     CleanupStack::PopAndDestroy(pFragment);
       
  2048     return KErrNone;
       
  2049     }
       
  2050 
       
  2051 TInt CSenFragmentTester::MT_CSenFragmentBase_AsDocumentLL(  )
       
  2052     {
       
  2053     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("NsUri"),
       
  2054                                                          _L8("Test"),
       
  2055                                                          _L8("t"));
       
  2056     CleanupStack::PushL(pFragment);
       
  2057     RSenDocument document = pFragment->AsDocumentL();
       
  2058     TXmlEngElement element = document.DocumentElement();
       
  2059     
       
  2060     TXmlEngSerializationOptions options;
       
  2061     // Omit following declarations from the beginning of XML Document:
       
  2062     // <?xml version=\"1.0\...
       
  2063     //   encoding="..."
       
  2064     //   standalone="..."
       
  2065     // ?>
       
  2066     options.iOptions = options.iOptions |
       
  2067                        TXmlEngSerializationOptions::KOptionOmitXMLDeclaration;
       
  2068     RBuf8 asXml;
       
  2069     document.SaveL(asXml, element, options);
       
  2070     CleanupClosePushL(asXml);
       
  2071     
       
  2072     // Serialized document should contain all the Fragment data as XML.
       
  2073     LOCAL_ASSERT( asXml == _L8("<t:Test xmlns:t=\"NsUri\"/>") );
       
  2074 
       
  2075     CleanupStack::PopAndDestroy(&asXml);
       
  2076     CleanupStack::PopAndDestroy(pFragment);
       
  2077     return KErrNone;
       
  2078     }
       
  2079 
       
  2080 TInt CSenFragmentTester::MT_CSenFragmentBase_ExtractElementL(  )
       
  2081     {
       
  2082     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("NsUri"),
       
  2083                                                          _L8("Test"),
       
  2084                                                          _L8("t"));
       
  2085     CleanupStack::PushL(pFragment);
       
  2086     TXmlEngElement element = pFragment->ExtractElement();
       
  2087     LOCAL_ASSERT( element.Name() == _L8("Test") );
       
  2088     element.Remove();
       
  2089     CleanupStack::PopAndDestroy(pFragment);    
       
  2090     return KErrNone;
       
  2091     }
       
  2092 
       
  2093 TInt CSenFragmentTester::MT_CSenFragmentBase_OnDelegateParsingLL(  )
       
  2094     {
       
  2095     // Will be tested in Parse test cases
       
  2096     LOCAL_ASSERT( ETrue );
       
  2097     return KErrNone;
       
  2098     }
       
  2099 
       
  2100 TInt CSenFragmentTester::MT_CSenFragmentBase_OnDelegateParsingL_1L(  )
       
  2101     {
       
  2102     // Will be tested in Parse test cases
       
  2103     LOCAL_ASSERT( ETrue );
       
  2104     return KErrNone;
       
  2105     }
       
  2106 
       
  2107 TInt CSenFragmentTester::MT_CSenFragmentBase_SetOwnerL(  )
       
  2108     {
       
  2109     // Will be tested in Parse test cases
       
  2110     LOCAL_ASSERT( ETrue );
       
  2111     return KErrNone;
       
  2112     }
       
  2113 
       
  2114 TInt CSenFragmentTester::MT_CSenFragmentBase_OnResumeParsingFromLL(  )
       
  2115     {
       
  2116     // Will be tested in Parse test cases
       
  2117     LOCAL_ASSERT( ETrue );
       
  2118     return KErrNone;
       
  2119     }
       
  2120 
       
  2121 TInt CSenFragmentTester::MT_CSenFragmentBase_OnWriteStartElementLL(  )
       
  2122     {
       
  2123     // Will be tested in Parse test cases
       
  2124     LOCAL_ASSERT( ETrue );
       
  2125     return KErrNone;
       
  2126     }
       
  2127 
       
  2128 TInt CSenFragmentTester::MT_CSenFragmentBase_OnWriteEndElementLL(  )
       
  2129     {
       
  2130     // Will be tested in Parse test cases
       
  2131     LOCAL_ASSERT( ETrue );
       
  2132     return KErrNone;
       
  2133     }
       
  2134 
       
  2135 TInt CSenFragmentTester::MT_CSenFragmentBase_AsXmlUnicodeLL(  )
       
  2136     {
       
  2137     // Test serialization of Dom tree which has two child elements
       
  2138     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("Test"));
       
  2139     CleanupStack::PushL(pFragment);
       
  2140     TXmlEngElement element = pFragment->AsElementL();
       
  2141     
       
  2142     TXmlEngElement element2 = element.AddNewElementL(_L8("Child"), _L8("nsuri"), _L8("prefix"));
       
  2143 
       
  2144     element2.AddNewElementL(_L8("Child2"), _L8("nsuri2"), _L8("prefix2"));
       
  2145     
       
  2146     HBufC* pAsXml = pFragment->AsXmlUnicodeL();
       
  2147     CleanupStack::PushL(pAsXml);
       
  2148     LOCAL_ASSERT( *pAsXml == _L("<Test xmlns:prefix=\"nsuri\"><prefix:Child xmlns:prefix2=\"nsuri2\"><prefix2:Child2/></prefix:Child></Test>") );
       
  2149     CleanupStack::PopAndDestroy(pAsXml);
       
  2150     CleanupStack::PopAndDestroy(pFragment);
       
  2151     return KErrNone;
       
  2152     }
       
  2153 
       
  2154 TInt CSenFragmentTester::MT_CSenFragmentBase_AsXmlLL(  )
       
  2155     {
       
  2156     // Test serialization of Dom tree which has two child elements
       
  2157     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("Test"));
       
  2158     CleanupStack::PushL(pFragment);
       
  2159     TXmlEngElement element = pFragment->AsElementL();
       
  2160     
       
  2161     TXmlEngElement element2 = element.AddNewElementL(_L8("Child"), _L8("nsuri"), _L8("prefix"));
       
  2162 
       
  2163     element2.AddNewElementL(_L8("Child2"), _L8("nsuri2"), _L8("prefix2"));
       
  2164     
       
  2165     HBufC8* pAsXml = pFragment->AsXmlL();
       
  2166     CleanupStack::PushL(pAsXml);
       
  2167     LOCAL_ASSERT( *pAsXml == _L8("<Test xmlns:prefix=\"nsuri\"><prefix:Child xmlns:prefix2=\"nsuri2\"><prefix2:Child2/></prefix:Child></Test>") );
       
  2168     CleanupStack::PopAndDestroy(pAsXml);
       
  2169     CleanupStack::PopAndDestroy(pFragment);
       
  2170     return KErrNone;
       
  2171     }
       
  2172 
       
  2173 TInt CSenFragmentTester::MT_CSenFragmentBase_WriteAsXMLToLL(  )
       
  2174     {
       
  2175     // Test serialization of Dom tree which has two child elements
       
  2176     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("Test"));
       
  2177     CleanupStack::PushL(pFragment);
       
  2178     TXmlEngElement element = pFragment->AsElementL();
       
  2179     
       
  2180     TXmlEngElement element2 = element.AddNewElementL(_L8("Child"), _L8("nsuri"), _L8("prefix"));
       
  2181 
       
  2182     element2.AddNewElementL(_L8("Child2"), _L8("nsuri2"), _L8("prefix2"));
       
  2183     
       
  2184     CBufFlat* pBuf = CBufFlat::NewL(200);
       
  2185     CleanupStack::PushL(pBuf);
       
  2186     RBufWriteStream bufWs(*pBuf);
       
  2187     CleanupClosePushL(bufWs);
       
  2188     pFragment->WriteAsXMLToL(bufWs);
       
  2189 
       
  2190 
       
  2191     LOCAL_ASSERT( pBuf->Ptr(0) == _L8("<Test xmlns:prefix=\"nsuri\"><prefix:Child xmlns:prefix2=\"nsuri2\"><prefix2:Child2/></prefix:Child></Test>") );
       
  2192     
       
  2193     CleanupStack::PopAndDestroy(&bufWs);
       
  2194     CleanupStack::PopAndDestroy(pBuf);
       
  2195     
       
  2196     CleanupStack::PopAndDestroy(pFragment);
       
  2197     return KErrNone;
       
  2198     }
       
  2199 
       
  2200 TInt CSenFragmentTester::MT_CSenFragmentBase_ConsistsOfLL(  )
       
  2201     {
       
  2202     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("Test"));
       
  2203     CleanupStack::PushL(pFragment);
       
  2204     TXmlEngElement element = pFragment->AsElementL();
       
  2205     
       
  2206     TXmlEngElement elementchild1 = element.AddNewElementL(_L8("DirectChild"));
       
  2207     elementchild1.AddNamespaceDeclarationL(_L8("nsuri"), _L8("prefix"));
       
  2208     //elementchild1.RenameNodeL(_L8("DirectChild"), _L8("nsuri"), _L8("prefix"));
       
  2209     TDomUtils domUtils;
       
  2210     domUtils.XmlEngRenameElementL(elementchild1, _L8("DirectChild"), _L8("nsuri"), _L8("prefix"));
       
  2211 
       
  2212 
       
  2213     TXmlEngElement elementchild2 = element.AddNewElementL(_L8("DirectChild"));
       
  2214     elementchild2.AddNamespaceDeclarationL(_L8("nsuri"), _L8("prefix"));
       
  2215     //elementchild2.RenameNodeL(_L8("DirectChild"), _L8("nsuri"), _L8("prefix"));
       
  2216     domUtils.XmlEngRenameElementL(elementchild2, _L8("DirectChild"), _L8("nsuri"), _L8("prefix"));
       
  2217 
       
  2218     elementchild2.AddNewElementL(_L8("Child"), _L8("nsuri2"), _L8("prefix2"));
       
  2219 
       
  2220     CSenFragmentBase* pFragment2 = CSenFragmentBase::NewL(_L8("Test"));
       
  2221     CleanupStack::PushL(pFragment2);
       
  2222     TXmlEngElement element2 = pFragment2->AsElementL();
       
  2223     
       
  2224     TXmlEngElement elementchild22 = element2.AddNewElementL(_L8("DirectChild"));
       
  2225     elementchild22.AddNamespaceDeclarationL(_L8("nsuri"), _L8("prefix"));
       
  2226     //elementchild22.RenameNodeL(_L8("DirectChild"), _L8("nsuri"), _L8("prefix"));
       
  2227     domUtils.XmlEngRenameElementL(elementchild22, _L8("DirectChild"), _L8("nsuri"), _L8("prefix"));
       
  2228 
       
  2229     elementchild22.AddNewElementL(_L8("Child"), _L8("nsuri2"), _L8("prefix2"));
       
  2230 
       
  2231     // ConsistOfL should return ETrue because
       
  2232     // root elements of both fragments match and the only element
       
  2233     // of pFragment2 = elementchild22 is exactly the same element as
       
  2234     // elementchild2.
       
  2235     LOCAL_ASSERT( pFragment->ConsistsOfL(*pFragment2) );
       
  2236 
       
  2237     // ConsistOfL should return EFalse because
       
  2238     // Even though root elements of both fragments match
       
  2239     // there is extra element (= elementchild1) in pFragment.
       
  2240     //
       
  2241     // elementchild1 (of pFragment) can not be found from pFragment2
       
  2242     // and because of that pFragment2 does not consist of pFragment.
       
  2243     LOCAL_ASSERT( !pFragment2->ConsistsOfL(*pFragment) );
       
  2244     CleanupStack::PopAndDestroy(pFragment2);
       
  2245 
       
  2246     CSenFragmentBase* pFragment3 = CSenFragmentBase::NewL(_L8("Test"));
       
  2247     CleanupStack::PushL(pFragment3);
       
  2248     TXmlEngElement element3 = pFragment3->AsElementL();
       
  2249     
       
  2250     TXmlEngElement elementchild32 = element3.AddNewElementL(_L8("DirectChild"));
       
  2251     elementchild32.AddNamespaceDeclarationL(_L8("nsuri"), _L8("prefix"));
       
  2252     //elementchild32.RenameNodeL(_L8("DirectChild"), _L8("nsuri"), _L8("prefix"));
       
  2253     domUtils.XmlEngRenameElementL(elementchild32, _L8("DirectChild"), _L8("nsuri"), _L8("prefix"));
       
  2254 
       
  2255     elementchild32.AddNewElementL(_L8("Child"), _L8("nsuri2"), _L8("prefix2"));
       
  2256     elementchild32.SetEscapedTextL(_L8("Text"));
       
  2257     
       
  2258     // ConsistOfL should return EFalse because
       
  2259     // elementchild32 has content ("Text") which doesn't match
       
  2260     // to any child element of pFragment.
       
  2261     LOCAL_ASSERT( !pFragment->ConsistsOfL(*pFragment3) );
       
  2262     CleanupStack::PopAndDestroy(pFragment3);
       
  2263     
       
  2264     CleanupStack::PopAndDestroy(pFragment);
       
  2265     return KErrNone;
       
  2266     }
       
  2267 
       
  2268 TInt CSenFragmentTester::MT_CSenFragmentBase_SetContentHandlerL(  )
       
  2269     {
       
  2270     // Will be tested in Parse test cases
       
  2271     LOCAL_ASSERT( ETrue );
       
  2272     return KErrNone;
       
  2273     }
       
  2274     
       
  2275 TInt CSenFragmentTester::MT_CSenFragmentBase_Parsing1L(  )
       
  2276     {
       
  2277     // Parsing of XML document to CSenFragmentBase
       
  2278     _LIT8(KInputString, "<a:Test xmlns=\"nsuri\" xmlns:a=\"nasuria\" \
       
  2279 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\">\
       
  2280 <Element1 xmlns:c=\"nsuric\" c:x=\"value4\">Content1</Element1>\
       
  2281 <Element2>Content2</Element2>\
       
  2282 <Element3>Content3</Element3>\
       
  2283 <Element4/></a:Test>");
       
  2284 
       
  2285     // Default namespace declaration (xmlns="nsuri") from Parent element (Test)
       
  2286     // will be moved to all child elements (Element1, Element2, Element3 and
       
  2287     // Element4) when EReportNamespaceMapping is _NOT_ enabled. That's because
       
  2288     // the way CParser works <=> Namespaces are reported when namespaces are used.
       
  2289     _LIT8(KOutputString1, "<a:Test xmlns:a=\"nasuria\" xmlns:b=\"nasurib\" \
       
  2290 a:x=\"value1\" b:z=\"value2\">\
       
  2291 <Element1 xmlns=\"nsuri\" xmlns:c=\"nsuric\" c:x=\"value4\">Content1</Element1>\
       
  2292 <Element2 xmlns=\"nsuri\">Content2</Element2>\
       
  2293 <Element3 xmlns=\"nsuri\">Content3</Element3>\
       
  2294 <Element4 xmlns=\"nsuri\"/></a:Test>");
       
  2295 
       
  2296     // When EReportNamespaceMapping is enabled all the namespace declarations
       
  2297     // are reported in exactly the same element as they are defined in parsed
       
  2298     // XML document.
       
  2299     // Note: The Order of namespace declarations in root element tag may change.
       
  2300     // Namespace declaration for root tag is created when fragment is created
       
  2301     // and because of that namespace declaration for root tag will be the first.
       
  2302     // In this particular case namespace declaration for prefix "a" will be
       
  2303     // the first namespace declaration because it is declared when
       
  2304     // CSenFragmentBase is created.
       
  2305     _LIT8(KOutputString2, "<a:Test xmlns:a=\"nasuria\" xmlns=\"nsuri\" \
       
  2306 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\">\
       
  2307 <Element1 xmlns:c=\"nsuric\" c:x=\"value4\">Content1</Element1>\
       
  2308 <Element2>Content2</Element2>\
       
  2309 <Element3>Content3</Element3>\
       
  2310 <Element4/></a:Test>");
       
  2311     
       
  2312 	CSenParser* pParser = CSenParser::NewLC();
       
  2313 	
       
  2314     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("nasuria"),_L8("Test"),_L8("a"));
       
  2315     CleanupStack::PushL(pFragment);
       
  2316 
       
  2317 /*	
       
  2318 	//tma
       
  2319 	pParser->ParseBeginL();
       
  2320 	
       
  2321 	_LIT8(KXmlParserMimeType,   "text/xml");
       
  2322 	pParser->ParseBeginL(KXmlParserMimeType);
       
  2323 		
       
  2324     CMatchData* pMatchData = CMatchData::NewLC();
       
  2325     pMatchData->SetMimeTypeL(KXmlParserMimeType);
       
  2326     pParser->ParseBeginL(*pMatchData);
       
  2327     CleanupStack::PopAndDestroy(pMatchData);
       
  2328 	//tma	
       
  2329 */
       
  2330 
       
  2331 	pParser->ParseL(KInputString, *pFragment);
       
  2332 	
       
  2333 	HBufC8* pAsXml = pFragment->AsXmlL();
       
  2334 	CleanupStack::PushL(pAsXml);
       
  2335 
       
  2336     LOCAL_ASSERT( *pAsXml == KOutputString1 );
       
  2337 
       
  2338     CleanupStack::PopAndDestroy(pAsXml);
       
  2339     CleanupStack::PopAndDestroy(pFragment);
       
  2340 
       
  2341 	pParser->EnableFeature(EReportNamespaceMapping);
       
  2342 	
       
  2343     CSenFragmentBase* pFragment2 = CSenFragmentBase::NewL(_L8("nasuria"),_L8("Test"),_L8("a"));
       
  2344     CleanupStack::PushL(pFragment2);
       
  2345 
       
  2346 	pParser->ParseL(KInputString, *pFragment2);
       
  2347 	
       
  2348 	HBufC8* pAsXml2 = pFragment2->AsXmlL();
       
  2349 	CleanupStack::PushL(pAsXml2);
       
  2350 	                   
       
  2351     LOCAL_ASSERT( *pAsXml2 == KOutputString2 );
       
  2352     
       
  2353     CleanupStack::PopAndDestroy(pAsXml2);
       
  2354     CleanupStack::PopAndDestroy(pFragment2);
       
  2355 
       
  2356     CleanupStack::PopAndDestroy(pParser);
       
  2357     return KErrNone;
       
  2358     }
       
  2359     
       
  2360 TInt CSenFragmentTester::MT_CSenFragmentBase_Parsing2L(  )
       
  2361     {
       
  2362     // Parsing of XML document to CSenFragmentBase which uses
       
  2363     // delegation.
       
  2364     _LIT8(KInputString, "<a:Test xmlns:a=\"nasuria\" xmlns:b=\"nsurib\" \
       
  2365 xmlns=\"nsuri\" a:x=\"value1\" b:z=\"value2\">\
       
  2366 <DelegateFragment>DelegateContent</DelegateFragment>\
       
  2367 <Element1 x=\"value4\">Content1</Element1>\
       
  2368 <Element2>Content2</Element2></a:Test>");
       
  2369 
       
  2370     // Default namespace declaration (xmlns="nsuri") from Parent element (Test)
       
  2371     // will be moved to all child elements (Element1, Element2, Element3 and
       
  2372     // Element4) when EReportNamespaceMapping is _NOT_ enabled. That's because
       
  2373     // the way CParser works <=> Namespaces are reported when namespaces are used
       
  2374     // for the first time.
       
  2375     // Note: In CSenFragmentBase case DelegateFragment won't be in
       
  2376     //       content of parent fragment which did the delegation.
       
  2377     _LIT8(KOutputString1, "<a:Test xmlns:a=\"nasuria\" xmlns:b=\"nsurib\" \
       
  2378 a:x=\"value1\" b:z=\"value2\">\
       
  2379 <Element1 xmlns=\"nsuri\" x=\"value4\">Content1</Element1>\
       
  2380 <Element2 xmlns=\"nsuri\">Content2</Element2></a:Test>");
       
  2381 
       
  2382     // When EReportNamespaceMapping is enabled all the namespace declarations
       
  2383     // are reported in exactly the same element as they are defined in parsed
       
  2384     // XML document.
       
  2385     // Note: The Order of namespace declarations in root element tag may change.
       
  2386     // Namespace declaration for root tag is created when fragment is created
       
  2387     // and because of that namespace declaration for root tag will be the first.
       
  2388     // Note: In CSenFragmentBase case DelegateFragment won't be in
       
  2389     //       content of parent fragment which did the delegation.
       
  2390     _LIT8(KOutputString2, "<a:Test xmlns:a=\"nasuria\" xmlns:b=\"nsurib\" \
       
  2391 xmlns=\"nsuri\" a:x=\"value1\" b:z=\"value2\">\
       
  2392 <Element1 x=\"value4\">Content1</Element1>\
       
  2393 <Element2>Content2</Element2></a:Test>");
       
  2394      
       
  2395 	CSenParser* pParser = CSenParser::NewLC();
       
  2396 	
       
  2397     CMainFragment* pFragment = CMainFragment::NewL(_L8("nasuria"),_L8("Test"),_L8("a"));
       
  2398     CleanupStack::PushL(pFragment);
       
  2399 	
       
  2400 	pParser->ParseL(KInputString, *pFragment);
       
  2401 	
       
  2402 	HBufC8* pAsXml = pFragment->AsXmlL();
       
  2403 	CleanupStack::PushL(pAsXml);
       
  2404     LOCAL_ASSERT( *pAsXml == KOutputString1 );
       
  2405     CleanupStack::PopAndDestroy(pAsXml);
       
  2406     
       
  2407     CDelegateFragment& delegate = pFragment->DelegateFragment();
       
  2408     HBufC8* pDelegateAsXml = delegate.AsXmlL();
       
  2409     CleanupStack::PushL(pDelegateAsXml);
       
  2410     LOCAL_ASSERT( *pDelegateAsXml ==
       
  2411                  _L8("<DelegateFragment xmlns=\"nsuri\">DelegateContent</DelegateFragment>") );
       
  2412     CleanupStack::PopAndDestroy(pDelegateAsXml);
       
  2413     
       
  2414     CleanupStack::PopAndDestroy(pFragment);
       
  2415 
       
  2416 	pParser->EnableFeature(EReportNamespaceMapping);
       
  2417 	
       
  2418     CMainFragment* pFragment2 = CMainFragment::NewL(_L8("nasuria"),_L8("Test"),_L8("a"));
       
  2419     CleanupStack::PushL(pFragment2);
       
  2420 
       
  2421 	pParser->ParseL(KInputString, *pFragment2);
       
  2422 	
       
  2423 	HBufC8* pAsXml2 = pFragment2->AsXmlL();
       
  2424 	CleanupStack::PushL(pAsXml2);
       
  2425     LOCAL_ASSERT( *pAsXml2 == KOutputString2 );
       
  2426     CleanupStack::PopAndDestroy(pAsXml2);
       
  2427     
       
  2428     CDelegateFragment& delegate2 = pFragment2->DelegateFragment();
       
  2429     HBufC8* pDelegateAsXml2 = delegate2.AsXmlL();
       
  2430     CleanupStack::PushL(pDelegateAsXml2);
       
  2431     LOCAL_ASSERT( *pDelegateAsXml2 ==
       
  2432                  _L8("<DelegateFragment xmlns=\"nsuri\">DelegateContent</DelegateFragment>") );
       
  2433     CleanupStack::PopAndDestroy(pDelegateAsXml2);
       
  2434     
       
  2435     CleanupStack::PopAndDestroy(pFragment2);
       
  2436 
       
  2437     CleanupStack::PopAndDestroy(pParser);
       
  2438     return KErrNone;
       
  2439     }
       
  2440     
       
  2441 TInt CSenFragmentTester::MT_CSenFragmentBase_Parsing3L(  )
       
  2442     {
       
  2443     // Parsing of XML document to CSenFragmentBase
       
  2444     _LIT8(KInputString, "<a:Test xmlns=\"nsuri\" xmlns:a=\"nasuria\" \
       
  2445 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\" z=\"value3\">\
       
  2446 <Element1 xmlns:c=\"nsuric\" c:x=\"value4\">Content1</Element1>\
       
  2447 <x:Element2 xmlns:x=\"nsuri\">Content2</x:Element2>\
       
  2448 <Element3>Content3</Element3>\
       
  2449 <Element4/></a:Test>");
       
  2450 
       
  2451     _LIT8(KOutputString, "<a:Test xmlns:a=\"nasuria\" xmlns=\"nsuri\" \
       
  2452 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\" z=\"value3\">\
       
  2453 <Element1 xmlns:c=\"nsuric\" c:x=\"value4\">Content1</Element1>\
       
  2454 <x:Element2 xmlns:x=\"nsuri\">Content2</x:Element2>\
       
  2455 <Element3>Content3</Element3>\
       
  2456 <Element4/></a:Test>");
       
  2457     
       
  2458 	CSenParser* pParser = CSenParser::NewLC();
       
  2459 	
       
  2460     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("nasuria"),_L8("Test"),_L8("a"));
       
  2461     CleanupStack::PushL(pFragment);
       
  2462 	pParser->EnableFeature(EReportNamespaceMapping);
       
  2463 	
       
  2464 	pParser->ParseL(KInputString, *pFragment);
       
  2465 	
       
  2466 	HBufC8* pAsXml = pFragment->AsXmlL();
       
  2467 	CleanupStack::PushL(pAsXml);
       
  2468 
       
  2469     LOCAL_ASSERT( *pAsXml == KOutputString );
       
  2470 
       
  2471     CleanupStack::PopAndDestroy(pAsXml);
       
  2472     CleanupStack::PopAndDestroy(pFragment);
       
  2473     CleanupStack::PopAndDestroy(pParser);
       
  2474     return KErrNone;
       
  2475     }    
       
  2476 
       
  2477 TInt CSenFragmentTester::MT_CSenFragmentBase_Parsing4L(  )
       
  2478     {
       
  2479     // Parsing of XML document to CSenFragmentBase
       
  2480     // In this test nested elements (which have same name) are tested.
       
  2481     _LIT8(KInputString, "<a:Test xmlns=\"nsuri\" xmlns:a=\"nasuria\" \
       
  2482 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\" z=\"value3\">\
       
  2483 <Element1 xmlns:c=\"nsuric\" c:x=\"value4\">\
       
  2484 <Element1>Content</Element1>\
       
  2485 </Element1>\
       
  2486 <Element3>Content3</Element3>\
       
  2487 <Element4/></a:Test>");
       
  2488 
       
  2489     _LIT8(KInputString2, "<Nested xmlns=\"nsuri\">\
       
  2490 <Nested attr=\"attrvalue\"><Nested><Nested>Content</Nested></Nested></Nested>\
       
  2491 </Nested>");
       
  2492 
       
  2493     // Only namespace declaration order changes for output.
       
  2494     // Element4 which has no content will be output with
       
  2495     // start and end tags.
       
  2496     _LIT8(KOutputString, "<a:Test xmlns:a=\"nasuria\" xmlns=\"nsuri\" \
       
  2497 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\" z=\"value3\">\
       
  2498 <Element1 xmlns:c=\"nsuric\" c:x=\"value4\">\
       
  2499 <Element1>Content</Element1>\
       
  2500 </Element1>\
       
  2501 <Element3>Content3</Element3>\
       
  2502 <Element4/></a:Test>");
       
  2503 
       
  2504 	CSenParser* pParser = CSenParser::NewLC();
       
  2505 	
       
  2506     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("nasuria"),_L8("Test"),_L8("a"));
       
  2507     CleanupStack::PushL(pFragment);
       
  2508 	pParser->EnableFeature(EReportNamespaceMapping);
       
  2509 	
       
  2510 	pParser->ParseL(KInputString, *pFragment);
       
  2511 	
       
  2512 	HBufC8* pAsXml = pFragment->AsXmlL();
       
  2513 	CleanupStack::PushL(pAsXml);
       
  2514 
       
  2515     LOCAL_ASSERT( *pAsXml == KOutputString );
       
  2516 
       
  2517     CleanupStack::PopAndDestroy(pAsXml);
       
  2518     CleanupStack::PopAndDestroy(pFragment);
       
  2519 
       
  2520     pFragment = CSenFragmentBase::NewL(_L8("nsuri"),_L8("Nested"));
       
  2521     CleanupStack::PushL(pFragment);
       
  2522 	pParser->EnableFeature(EReportNamespaceMapping);
       
  2523 	
       
  2524 	pParser->ParseL(KInputString2, *pFragment);
       
  2525 	
       
  2526 	pAsXml = pFragment->AsXmlL();
       
  2527 	CleanupStack::PushL(pAsXml);
       
  2528 
       
  2529     LOCAL_ASSERT( *pAsXml == KInputString2 );
       
  2530 
       
  2531     CleanupStack::PopAndDestroy(pAsXml);
       
  2532     CleanupStack::PopAndDestroy(pFragment);
       
  2533 
       
  2534     CleanupStack::PopAndDestroy(pParser);
       
  2535     return KErrNone;
       
  2536     }    
       
  2537 
       
  2538 TInt CSenFragmentTester::MT_CSenFragmentBase_Parsing5L(  )
       
  2539     {
       
  2540     // Parsing of XML document to CSenDomFragmentBase
       
  2541     // when constructor CSenDomFragmentBase::NewL() is used.
       
  2542     _LIT8(KInputString, "<S:Envelope xmlns:S=\"http://www.w3.org/2003/05/soap-envelope\" \
       
  2543 xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">\
       
  2544 <S:Header>\
       
  2545 <wsa:MessageID>URN:UUID:ACF914D6-86A4-E5CF-4BD2-BD9CC2AD30E1</wsa:MessageID>\
       
  2546 <wsa:To>http://10.132.11.35/WSStar/STS.aspx</wsa:To>\
       
  2547 <wsa:Action>http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</wsa:Action>\
       
  2548 <wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">\
       
  2549 <wsse:UsernameToken>\
       
  2550 <wsse:Username>PCNSA15\\wsstar</wsse:Username>\
       
  2551 <wsse:Password>jaszmn\\3</wsse:Password>\
       
  2552 </wsse:UsernameToken>\
       
  2553 </wsse:Security>\
       
  2554 </S:Header>\
       
  2555 <S:Body>\
       
  2556 <wst:RequestSecurityToken xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\">\
       
  2557 <wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</wst:RequestType>\
       
  2558 <wst:Renewing/>\
       
  2559 <wst:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</wst:TokenType>\
       
  2560 <wsp:AppliesTo xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\">\
       
  2561 <wsa:EndpointReference>\
       
  2562 <wsa:Address>http://10.132.11.35/WSStar/WSService.aspx</wsa:Address>\
       
  2563 </wsa:EndpointReference>\
       
  2564 </wsp:AppliesTo>\
       
  2565 </wst:RequestSecurityToken>\
       
  2566 </S:Body>\
       
  2567 </S:Envelope>");
       
  2568 
       
  2569     // Note: If EReportNamespaceMapping is not enabled output will be following:
       
  2570     //       (Namespace declaration for prefix "wsa" jumps from root element to
       
  2571     //        elements (MessageID, To, Action and EndpointReference) which actually
       
  2572     //        use above mentioned prefix. <=> Root element Envelope does not use
       
  2573     //        "wsa" prefix.)
       
  2574     _LIT8(KOutputString1, "<S:Body xmlns:S=\"http://www.w3.org/2003/05/soap-envelope\">\
       
  2575 <wst:RequestSecurityToken xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\">\
       
  2576 <wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</wst:RequestType>\
       
  2577 <wst:Renewing/>\
       
  2578 <wst:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</wst:TokenType>\
       
  2579 <wsp:AppliesTo xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\">\
       
  2580 <wsa:EndpointReference xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">\
       
  2581 <wsa:Address>http://10.132.11.35/WSStar/WSService.aspx</wsa:Address>\
       
  2582 </wsa:EndpointReference>\
       
  2583 </wsp:AppliesTo>\
       
  2584 </wst:RequestSecurityToken>\
       
  2585 </S:Body>");
       
  2586 
       
  2587     _LIT8(KOutputString2, "<S:Body xmlns:S=\"http://www.w3.org/2003/05/soap-envelope\" \
       
  2588 xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\" \
       
  2589 xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">\
       
  2590 <wst:RequestSecurityToken xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\">\
       
  2591 <wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</wst:RequestType>\
       
  2592 <wst:Renewing/>\
       
  2593 <wst:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</wst:TokenType>\
       
  2594 <wsp:AppliesTo xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\">\
       
  2595 <wsa:EndpointReference>\
       
  2596 <wsa:Address>http://10.132.11.35/WSStar/WSService.aspx</wsa:Address>\
       
  2597 </wsa:EndpointReference>\
       
  2598 </wsp:AppliesTo>\
       
  2599 </wst:RequestSecurityToken>\
       
  2600 </S:Body>");
       
  2601 
       
  2602     CSenParser* parser = CSenParser::NewLC();
       
  2603     //create a CSenDomFragment
       
  2604 	CSenFragmentBase* pBase = CSenFragmentBase::NewL(_L8("http://www.w3.org/2003/05/soap-envelope"),
       
  2605 	                                                 _L8("Body"),
       
  2606 	                                                 _L8("S"));
       
  2607 	CleanupStack::PushL(pBase);
       
  2608 	//do the parsing
       
  2609 	parser->ParseL(KInputString, *pBase);
       
  2610 	
       
  2611     HBufC8* pAsXml = pBase->AsXmlL();
       
  2612     CleanupStack::PushL(pAsXml);
       
  2613     LOCAL_ASSERT( *pAsXml == KOutputString1 );
       
  2614     CleanupStack::PopAndDestroy(pAsXml);
       
  2615     CleanupStack::PopAndDestroy(pBase);
       
  2616 
       
  2617     pBase = CSenFragmentBase::NewL(_L8("http://www.w3.org/2003/05/soap-envelope"),
       
  2618 	                               _L8("Body"),
       
  2619 	                               _L8("S"));
       
  2620     CleanupStack::PushL(pBase);
       
  2621     //Enable NamespaceMapping to ensure that namespace declarations will
       
  2622     //remain in exactly the same place as in original XML document
       
  2623     parser->EnableFeature(EReportNamespaceMapping);
       
  2624 	//do the parsing
       
  2625 	parser->ParseL(KInputString, *pBase);
       
  2626 	
       
  2627     pAsXml = pBase->AsXmlL();
       
  2628     CleanupStack::PushL(pAsXml);
       
  2629     LOCAL_ASSERT( *pAsXml == KOutputString2 );
       
  2630     CleanupStack::PopAndDestroy(pAsXml);
       
  2631     
       
  2632     CleanupStack::PopAndDestroy(pBase);
       
  2633     CleanupStack::PopAndDestroy(parser);
       
  2634     return KErrNone;
       
  2635     }
       
  2636 
       
  2637 TInt CSenFragmentTester::MT_CSenParser_NewLL(  )
       
  2638     {
       
  2639     CSenParser* pParser = CSenParser::NewL();
       
  2640     delete pParser;
       
  2641     return KErrNone;
       
  2642     }
       
  2643 
       
  2644 TInt CSenFragmentTester::MT_CSenParser_NewLCL(  )
       
  2645     {
       
  2646     CSenParser* pParser = CSenParser::NewLC();
       
  2647     CleanupStack::PopAndDestroy(pParser);
       
  2648     return KErrNone;
       
  2649     }
       
  2650 
       
  2651 TInt CSenFragmentTester::MT_CSenParser_NewL_1L(  )
       
  2652     {
       
  2653     _LIT8(KXmlParserMimeType,   "text/xml");
       
  2654     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("Test"));
       
  2655     CleanupStack::PushL(pFragment);
       
  2656     CParser* pParser = CParser::NewL(KXmlParserMimeType, *pFragment);
       
  2657 
       
  2658     // Ownership of the pParser is transfered to pSenParser
       
  2659     CSenParser* pSenParser = CSenParser::NewL(pParser);
       
  2660     delete pSenParser;
       
  2661 
       
  2662     CleanupStack::PopAndDestroy(pFragment);
       
  2663     return KErrNone;
       
  2664     }
       
  2665 
       
  2666 TInt CSenFragmentTester::MT_CSenParser_NewLC_1L(  )
       
  2667     {
       
  2668     _LIT8(KXmlParserMimeType,   "text/xml");
       
  2669     CSenFragmentBase* pFragment = CSenFragmentBase::NewL(_L8("Test"));
       
  2670     CleanupStack::PushL(pFragment);
       
  2671     CParser* pParser = CParser::NewL(KXmlParserMimeType, *pFragment);
       
  2672 
       
  2673     // Ownership of the pParser is transfered to pSenParser
       
  2674     CSenParser* pSenParser = CSenParser::NewLC(pParser);
       
  2675     CleanupStack::PopAndDestroy(pSenParser);
       
  2676 
       
  2677     CleanupStack::PopAndDestroy(pFragment);
       
  2678     return KErrNone;
       
  2679     }
       
  2680 
       
  2681 TInt CSenFragmentTester::MT_CSenParser_NewL_2L(  )
       
  2682     {
       
  2683     _LIT8(KXmlParserMimeType,   "text/xml");
       
  2684     CSenParser* pParser = CSenParser::NewL(KXmlParserMimeType);
       
  2685     delete pParser;
       
  2686     return KErrNone;
       
  2687     }
       
  2688 
       
  2689 TInt CSenFragmentTester::MT_CSenParser_NewLC_2L(  )
       
  2690     {
       
  2691     _LIT8(KXmlParserMimeType,   "text/xml");
       
  2692     CSenParser* pParser = CSenParser::NewLC(KXmlParserMimeType);
       
  2693     CleanupStack::PopAndDestroy(pParser);
       
  2694     return KErrNone;
       
  2695     }
       
  2696 
       
  2697 TInt CSenFragmentTester::MT_RSenDocument_NewLL(  )
       
  2698     {
       
  2699     RSenDocument document = RSenDocument::NewL();
       
  2700     document.Close();
       
  2701     LOCAL_ASSERT( document.IsNull() );
       
  2702     return KErrNone;
       
  2703     }
       
  2704 
       
  2705 TInt CSenFragmentTester::MT_RSenDocument_NewLCL(  )
       
  2706     {
       
  2707     RSenDocument document = RSenDocument::NewLC();
       
  2708     CleanupStack::PopAndDestroy();
       
  2709     
       
  2710     // Can't use IsNull() function because iInternal pointer
       
  2711     // (of document) is not NULLed. Only data for which iInternal
       
  2712     // points to is deleted.
       
  2713     //LOCAL_ASSERT( document.IsNull() );
       
  2714     return KErrNone;
       
  2715     }
       
  2716 
       
  2717 TInt CSenFragmentTester::MT_RSenDocument_NewL_1L(  )
       
  2718     {
       
  2719     // Can't test RSenDocument::NewL(void* aInternal)
       
  2720     // because there is no way to get proper aInternal
       
  2721     // using public API.
       
  2722     LOCAL_ASSERT( ETrue );
       
  2723     return KErrNone;
       
  2724     }
       
  2725 
       
  2726 TInt CSenFragmentTester::MT_RSenDocument_NewLC_1L(  )
       
  2727     {
       
  2728     // Can't test RSenDocument::NewLC(void* aInternal)
       
  2729     // because there is no way to get proper aInternal
       
  2730     // using public API.
       
  2731     LOCAL_ASSERT( ETrue );
       
  2732     return KErrNone;
       
  2733     }
       
  2734 
       
  2735 TInt CSenFragmentTester::MT_RSenDocument_CopyL(  )
       
  2736     {
       
  2737     RSenDocument document1 = RSenDocument::NewL();
       
  2738     TXmlEngElement element = document1.CreateDocumentElementL(_L8("Test"));
       
  2739     
       
  2740     element.AddTextL(_L8("testcontent"));
       
  2741     
       
  2742     RSenDocument document2 = document1.Copy();
       
  2743     
       
  2744     // Check that main elements of document1 and document2 
       
  2745     // are pointing to the same "in memory node" after copying.
       
  2746     LOCAL_ASSERT( element.IsSameNode(document2.DocumentElement()) );
       
  2747     
       
  2748     // Test that document2 contains the same data as document1
       
  2749     // did contain before closing document1.
       
  2750     document1.Close();
       
  2751     RBuf8 asXml;
       
  2752     TXmlEngSerializationOptions options;
       
  2753     options.iOptions = options.iOptions |
       
  2754                        TXmlEngSerializationOptions::KOptionOmitXMLDeclaration;
       
  2755     document2.SaveL(asXml, element, options);
       
  2756     CleanupClosePushL(asXml);
       
  2757     LOCAL_ASSERT( asXml == _L8("<Test>testcontent</Test>") );
       
  2758     CleanupStack::PopAndDestroy(&asXml);
       
  2759     
       
  2760     document2.Close();
       
  2761     LOCAL_ASSERT( document1.IsNull() && document2.IsNull() );
       
  2762     return KErrNone;
       
  2763     }
       
  2764 
       
  2765 TInt CSenFragmentTester::MT_RSenDocument_CloseL(  )
       
  2766     {
       
  2767     RSenDocument document = RSenDocument::NewL();
       
  2768     document.Close();
       
  2769     LOCAL_ASSERT( document.IsNull() );
       
  2770     return KErrNone;
       
  2771     }
       
  2772 
       
  2773 TInt CSenFragmentTester::MT_RSenDocument_DestroyL(  )
       
  2774     {
       
  2775     RSenDocument document = RSenDocument::NewL();
       
  2776     document.Destroy();
       
  2777     LOCAL_ASSERT( document.IsNull() );
       
  2778     return KErrNone;
       
  2779     }
       
  2780 
       
  2781 // -----------------------------------------------------------------------------
       
  2782 // CSenFragmentTester::?member_function
       
  2783 // ?implementation_description
       
  2784 // (other items were commented in a header).
       
  2785 // -----------------------------------------------------------------------------
       
  2786 //
       
  2787 /*
       
  2788 TInt CSenFragmentTester::?member_function(
       
  2789    CItemParser& aItem )
       
  2790    {
       
  2791 
       
  2792    ?code
       
  2793 
       
  2794    }
       
  2795 */
       
  2796 
       
  2797 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
  2798 // None
       
  2799 
       
  2800 //  [End of File] - Do not remove