xml/libxml2libs/test/xmlengtester/xmlengtester_emulator/src/xmlengtesterblocksserdefault.cpp
changeset 0 e35f40988205
child 17 ed3155dbd163
child 32 889504eac4fb
equal deleted inserted replaced
-1:000000000000 0:e35f40988205
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include "TestContentHandler.h"
       
    19 #include "xmlengtester.h"
       
    20 
       
    21 #include <e32svr.h>
       
    22 #include <e32std.h>
       
    23 #include <domain/osextensions/StifParser.h>
       
    24 #include <domain/osextensions/Stiftestinterface.h>
       
    25 #include "XmlEngBinaryContainer.h"
       
    26 #include "XmlEngChunkContainer.h"
       
    27 #include "xmlengtesterdef.h"
       
    28 
       
    29 #include <XmlEngSerializer.h>
       
    30 #include <XmlEngDeserializer.h>
       
    31 
       
    32 #include <InetProtTextUtils.h>
       
    33 #include <libc\string.h>
       
    34 #include <charconv.h>
       
    35 #include <UTF.H>
       
    36 #include <XmlEngDOMParser.h>
       
    37 
       
    38 /************************************** SerXOP ****************************************/
       
    39 
       
    40 
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // CLibxml2Tester::SerializeDefaultFileL
       
    44 // serialization to file test function 
       
    45 // specification
       
    46 // (other items were commented in a header).
       
    47 // -----------------------------------------------------------------------------
       
    48 //	
       
    49 
       
    50 TInt CLibxml2Tester::SerializeDefaultFileL(CStifItemParser& aItem)
       
    51 	{
       
    52 	TPtrC pData;
       
    53 	aItem.GetNextString(pData);
       
    54 	
       
    55 	TPtrC pDoc;
       
    56 	aItem.GetNextString(pDoc);
       
    57 	
       
    58 	TPtrC pOut;
       
    59 	aItem.GetNextString(pOut);
       
    60 	   
       
    61     iDoc = parser.ParseFileL(pDoc);
       
    62         
       
    63   	HBufC8* buffer = ReadFileToBufferL(pData);
       
    64 	CleanupStack::PushL( buffer );
       
    65     
       
    66     //create binary container  
       
    67 	TXmlEngBinaryContainer binaryData = iDoc.CreateBinaryContainerL(CID_1(),buffer->Des());
       
    68 	iDoc.DocumentElement().AppendChildL(binaryData);
       
    69 	
       
    70 	
       
    71 	
       
    72 	// procesing
       
    73 	
       
    74 	
       
    75 	
       
    76 	// create serializer 
       
    77 	CXmlEngSerializer* serializer = CXmlEngSerializer::NewL();
       
    78 	CleanupStack::PushL(serializer);
       
    79 	
       
    80 	// set serialization options
       
    81 	TXmlEngSerializationOptions options ( TXmlEngSerializationOptions::KOptionStandalone );
       
    82 	serializer->SetSerializationOptions( options );
       
    83 	
       
    84 	// set output
       
    85 	TFileName srcFileName( pOut );
       
    86 	serializer->SetOutputL( srcFileName );	
       
    87 	
       
    88 	// serialize
       
    89 	TInt serializedBits = serializer->SerializeL( iDoc );
       
    90 	
       
    91 	// end processing
       
    92 	
       
    93 	CleanupStack::PopAndDestroy( 2 ); 
       
    94 	return KErrNone;
       
    95 	}
       
    96 		
       
    97 
       
    98 // End of file