secureswitools/swisistools/source/interpretsislib/xmlgenerator.cpp
changeset 50 c6e8afe0ba85
parent 25 98b66e4fb0be
child 55 ac7f90a6ff4c
equal deleted inserted replaced
46:bb1748e0dd9b 50:c6e8afe0ba85
    24 */
    24 */
    25 
    25 
    26 #include "xmlgenerator.h"
    26 #include "xmlgenerator.h"
    27 #include "../common/exception.h"
    27 #include "../common/exception.h"
    28 #include "is_utils.h"
    28 #include "is_utils.h"
       
    29 #include "../common/util.h"
       
    30 #include "utf8_wrapper.h"
    29 
    31 
    30 #include <xercesc/dom/DOM.hpp>
    32 #include <xercesc/dom/DOM.hpp>
    31 #include <xercesc/util/XMLString.hpp>
    33 #include <xercesc/util/XMLString.hpp>
    32 #include <xercesc/util/PlatformUtils.hpp>
    34 #include <xercesc/util/PlatformUtils.hpp>
    33 #include <xercesc/framework/StdOutFormatTarget.hpp>
    35 #include <xercesc/framework/StdOutFormatTarget.hpp>
    53 typedef void (XERCES_CPP_NAMESPACE::DOMDocument::*releaseDOMDoc) ();
    55 typedef void (XERCES_CPP_NAMESPACE::DOMDocument::*releaseDOMDoc) ();
    54 typedef void (XERCES_CPP_NAMESPACE::DOMWriter::*releaseDOMWriter) ();
    56 typedef void (XERCES_CPP_NAMESPACE::DOMWriter::*releaseDOMWriter) ();
    55 typedef void (*xmlPlatform) ();
    57 typedef void (*xmlPlatform) ();
    56 typedef void (*releaseXmlChPtr) (XMLCh** buf);
    58 typedef void (*releaseXmlChPtr) (XMLCh** buf);
    57 
    59 
    58 // constants used for writing to the xml file
    60 
    59 std::wstring	PreProvisionInformation(L"PreProvisionInformation");
    61 //------------------------------------- Literals ------------------------------------------
    60 std::wstring	SoftwareTypeName(L"SoftwareTypeName");
    62 // Xerces literals are of type XMLCh*. For gcc XMLCh is defined as unsigned short (UCS16). 
       
    63 // In windows wchar_t has the same size as XMLCh therefor literals defined as L"This is a 
       
    64 // literal" will work. But in linux size of wchar_t is 4 (UCS32) bytes and hence L cannot 
       
    65 // be used for defining literals. To avoid string conversion and dynamic memory allocation 
       
    66 // following method is used to represent unsigned short literal. Current compiler has the 
       
    67 // limitation to represent such literals.
       
    68 //-----------------------------------------------------------------------------------------
       
    69 const XMLCh* KPreProvisionInformation = (const XMLCh*)    "P\0r\0e\0P\0r\0o\0v\0i\0s\0i\0o\0n\0I\0n\0f\0o\0r\0m\0a\0t\0i\0o\0n\0\0\0";
       
    70 const XMLCh* KSoftwareTypeName = (const XMLCh*)           "S\0o\0f\0t\0w\0a\0r\0e\0T\0y\0p\0e\0N\0a\0m\0e\0\0\0";
       
    71 const XMLCh* KUTF16 = (const XMLCh*)                      "U\0T\0F\0-\0001\0006\0\0\0";
       
    72 const XMLCh* KComponent = (const XMLCh*)                  "C\0o\0m\0p\0o\0n\0e\0n\0t\0\0\0";
       
    73 const XMLCh* KDependentId = (const XMLCh*)                "D\0e\0p\0e\0n\0d\0e\0n\0t\0I\0d\0\0\0"; 
       
    74 const XMLCh* KToVersion = (const XMLCh*)                  "T\0o\0V\0e\0r\0s\0i\0o\0n\0\0\0";
       
    75 const XMLCh* KFromVersion = (const XMLCh*)                "F\0r\0o\0m\0V\0e\0r\0s\0i\0o\0n\0\0\0";
       
    76 const XMLCh* KSupplierId = (const XMLCh*)                 "S\0u\0p\0p\0l\0i\0e\0r\0I\0d\0\0\0";
       
    77 const XMLCh* KName = (const XMLCh*)                       "N\0a\0m\0e\0\0\0";
       
    78 const XMLCh* KFileProperty_StrValue = (const XMLCh*)      "F\0i\0l\0e\0P\0r\0o\0p\0e\0r\0t\0y\0_\0S\0t\0r\0V\0a\0l\0u\0e\0\0\0";
       
    79 const XMLCh* KFileProperty_IntValue = (const XMLCh*)      "F\0i\0l\0e\0P\0r\0o\0p\0e\0r\0t\0y\0_\0I\0n\0t\0V\0a\0l\0u\0e\0\0\0";
       
    80 const XMLCh* KLocation = (const XMLCh*)                   "L\0o\0c\0a\0t\0i\0o\0n\0\0\0";
       
    81 const XMLCh* KComponentProperty_IsBinary = (const XMLCh*) "C\0o\0m\0p\0o\0n\0e\0n\0t\0P\0r\0o\0p\0e\0r\0t\0y\0_\0I\0s\0B\0i\0n\0a\0r\0y\0\0\0";
       
    82 const XMLCh* KComponentProperty_StrValue = (const XMLCh*) "C\0o\0m\0p\0o\0n\0e\0n\0t\0P\0r\0o\0p\0e\0r\0t\0y\0_\0S\0t\0r\0V\0a\0l\0u\0e\0\0\0";
       
    83 const XMLCh* KComponentProperty_IntValue = (const XMLCh*) "C\0o\0m\0p\0o\0n\0e\0n\0t\0P\0r\0o\0p\0e\0r\0t\0y\0_\0I\0n\0t\0V\0a\0l\0u\0e\0\0\0";
       
    84 const XMLCh* KComponentProperty_Locale = (const XMLCh*)   "C\0o\0m\0p\0o\0n\0e\0n\0t\0P\0r\0o\0p\0e\0r\0t\0y\0_\0L\0o\0c\0a\0l\0e\0\0\0";
       
    85 const XMLCh* KComponentLocalizable_Vendor=(const XMLCh*)  "C\0o\0m\0p\0o\0n\0e\0n\0t\0L\0o\0c\0a\0l\0i\0z\0a\0b\0l\0e\0_\0V\0e\0n\0d\0o\0r\0\0\0";
       
    86 const XMLCh* KComponentLocalizable_Name = (const XMLCh*)  "C\0o\0m\0p\0o\0n\0e\0n\0t\0L\0o\0c\0a\0l\0i\0z\0a\0b\0l\0e\0_\0N\0a\0m\0e\0\0\0";
       
    87 const XMLCh* KComponentLocalizable_Locale=(const XMLCh*)  "C\0o\0m\0p\0o\0n\0e\0n\0t\0L\0o\0c\0a\0l\0i\0z\0a\0b\0l\0e\0_\0L\0o\0c\0a\0l\0e\0\0\0";
       
    88 const XMLCh* KBuild = (const XMLCh*)                      "B\0u\0i\0l\0d\0\0\0";
       
    89 const XMLCh* KMinor = (const XMLCh*)                      "M\0i\0n\0o\0r\0\0\0";
       
    90 const XMLCh* KMajor = (const XMLCh*)                      "M\0a\0j\0o\0r\0\0\0";
       
    91 const XMLCh* KVersion = (const XMLCh*)                    "V\0e\0r\0s\0i\0o\0n\0\0\0"; 
       
    92 const XMLCh* KHidden = (const XMLCh*)                     "H\0i\0d\0d\0e\0n\0\0\0";
       
    93 const XMLCh* KOriginVerified = (const XMLCh*)             "O\0r\0i\0g\0i\0n\0V\0e\0r\0i\0f\0i\0e\0d\0\0\0";
       
    94 const XMLCh* KGlobalId = (const XMLCh*)                   "G\0l\0o\0b\0a\0l\0I\0d\0\0\0";
       
    95 const XMLCh* KScomoState = (const XMLCh*)                 "S\0c\0o\0m\0o\0S\0t\0a\0t\0e\0\0\0";
       
    96 const XMLCh* KSize = (const XMLCh*)                       "S\0i\0z\0e\0\0\0";
       
    97 const XMLCh* KRemovable = (const XMLCh*)                  "R\0e\0m\0o\0v\0a\0b\0l\0e\0\0\0";
       
    98 const XMLCh* KComponentLocalizable = (const XMLCh*)       "C\0o\0m\0p\0o\0n\0e\0n\0t\0L\0o\0c\0a\0l\0i\0z\0a\0b\0l\0e\0\0\0";
       
    99 const XMLCh* KComponentProperty = (const XMLCh*)          "C\0o\0m\0p\0o\0n\0e\0n\0t\0P\0r\0o\0p\0e\0r\0t\0y\0\0\0";
       
   100 const XMLCh* KComponentProperty_Value = (const XMLCh*)    "C\0o\0m\0p\0o\0n\0e\0n\0t\0P\0r\0o\0p\0e\0r\0t\0y\0_\0V\0a\0l\0u\0e\0\0\0";
       
   101 const XMLCh* KComponentFile = (const XMLCh*)              "C\0o\0m\0p\0o\0n\0e\0n\0t\0F\0i\0l\0e\0\0\0";
       
   102 const XMLCh* KFileProperty = (const XMLCh*)               "F\0i\0l\0e\0P\0r\0o\0p\0e\0r\0t\0y\0\0\0";
       
   103 const XMLCh* KFileProperty_Value = (const XMLCh*)         "F\0i\0l\0e\0P\0r\0o\0p\0e\0r\0t\0y\0_\0V\0a\0l\0u\0e\0\0\0";
       
   104 const XMLCh* KComponentDependency = (const XMLCh*)        "C\0o\0m\0p\0o\0n\0e\0n\0t\0D\0e\0p\0e\0n\0d\0e\0n\0c\0y\0\0\0"; 	
       
   105 const XMLCh* KDependencyList = (const XMLCh*)             "D\0e\0p\0e\0n\0d\0e\0n\0c\0y\0L\0i\0s\0t\0\0\0";
       
   106 const XMLCh* KRomApplication = (const XMLCh*)             "R\0o\0m\0A\0p\0p\0l\0i\0c\0a\0t\0i\0o\0n\0\0\0";
       
   107 const XMLCh* KApplicationRegistrationInfo = (const XMLCh*) "A\0p\0p\0l\0i\0c\0a\0t\0i\0o\0n\0R\0e\0g\0i\0s\0t\0r\0a\0t\0i\0o\0n\0I\0n\0f\0o\0\0\0";
       
   108 const XMLCh* KOpaqueData = (const XMLCh*) 				  "O\0p\0a\0q\0u\0e\0D\0a\0t\0a\0\0\0";
       
   109 const XMLCh* KData = (const XMLCh*)						  "D\0a\0t\0a\0\0\0";
       
   110 const XMLCh* KOpaqueLocale = (const XMLCh*)				  "O\0p\0a\0q\0u\0e\0L\0o\0c\0a\0l\0e\0\0\0";
       
   111 const XMLCh* KFileOwnershipinfo = (const XMLCh*)		  "F\0i\0l\0e\0O\0w\0n\0e\0r\0s\0h\0i\0p\0i\0n\0f\0o\0\0\0";
       
   112 const XMLCh* KFileName = (const XMLCh*) 				  "F\0i\0l\0e\0N\0a\0m\0e\0\0\0";
       
   113 const XMLCh* KApplicationLocalizableInfo = (const XMLCh*) "A\0p\0p\0l\0i\0c\0a\0t\0i\0o\0n\0L\0o\0c\0a\0l\0i\0z\0a\0b\0l\0e\0I\0n\0f\0o\0\0\0";
       
   114 const XMLCh* KLocalizableAttribute = (const XMLCh*)       "L\0o\0c\0a\0l\0i\0z\0a\0b\0l\0e\0A\0t\0t\0r\0i\0b\0u\0t\0e\0\0\0";
       
   115 const XMLCh* KLocalizableAttribute_Value = (const XMLCh*) "L\0o\0c\0a\0l\0i\0z\0a\0b\0l\0e\0A\0t\0t\0r\0i\0b\0u\0t\0e\0_\0V\0a\0l\0u\0e\0\0\0";
       
   116 const XMLCh* KLocalizableAttribute_IntValue = (const XMLCh*) "L\0o\0c\0a\0l\0i\0z\0a\0b\0l\0e\0A\0t\0t\0r\0i\0b\0u\0t\0e\0_\0I\0n\0t\0V\0a\0l\0u\0e\0\0\0";
       
   117 const XMLCh* KLocalizableAttribute_StrValue = (const XMLCh*) "L\0o\0c\0a\0l\0i\0z\0a\0b\0l\0e\0A\0t\0t\0r\0i\0b\0u\0t\0e\0_\0S\0t\0r\0V\0a\0l\0u\0e\0\0\0";
       
   118 const XMLCh* KViewData = (const XMLCh*) "V\0i\0e\0w\0D\0a\0t\0a\0\0\0";
       
   119 const XMLCh* KViewDataAttribute = (const XMLCh*) "V\0i\0e\0w\0D\0a\0t\0a\0A\0t\0t\0r\0i\0b\0u\0t\0e\0\0\0";
       
   120 const XMLCh* KApplicationDataType = (const XMLCh*) "A\0p\0p\0l\0i\0c\0a\0t\0i\0o\0n\0D\0a\0t\0a\0T\0y\0p\0e\0\0\0";
       
   121 const XMLCh* KPriority = (const XMLCh*) "P\0r\0i\0o\0r\0i\0t\0y\0\0\0";
       
   122 const XMLCh* KType = (const XMLCh*) "T\0y\0p\0e\0\0\0";
       
   123 const XMLCh* KViewData_Value = (const XMLCh*) "V\0i\0e\0w\0D\0a\0t\0a\0_\0V\0a\0l\0u\0e\0\0\0";
       
   124 const XMLCh* KViewData_IntValue = (const XMLCh*) "V\0i\0e\0w\0D\0a\0t\0a\0_\0I\0n\0t\0V\0a\0l\0u\0e\0\0\0";
       
   125 const XMLCh* KViewData_StrValue = (const XMLCh*) "V\0i\0e\0w\0D\0a\0t\0a\0_\0S\0t\0r\0V\0a\0l\0u\0e\0\0\0";
       
   126 const XMLCh* KApplicationServiceInfo = (const XMLCh*) "A\0p\0p\0l\0i\0c\0a\0t\0i\0o\0n\0S\0e\0r\0v\0i\0c\0e\0I\0n\0f\0o\0\0\0";
       
   127 const XMLCh* KUid = (const XMLCh*) "U\0i\0d\0\0\0";
       
   128 const XMLCh* KServiceOpaqueData = (const XMLCh*) "S\0e\0r\0v\0i\0c\0e\0O\0p\0a\0q\0u\0e\0D\0a\0t\0a\0\0\0";
       
   129 const XMLCh* KServiceData = (const XMLCh*) "S\0e\0r\0v\0i\0c\0e\0D\0a\0t\0a\0\0\0";
       
   130 const XMLCh* KServiceOpaqueLocale = (const XMLCh*) "S\0e\0r\0v\0i\0c\0e\0O\0p\0a\0q\0u\0e\0L\0o\0c\0a\0l\0e\0\0\0";
       
   131 const XMLCh* KApplicationProperty = (const XMLCh*) "A\0p\0p\0l\0i\0c\0a\0t\0i\0o\0n\0P\0r\0o\0p\0e\0r\0t\0y\0\0\0";
       
   132 const XMLCh* KLocale = (const XMLCh*) "L\0o\0c\0a\0l\0e\0\0\0";
       
   133 const XMLCh* KServiceUid = (const XMLCh*) "S\0e\0r\0v\0i\0c\0e\0U\0i\0d\0\0\0";
       
   134 const XMLCh* KIntValue = (const XMLCh*) "I\0n\0t\0V\0a\0l\0u\0e\0\0\0";
       
   135 const XMLCh* KStrValue = (const XMLCh*) "S\0t\0r\0V\0a\0l\0u\0e\0\0\0";
       
   136 const XMLCh* KIsStr8Bit = (const XMLCh*) "I\0s\0S\0t\0r\08\0B\0i\0t\0\0\0";
       
   137 const XMLCh* KApplicationAttribute = (const XMLCh*) "A\0p\0p\0l\0i\0c\0a\0t\0i\0o\0n\0A\0t\0t\0r\0i\0b\0u\0t\0e\0\0\0";
       
   138 const XMLCh* KApplicationAttribute_Value = (const XMLCh*) "A\0p\0p\0l\0i\0c\0a\0t\0i\0o\0n\0A\0t\0t\0r\0i\0b\0u\0t\0e\0_\0V\0a\0l\0u\0e\0\0\0";
       
   139 const XMLCh* KApplicationAttribute_IntValue = (const XMLCh*) "A\0p\0p\0l\0i\0c\0a\0t\0i\0o\0n\0A\0t\0t\0r\0i\0b\0u\0t\0e\0_\0I\0n\0t\0V\0a\0l\0u\0e\0\0\0";
       
   140 const XMLCh* KApplicationAttribute_StrValue = (const XMLCh*) "A\0p\0p\0l\0i\0c\0a\0t\0i\0o\0n\0A\0t\0t\0r\0i\0b\0u\0t\0e\0_\0S\0t\0r\0V\0a\0l\0u\0e\0\0\0";
       
   141 
       
   142 
       
   143 
       
   144 
       
   145 //-----------------------------------------------------------------------------------------
       
   146 
       
   147 //------------------------------------------------------------------------------------------------------------------------------
       
   148 //											UTILITY FUNCTIONS
       
   149 //------------------------------------------------------------------------------------------------------------------------------
       
   150 
       
   151 XercesString ConvertToXercesString(const char* aString, int aLength)
       
   152 	{
       
   153 	XMLCh* buffer = new UTF16[aLength + 1];
       
   154 	XMLCh* temp = buffer; // save as buffer gets modified..
       
   155 	ConvertUTF8toUTF16(&aString, aString + aLength, &temp, buffer + aLength, lenientConversion);
       
   156 	
       
   157 	// Appending NUL to the converted buffer.
       
   158 	*temp = 0;
       
   159 
       
   160 	XercesString result;
       
   161 
       
   162 	result.append(buffer);
       
   163 	delete[] buffer;
       
   164 
       
   165 	return result;
       
   166 	}
       
   167 
       
   168 XercesString IntegerToXercesString(int aValue)
       
   169 	{
       
   170 	std::stringstream str;
       
   171 	str << aValue;
       
   172 
       
   173 	return ConvertToXercesString(str.str().c_str(), str.str().length());
       
   174 	}
       
   175 
       
   176 
       
   177 XercesString Int64ToXercesString(TInt64 aInt)
       
   178 	{
       
   179 	char str[50];
       
   180 	
       
   181 	sprintf(str, "%I64u", aInt);
       
   182 
       
   183 	return ConvertToXercesString(str, strlen(str));
       
   184 	}
       
   185 	
       
   186 
       
   187 //------------------------------------------------------------------------------------------------------------------------------
    61 
   188 
    62 
   189 
    63 CXmlGenerator::CXmlGenerator()
   190 CXmlGenerator::CXmlGenerator()
    64 	{}
   191 	{}
    65 
   192 
    84 		SetWriterFeatures(domWriter.get());
   211 		SetWriterFeatures(domWriter.get());
    85 		
   212 		
    86 		std::auto_ptr < SchemaDomErrorHandler > errHandler(new SchemaDomErrorHandler());
   213 		std::auto_ptr < SchemaDomErrorHandler > errHandler(new SchemaDomErrorHandler());
    87 		domWriter->setErrorHandler(errHandler.get());
   214 		domWriter->setErrorHandler(errHandler.get());
    88 
   215 
       
   216 #ifdef _WIN32
       
   217 		// XMLString::trascode() function should be used for conversion.
    89 		std::auto_ptr < XMLFormatTarget > outputFile( new LocalFileFormatTarget( aXmlFileName.c_str() ) );	
   218 		std::auto_ptr < XMLFormatTarget > outputFile( new LocalFileFormatTarget( aXmlFileName.c_str() ) );	
    90 		
   219 #else
    91 		const char* epocRoot = getenv("EPOCROOT");
   220         std::string fileName = wstring2string(aXmlFileName);
       
   221 		std::auto_ptr < XMLFormatTarget > outputFile( new LocalFileFormatTarget( fileName.c_str() ) );
       
   222 #endif // _WIN32		
       
   223 		const char* epocRoot = getenv("EPOCROOT");		
    92 		if(NULL == epocRoot)
   224 		if(NULL == epocRoot)
    93 			{
   225 			{
    94 			throw std::runtime_error("EPOCROOT environment variable not specified.");
   226 			throw std::runtime_error("EPOCROOT environment variable not specified.");
    95 			}
   227 			}
    96 		
   228 		
    97 		std::string epocRootStr(epocRoot); 
   229 		std::string epocRootStr(epocRoot); 
    98 
   230 
    99 		std::string dtdFilePath = epocRootStr + "epoc32\\tools\\preprovision.dtd";
   231 		#ifdef __LINUX__ 
       
   232 		std::string dtdFilePath = epocRootStr + "epoc32/tools/preprovision.dtd";
       
   233 		#else 	  	  	 
       
   234 		std::string dtdFilePath = epocRootStr + "epoc32\\tools\\preprovision.dtd"; 	
       
   235 		#endif
   100 		
   236 		
   101 		fn_auto_ptr<releaseXmlChPtr, XMLCh> dtdPath( &XMLString::release, XMLString::transcode(dtdFilePath.c_str()) );
   237 		fn_auto_ptr<releaseXmlChPtr, XMLCh> dtdPath( &XMLString::release, XMLString::transcode(dtdFilePath.c_str()) );
   102 		DOMDocumentType* documentType = domImpl->createDocumentType(L"PreProvisionInformation",NULL, dtdPath.get());
   238 		DOMDocumentType* documentType = domImpl->createDocumentType(KPreProvisionInformation,NULL, dtdPath.get());
   103 		
   239 		
   104 		
   240 		
   105 		mem_fn_auto_ptr< releaseDOMDoc, DOMDocument* > domDocument( &XERCES_CPP_NAMESPACE::DOMDocument::release, domImpl->createDocument(	0, PreProvisionInformation.c_str(), documentType) );
   241 		mem_fn_auto_ptr< releaseDOMDoc, DOMDocument* > domDocument( &XERCES_CPP_NAMESPACE::DOMDocument::release, domImpl->createDocument(	0, KPreProvisionInformation, documentType) );
   106 
   242 
   107 		DOMElement* rootElement = domDocument->getDocumentElement();
   243 		DOMElement* rootElement = domDocument->getDocumentElement();
   108 		
   244 		
   109 		// SoftwareTypeName
   245 		// SoftwareTypeName
   110 		AddChildElement(rootElement, domDocument.get(), SoftwareTypeName.c_str(), aPreProvisionDetail.iSoftwareTypeName.c_str() );
   246 		AddChildElement(rootElement, domDocument.get(), KSoftwareTypeName, aPreProvisionDetail.SoftwareTypeName().c_str() );
   111 
   247 
   112 		std::vector<XmlDetails::TScrPreProvisionDetail::TComponent>::const_iterator compIter;
   248 		std::vector<XmlDetails::TScrPreProvisionDetail::TComponent>::const_iterator compIter;
   113 		for(compIter = aPreProvisionDetail.iComponents.begin(); compIter != aPreProvisionDetail.iComponents.end() ; ++compIter)
   249 		for(compIter = aPreProvisionDetail.iComponents.begin(); compIter != aPreProvisionDetail.iComponents.end() ; ++compIter)
   114 			{
   250 			{
   115 			DOMElement*  component = domDocument->createElement(L"Component");
   251 			DOMElement*  component = domDocument->createElement(KComponent);
   116 			rootElement->appendChild(component);
   252 			rootElement->appendChild(component);
   117 
   253 
   118 			WriteComponent(component,domDocument.get(), *compIter, aRomApplication);
   254 			WriteComponent(component,domDocument.get(), *compIter, aRomApplication);
   119 			}
   255 			}
   120 		
       
   121 		// do the serialization through DOMWriter::writeNode();
   256 		// do the serialization through DOMWriter::writeNode();
   122 		domWriter->writeNode(outputFile.get(), *domDocument.get());
   257 		domWriter->writeNode(outputFile.get(), *domDocument.get()); 	  			
   123 		
       
   124 		}
   258 		}
   125         catch (const XMLException& toCatch) 
   259         catch (const XMLException& toCatch) 
   126 			{
   260 			{
   127             char* message = XMLString::transcode(toCatch.getMessage());
   261             char* message = XMLString::transcode(toCatch.getMessage());
   128             XMLString::release(&message);
   262             XMLString::release(&message);
   142 	if (aDomWriter->canSetFeature(XMLUni::fgDOMWRTEntities, true))
   276 	if (aDomWriter->canSetFeature(XMLUni::fgDOMWRTEntities, true))
   143 		aDomWriter->setFeature(XMLUni::fgDOMWRTEntities, true);
   277 		aDomWriter->setFeature(XMLUni::fgDOMWRTEntities, true);
   144 
   278 
   145 	if (aDomWriter->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true))
   279 	if (aDomWriter->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true))
   146 		 aDomWriter->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
   280 		 aDomWriter->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
   147 	
   281 
   148 	if (aDomWriter->canSetFeature(XMLUni::fgDOMWRTNormalizeCharacters, false))
   282 	if (aDomWriter->canSetFeature(XMLUni::fgDOMWRTNormalizeCharacters, false))
   149 		aDomWriter->setFeature(XMLUni::fgDOMWRTNormalizeCharacters, false);
   283 		aDomWriter->setFeature(XMLUni::fgDOMWRTNormalizeCharacters, false);
   150 
   284 
   151 	if (aDomWriter->canSetFeature(XMLUni::fgDOMWRTSplitCdataSections, true))
   285 	if (aDomWriter->canSetFeature(XMLUni::fgDOMWRTSplitCdataSections, true))
   152 		 aDomWriter->setFeature(XMLUni::fgDOMWRTSplitCdataSections, true);
   286 		 aDomWriter->setFeature(XMLUni::fgDOMWRTSplitCdataSections, true);
   161 		aDomWriter->setFeature(XMLUni::fgDOMWRTBOM, true);
   295 		aDomWriter->setFeature(XMLUni::fgDOMWRTBOM, true);
   162 
   296 
   163 	if (aDomWriter->canSetFeature(XMLUni::fgDOMXMLDeclaration, true))
   297 	if (aDomWriter->canSetFeature(XMLUni::fgDOMXMLDeclaration, true))
   164 		 aDomWriter->setFeature(XMLUni::fgDOMXMLDeclaration, true);
   298 		 aDomWriter->setFeature(XMLUni::fgDOMXMLDeclaration, true);
   165 	
   299 	
   166 	aDomWriter->setEncoding(L"UTF-16");
   300 	aDomWriter->setEncoding(KUTF16);
   167 	}
   301 	}
   168 
   302 
   169 void CXmlGenerator::WriteComponent( DOMElement* aRootElement, DOMDocument* aDocument, 
   303 void CXmlGenerator::WriteComponent( DOMElement* aRootElement, DOMDocument* aDocument, 
   170 										const XmlDetails::TScrPreProvisionDetail::TComponent& aComponent, 
   304 										const XmlDetails::TScrPreProvisionDetail::TComponent& aComponent, 
   171 										int& aRomApplication
   305 										int& aRomApplication
   173 	{
   307 	{
   174 
   308 
   175 	if (aRomApplication) 
   309 	if (aRomApplication) 
   176 	{
   310 	{
   177 		int isRomApplication = 1;
   311 		int isRomApplication = 1;
   178 		std::wstring isRomApp = Utils::IntegerToWideString(isRomApplication);
   312 		XercesString isRomApp = IntegerToXercesString(isRomApplication);
   179 		AddChildElement(aRootElement, aDocument, L"RomApplication", isRomApp.c_str());
   313 		AddChildElement(aRootElement, aDocument, KRomApplication, isRomApp.c_str());
   180 	}
   314 	}
   181 	
   315 	
   182 	std::wstring isRemovable = Utils::IntegerToWideString(aComponent.iComponentDetails.iIsRemovable);
   316 	XercesString isRemovable = IntegerToXercesString(aComponent.iComponentDetails.iIsRemovable);
   183 	AddChildElement(aRootElement, aDocument, L"Removable", isRemovable.c_str() );
   317 	AddChildElement(aRootElement, aDocument, KRemovable, isRemovable.c_str() );
   184 	
   318 
   185 	std::wstring size = Utils::Int64ToWideString(aComponent.iComponentDetails.iSize);
   319 	
   186 	AddChildElement(aRootElement, aDocument, L"Size", size.c_str() );
   320 	XercesString size = Int64ToXercesString(aComponent.iComponentDetails.iSize);
   187 	
   321 	AddChildElement(aRootElement, aDocument, KSize, size.c_str() );
   188 	std::wstring scomoState = Utils::IntegerToWideString(aComponent.iComponentDetails.iScomoState);
   322 	
   189 	AddChildElement(aRootElement, aDocument, L"ScomoState", scomoState.c_str() );
   323 	XercesString scomoState = IntegerToXercesString(aComponent.iComponentDetails.iScomoState);
   190 
   324 	AddChildElement(aRootElement, aDocument, KScomoState, scomoState.c_str() );
   191 	AddChildElement(aRootElement, aDocument, L"GlobalId", aComponent.iComponentDetails.iGlobalId.c_str() );
   325 
       
   326 	AddChildElement(aRootElement, aDocument, KGlobalId, aComponent.iComponentDetails.GlobalId().c_str() );
   192 
   327 
   193 	WriteComponentVersion(aRootElement, aDocument, aComponent.iComponentDetails.iVersion);
   328 	WriteComponentVersion(aRootElement, aDocument, aComponent.iComponentDetails.iVersion);
   194 	
   329 	
   195 	std::wstring isOriginVerified = Utils::IntegerToWideString(aComponent.iComponentDetails.iOriginVerified);
   330 	XercesString isOriginVerified = Int64ToXercesString(aComponent.iComponentDetails.iOriginVerified);
   196 	AddChildElement(aRootElement, aDocument, L"OriginVerified", isOriginVerified.c_str() );
   331 	AddChildElement(aRootElement, aDocument, KOriginVerified, isOriginVerified.c_str() );
   197 
   332 
   198 	std::wstring isHidden = Utils::IntegerToWideString(aComponent.iComponentDetails.iIsHidden);
   333 	XercesString isHidden = IntegerToXercesString(aComponent.iComponentDetails.iIsHidden);
   199 	AddChildElement(aRootElement, aDocument, L"Hidden", isHidden.c_str() );
   334 	AddChildElement(aRootElement, aDocument, KHidden, isHidden.c_str() );
   200 
   335 
   201 	WriteComponentLocalizables(aRootElement, aDocument, aComponent.iComponentLocalizables);
   336 	WriteComponentLocalizables(aRootElement, aDocument, aComponent.iComponentLocalizables);
   202 
   337 
   203 	WriteComponentProperties(aRootElement, aDocument, aComponent.iComponentProperties);
   338 	WriteComponentProperties(aRootElement, aDocument, aComponent.iComponentProperties);
   204 
   339 
   215 				DOMElement* aRootElement, 
   350 				DOMElement* aRootElement, 
   216 				DOMDocument* aDocument, 
   351 				DOMDocument* aDocument, 
   217 				XmlDetails::TScrPreProvisionDetail::TComponentDetails::TVersion aVersion
   352 				XmlDetails::TScrPreProvisionDetail::TComponentDetails::TVersion aVersion
   218 				)
   353 				)
   219 	{
   354 	{
   220 	DOMElement*  version = aDocument->createElement(L"Version");
   355 	DOMElement*  version = aDocument->createElement(KVersion);
   221 	aRootElement->appendChild(version);
   356 	aRootElement->appendChild(version);
   222 	version->setAttribute( L"Major", aVersion.iMajor.c_str() );
   357 	version->setAttribute( KMajor, aVersion.MajorVersion().c_str() );
   223 	version->setAttribute( L"Minor", aVersion.iMinor.c_str() );
   358 	version->setAttribute( KMinor, aVersion.MinorVersion().c_str() );
   224 	version->setAttribute( L"Build", aVersion.iBuild.c_str() );
   359 	version->setAttribute( KBuild, aVersion.BuildVersion().c_str() );
   225 	}
   360 	}
   226 
   361 
   227 void CXmlGenerator::WriteComponentLocalizables
   362 void CXmlGenerator::WriteComponentLocalizables
   228 					(	
   363 					(	
   229 						DOMElement* aRootElement, DOMDocument* aDocument, 
   364 						DOMElement* aRootElement, DOMDocument* aDocument, 
   231 					)
   366 					)
   232 	{
   367 	{
   233 	std::vector<ComponentLocalizable>::const_iterator compLocIter;
   368 	std::vector<ComponentLocalizable>::const_iterator compLocIter;
   234 	for( compLocIter = aComponentLocalizable.begin() ; compLocIter != aComponentLocalizable.end() ; ++compLocIter)
   369 	for( compLocIter = aComponentLocalizable.begin() ; compLocIter != aComponentLocalizable.end() ; ++compLocIter)
   235 		{
   370 		{
   236 		DOMElement* newRoot = AddTag(aRootElement, aDocument, L"ComponentLocalizable");
   371 		DOMElement* newRoot = AddTag(aRootElement, aDocument, KComponentLocalizable);
   237 		std::wstring locale = Utils::IntegerToWideString(compLocIter->iLocale);
   372 		XercesString locale = IntegerToXercesString(compLocIter->iLocale);
   238 		AddChildElement(newRoot,aDocument, L"ComponentLocalizable_Locale", locale.c_str());
   373 
   239 		AddChildElement(newRoot,aDocument, L"ComponentLocalizable_Name", compLocIter->iName.c_str());
   374 
   240 		AddChildElement(newRoot,aDocument, L"ComponentLocalizable_Vendor", compLocIter->iVendor.c_str());
   375 		AddChildElement(newRoot,aDocument, KComponentLocalizable_Locale, locale.c_str());
       
   376 		AddChildElement(newRoot,aDocument, KComponentLocalizable_Name, compLocIter->Name().c_str());
       
   377 		AddChildElement(newRoot,aDocument, KComponentLocalizable_Vendor, compLocIter->Vendor().c_str());
   241 		}
   378 		}
   242 	}
   379 	}
   243 
   380 
   244 void CXmlGenerator::WriteComponentProperties	
   381 void CXmlGenerator::WriteComponentProperties	
   245 					( 
   382 					( 
   249 	{
   386 	{
   250 	std::vector<ComponentProperty>::const_iterator compPropIter;
   387 	std::vector<ComponentProperty>::const_iterator compPropIter;
   251 	for( compPropIter = aComponentProperties.begin() ; compPropIter != aComponentProperties.end() ; ++compPropIter)
   388 	for( compPropIter = aComponentProperties.begin() ; compPropIter != aComponentProperties.end() ; ++compPropIter)
   252 		{
   389 		{
   253 		
   390 		
   254 		DOMElement* compPropRoot = AddTag(aRootElement, aDocument, L"ComponentProperty");
   391 		DOMElement* compPropRoot = AddTag(aRootElement, aDocument, KComponentProperty);
   255 		
   392 		
   256 		std::wstring locale = Utils::IntegerToWideString(compPropIter->iLocale);
   393 		XercesString locale = IntegerToXercesString(compPropIter->iLocale);
   257 		AddChildElement(compPropRoot,aDocument, L"ComponentProperty_Locale", locale.c_str());
   394 		AddChildElement(compPropRoot,aDocument, KComponentProperty_Locale, locale.c_str());
   258 		
   395 		
   259 		DOMElement* compPropValueRoot = AddTag(compPropRoot, aDocument, L"ComponentProperty_Value");
   396 		DOMElement* compPropValueRoot = AddTag(compPropRoot, aDocument, KComponentProperty_Value);
   260 		
   397 		
   261 		std::wstring isBinary = Utils::IntegerToWideString(compPropIter->iIsStr8Bit);
   398 		XercesString isBinary = IntegerToXercesString(compPropIter->iIsStr8Bit);
   262 
   399 
   263 		if(compPropIter->iIsIntValue)
   400 		if(compPropIter->iIsIntValue)
   264 			{
   401 			{
   265 			AddChildElement(compPropValueRoot,aDocument, L"ComponentProperty_IntValue", compPropIter->iValue.c_str());
   402 			AddChildElement(compPropValueRoot,aDocument, KComponentProperty_IntValue, compPropIter->Value().c_str());
   266 			}
   403 			}
   267 		else
   404 		else
   268 			{
   405 			{
   269 			AddChildElement(compPropValueRoot,aDocument, L"ComponentProperty_StrValue", compPropIter->iValue.c_str());
   406 			AddChildElement(compPropValueRoot,aDocument, KComponentProperty_StrValue, compPropIter->Value().c_str());
   270 			}
   407 			}
   271 		
   408 		
   272 		
   409 		
   273 		AddChildElement(compPropRoot,aDocument, L"ComponentProperty_IsBinary", isBinary.c_str());
   410 		AddChildElement(compPropRoot,aDocument, KComponentProperty_IsBinary, isBinary.c_str());
   274 
   411 
   275 		compPropRoot->setAttribute(L"Name", compPropIter->iName.c_str());
   412 		compPropRoot->setAttribute(KName, compPropIter->Name().c_str());
   276 		
   413 		
   277 		}
   414 		}
   278 	}
   415 	}
   279 
   416 
   280 
   417 
   289 					)
   426 					)
   290 {
   427 {
   291 	std::vector<AppRegistrationInfo>::const_iterator compFileIter;
   428 	std::vector<AppRegistrationInfo>::const_iterator compFileIter;
   292 	for( compFileIter = aAppRegInfo.begin() ; compFileIter != aAppRegInfo.end() ; ++compFileIter)
   429 	for( compFileIter = aAppRegInfo.begin() ; compFileIter != aAppRegInfo.end() ; ++compFileIter)
   293 	{
   430 	{
   294 		DOMElement* compFileRoot = AddTag(aRootElement, aDocument, L"ApplicationRegistrationInfo");
   431 		DOMElement* compFileRoot = AddTag(aRootElement, aDocument, KApplicationRegistrationInfo);
   295 
   432 
   296 		WriteAppAttributes(compFileRoot, aDocument, compFileIter->iApplicationAttribute);
   433 		WriteAppAttributes(compFileRoot, aDocument, compFileIter->iApplicationAttribute);
   297 
   434 
   298 		const std::vector<AppOpaqueDataType>& aAppOpaqueDataType = compFileIter->iOpaqueDataType;
   435 		const std::vector<AppOpaqueDataType>& aAppOpaqueDataType = compFileIter->iOpaqueDataType;
   299 		std::vector<AppOpaqueDataType>::const_iterator fileAppOpaqueDataType;
   436 		std::vector<AppOpaqueDataType>::const_iterator fileAppOpaqueDataType;
   300 
   437 
   301 		for( fileAppOpaqueDataType = aAppOpaqueDataType.begin() ; fileAppOpaqueDataType != aAppOpaqueDataType.end() ; ++fileAppOpaqueDataType)
   438 		for( fileAppOpaqueDataType = aAppOpaqueDataType.begin() ; fileAppOpaqueDataType != aAppOpaqueDataType.end() ; ++fileAppOpaqueDataType)
   302 		{
   439 		{
   303 			if(0 == fileAppOpaqueDataType->iServiceUid)
   440 			if(0 == fileAppOpaqueDataType->iServiceUid)
   304 			{
   441 			{
   305 				DOMElement* filePropValueRoot = AddTag(compFileRoot, aDocument, L"OpaqueData");
   442 				DOMElement* filePropValueRoot = AddTag(compFileRoot, aDocument, KOpaqueData);
   306 				AddChildElement(filePropValueRoot,aDocument, L"Data", fileAppOpaqueDataType->iOpaqueData.c_str());
   443 				XercesString opaqueData = WStringToXercesString(fileAppOpaqueDataType->iOpaqueData);
   307 				std::wstring iLocale = Utils::IntegerToWideString(fileAppOpaqueDataType->iLocale);
   444 				AddChildElement(filePropValueRoot,aDocument, KData, opaqueData.c_str());
   308 				AddChildElement(filePropValueRoot,aDocument, L"OpaqueLocale", iLocale.c_str());
   445 				XercesString locale = IntegerToXercesString(fileAppOpaqueDataType->iLocale);
       
   446 				AddChildElement(filePropValueRoot,aDocument, KOpaqueLocale, locale.c_str());
   309 			}
   447 			}
   310 		}
   448 		}
   311 
   449 
   312 		for(vector<std::wstring>::iterator mimeiter = compFileIter->iFileOwnershipInfo.begin() ; mimeiter != compFileIter->iFileOwnershipInfo.end() ; ++mimeiter )
   450 		for(vector<std::wstring>::iterator mimeiter = compFileIter->iFileOwnershipInfo.begin() ; mimeiter != compFileIter->iFileOwnershipInfo.end() ; ++mimeiter )
   313 		{
   451 		{
   314 			DOMElement* filePropRoot = AddTag(compFileRoot, aDocument, L"FileOwnershipinfo");
   452 			DOMElement* filePropRoot = AddTag(compFileRoot, aDocument, KFileOwnershipinfo);
   315 
   453 
   316 			AddChildElement(filePropRoot,aDocument, L"FileName",  mimeiter->c_str());
   454 			XercesString temp = WStringToXercesString(*mimeiter);
       
   455 			AddChildElement(filePropRoot,aDocument, KFileName,  temp.c_str());
   317 		}
   456 		}
   318 
   457 
   319 		WriteAppServiceInfo(compFileRoot, aDocument, compFileIter->iApplicationServiceInfo, compFileIter->iOpaqueDataType);
   458 		WriteAppServiceInfo(compFileRoot, aDocument, compFileIter->iApplicationServiceInfo, compFileIter->iOpaqueDataType);
   320 		WriteAppLocalizableInfo(compFileRoot, aDocument, compFileIter->iApplicationLocalizableInfo);
   459 		WriteAppLocalizableInfo(compFileRoot, aDocument, compFileIter->iApplicationLocalizableInfo);
   321 	}
   460 	}
   332 					)
   471 					)
   333 {
   472 {
   334 	std::vector<AppLocalizableInfo>::const_iterator filePropIter;
   473 	std::vector<AppLocalizableInfo>::const_iterator filePropIter;
   335 	for( filePropIter = aAppLocalizableInfo.begin() ; filePropIter != aAppLocalizableInfo.end() ; ++filePropIter)
   474 	for( filePropIter = aAppLocalizableInfo.begin() ; filePropIter != aAppLocalizableInfo.end() ; ++filePropIter)
   336 	{
   475 	{
   337 		DOMElement* filePropRoot = AddTag(aRootElement, aDocument, L"ApplicationLocalizableInfo");
   476 		DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KApplicationLocalizableInfo);
   338 
   477 
   339 		WriteAppLocalizableAttribute(filePropRoot, aDocument, filePropIter->iLocalizableAttribute);
   478 		WriteAppLocalizableAttribute(filePropRoot, aDocument, filePropIter->iLocalizableAttribute);
   340 		WriteAppLocalizableViewData(filePropRoot, aDocument, filePropIter->iViewData);
   479 		WriteAppLocalizableViewData(filePropRoot, aDocument, filePropIter->iViewData);
   341 	}
   480 	}
   342 }
   481 }
   352 					)
   491 					)
   353 {
   492 {
   354 	std::vector<AppLocalizableAttribute>::const_iterator filePropIter;
   493 	std::vector<AppLocalizableAttribute>::const_iterator filePropIter;
   355 	for( filePropIter = aAppLocalizableAttribute.begin() ; filePropIter != aAppLocalizableAttribute.end() ; ++filePropIter)
   494 	for( filePropIter = aAppLocalizableAttribute.begin() ; filePropIter != aAppLocalizableAttribute.end() ; ++filePropIter)
   356 	{
   495 	{
   357 		DOMElement* filePropRoot = AddTag(aRootElement, aDocument, L"LocalizableAttribute");
   496 		DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KLocalizableAttribute);
   358 		DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, L"LocalizableAttribute_Value");
   497 		DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, KLocalizableAttribute_Value);
   359 
   498 
       
   499 		XercesString value = WStringToXercesString(filePropIter->iValue);
   360 		if(filePropIter->iIsIntValue)
   500 		if(filePropIter->iIsIntValue)
   361 		{
   501 		{
   362 			AddChildElement(filePropValueRoot, aDocument, L"LocalizableAttribute_IntValue", filePropIter->iValue.c_str());
   502 			AddChildElement(filePropValueRoot, aDocument, KLocalizableAttribute_IntValue, value.c_str());
   363 		}
   503 		}
   364 		else
   504 		else
   365 		{
   505 		{
   366 			AddChildElement(filePropValueRoot, aDocument, L"LocalizableAttribute_StrValue", filePropIter->iValue.c_str());
   506 			AddChildElement(filePropValueRoot, aDocument, KLocalizableAttribute_StrValue, value.c_str());
   367 		}
   507 		}
   368 		filePropRoot->setAttribute(L"Name", filePropIter->iName.c_str());
   508 		XercesString name = WStringToXercesString(filePropIter->iName);
       
   509 		filePropRoot->setAttribute(KName, name.c_str());
   369 	}
   510 	}
   370 }
   511 }
   371 
   512 
   372 /**
   513 /**
   373  * Writes Class TAppViewData Info in XML. 
   514  * Writes Class TAppViewData Info in XML. 
   380 					 )
   521 					 )
   381  {
   522  {
   382 	 std::vector<AppViewData>::const_iterator filePropIter;
   523 	 std::vector<AppViewData>::const_iterator filePropIter;
   383 	 for( filePropIter = aAppViewData.begin() ; filePropIter != aAppViewData.end() ; ++filePropIter)
   524 	 for( filePropIter = aAppViewData.begin() ; filePropIter != aAppViewData.end() ; ++filePropIter)
   384 	 {
   525 	 {
   385 		 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, L"ViewData");
   526 		 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KViewData);
   386 		 WriteAppLocalizableViewDataAttributes(filePropRoot, aDocument, filePropIter->iViewDataAttributes);
   527 		 WriteAppLocalizableViewDataAttributes(filePropRoot, aDocument, filePropIter->iViewDataAttributes);
   387 	 }
   528 	 }
   388  }
   529  }
   389 
   530 
   390  void CXmlGenerator::WriteAppLocalizableViewDataAttributes 
   531  void CXmlGenerator::WriteAppLocalizableViewDataAttributes 
   394 					 )
   535 					 )
   395  {
   536  {
   396 	 std::vector<AppViewDataAttributes>::const_iterator filePropIter;
   537 	 std::vector<AppViewDataAttributes>::const_iterator filePropIter;
   397 	 for( filePropIter = aAppViewDataAttributes.begin() ; filePropIter != aAppViewDataAttributes.end() ; ++filePropIter)
   538 	 for( filePropIter = aAppViewDataAttributes.begin() ; filePropIter != aAppViewDataAttributes.end() ; ++filePropIter)
   398 	 {
   539 	 {
   399 		 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, L"ViewDataAttribute");
   540 		 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KViewDataAttribute);
   400 		 DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, L"ViewData_Value");
   541 		 DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, KViewData_Value);
   401  
   542  
       
   543 		 XercesString value = WStringToXercesString(filePropIter->iValue);
   402 		 if(filePropIter->iIsIntValue)
   544 		 if(filePropIter->iIsIntValue)
   403 		 {
   545 		 {
   404 			 AddChildElement(filePropValueRoot, aDocument, L"ViewData_IntValue", filePropIter->iValue.c_str());
   546 			 AddChildElement(filePropValueRoot, aDocument, KViewData_IntValue, value.c_str());
       
   547 
   405 		 }
   548 		 }
   406 		 else
   549 		 else
   407 		 {
   550 		 {
   408 			 AddChildElement(filePropValueRoot, aDocument, L"ViewData_StrValue", filePropIter->iValue.c_str());
   551 			 AddChildElement(filePropValueRoot, aDocument, KViewData_StrValue, value.c_str());
       
   552 
   409 		 }
   553 		 }
   410 		 filePropRoot->setAttribute(L"Name", filePropIter->iName.c_str());
   554 
       
   555 		 XercesString name = WStringToXercesString(filePropIter->iName);
       
   556 		 filePropRoot->setAttribute(KName, name.c_str());
   411 	 }
   557 	 }
   412  }
   558  }
   413 
   559 
   414 /**
   560 /**
   415  * Writes Class TAppServiceInfo Info in XML. 
   561  * Writes Class TAppServiceInfo Info in XML. 
   424 {
   570 {
   425 	std::vector<AppServiceInfo>::const_iterator filePropIter;
   571 	std::vector<AppServiceInfo>::const_iterator filePropIter;
   426 	std::vector<AppOpaqueDataType>::const_iterator fileAppPropIter;
   572 	std::vector<AppOpaqueDataType>::const_iterator fileAppPropIter;
   427 	for( filePropIter = aAppServiceInfo.begin() ; filePropIter != aAppServiceInfo.end() ; ++filePropIter)
   573 	for( filePropIter = aAppServiceInfo.begin() ; filePropIter != aAppServiceInfo.end() ; ++filePropIter)
   428 	{
   574 	{
   429 		DOMElement* filePropRoot = AddTag(aRootElement, aDocument, L"ApplicationServiceInfo");
   575 		DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KApplicationServiceInfo);
   430 	
   576 	
   431 		std::wstring iUid = Utils::IntegerToWideString(filePropIter->iUid);
   577 		XercesString uid = IntegerToXercesString(filePropIter->iUid);
   432 		AddChildElement(filePropRoot,aDocument, L"Uid", iUid.c_str());
   578 		AddChildElement(filePropRoot,aDocument, KUid, uid.c_str());
       
   579 
   433 
   580 
   434 		for( fileAppPropIter = aAppOpaqueData.begin() ; fileAppPropIter != aAppOpaqueData.end() ; ++fileAppPropIter)
   581 		for( fileAppPropIter = aAppOpaqueData.begin() ; fileAppPropIter != aAppOpaqueData.end() ; ++fileAppPropIter)
   435 		{
   582 		{
   436 			if(filePropIter->iUid == fileAppPropIter->iServiceUid)
   583 			if(filePropIter->iUid == fileAppPropIter->iServiceUid)
   437 			{
   584 			{
   438 				if(!fileAppPropIter->iOpaqueData.empty())
   585 				if(!fileAppPropIter->iOpaqueData.empty())
   439 				{
   586 				{
   440 					DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, L"ServiceOpaqueData");
   587 					DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, KServiceOpaqueData);
   441 					AddChildElement(filePropValueRoot,aDocument, L"ServiceData", fileAppPropIter->iOpaqueData.c_str());
   588 
   442 					std::wstring iLocale = Utils::IntegerToWideString(fileAppPropIter->iLocale);
   589 					XercesString opaqueData = WStringToXercesString(fileAppPropIter->iOpaqueData);
   443 					AddChildElement(filePropValueRoot,aDocument, L"ServiceOpaqueLocale", iLocale.c_str());
   590 					AddChildElement(filePropValueRoot,aDocument, KServiceData, opaqueData.c_str());
       
   591 
       
   592 					XercesString locale = IntegerToXercesString(fileAppPropIter->iLocale);
       
   593 					AddChildElement(filePropValueRoot,aDocument, KServiceOpaqueLocale, locale.c_str());
   444 				}
   594 				}
   445 			}
   595 			}
   446 		}
   596 		}
   447 
   597 
   448 		WriteAppDataType(filePropRoot, aDocument, filePropIter->iDataType);
   598 		WriteAppDataType(filePropRoot, aDocument, filePropIter->iDataType);
   460 					)
   610 					)
   461 {
   611 {
   462 	std::vector<AppDataType>::const_iterator filePropIter;
   612 	std::vector<AppDataType>::const_iterator filePropIter;
   463 	for( filePropIter = aAppDataType.begin() ; filePropIter != aAppDataType.end() ; ++filePropIter)
   613 	for( filePropIter = aAppDataType.begin() ; filePropIter != aAppDataType.end() ; ++filePropIter)
   464 	{
   614 	{
   465 		DOMElement* filePropRoot = AddTag(aRootElement, aDocument, L"ApplicationDataType");
   615 		DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KApplicationDataType);
   466 
   616 
   467 		std::wstring iPriority = Utils::IntegerToWideString(filePropIter->iPriority);
   617 		XercesString priority = IntegerToXercesString(filePropIter->iPriority);
   468 		AddChildElement(filePropRoot,aDocument, L"Priority", iPriority.c_str());
   618 		AddChildElement(filePropRoot,aDocument, KPriority, priority.c_str());
   469 		AddChildElement(filePropRoot, aDocument, L"Type", filePropIter->iType.c_str());
   619 
       
   620 		XercesString type = WStringToXercesString(filePropIter->iType);
       
   621 		AddChildElement(filePropRoot, aDocument, KType, type.c_str());
   470 	}
   622 	}
   471 }
   623 }
   472 
   624 
   473 /**
   625 /**
   474  * Writes Class TApplicationAttribute Info in XML. 
   626  * Writes Class TApplicationAttribute Info in XML. 
   481 					)
   633 					)
   482 {
   634 {
   483 	std::vector<ApplicationAttribute>::const_iterator filePropIter;
   635 	std::vector<ApplicationAttribute>::const_iterator filePropIter;
   484 	for( filePropIter = aAppAttributes.begin() ; filePropIter != aAppAttributes.end() ; ++filePropIter)
   636 	for( filePropIter = aAppAttributes.begin() ; filePropIter != aAppAttributes.end() ; ++filePropIter)
   485 	{
   637 	{
   486 		DOMElement* filePropRoot = AddTag(aRootElement, aDocument, L"ApplicationAttribute");
   638 		DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KApplicationAttribute);
   487 		DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, L"ApplicationAttribute_Value");
   639 
   488 
   640 		DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, KApplicationAttribute_Value);
       
   641 
       
   642 		XercesString value = WStringToXercesString(filePropIter->iValue);
   489 		if(filePropIter->iIsIntValue)
   643 		if(filePropIter->iIsIntValue)
   490 		{
   644 		{
   491 			AddChildElement(filePropValueRoot, aDocument, L"ApplicationAttribute_IntValue", filePropIter->iValue.c_str());
   645 			AddChildElement(filePropValueRoot, aDocument, KApplicationAttribute_IntValue, value.c_str());
   492 		}
   646 		}
   493 		else
   647 		else
   494 		{
   648 		{
   495 			AddChildElement(filePropValueRoot, aDocument, L"ApplicationAttribute_StrValue", filePropIter->iValue.c_str());
   649 			AddChildElement(filePropValueRoot, aDocument, KApplicationAttribute_StrValue, value.c_str());
   496 		}
   650 		}
   497 		filePropRoot->setAttribute(L"Name", filePropIter->iName.c_str());
   651 
       
   652 		XercesString name = WStringToXercesString(filePropIter->iName);
       
   653 		filePropRoot->setAttribute(KName, name.c_str());
   498 	}
   654 	}
   499 }
   655 }
   500 
   656 
   501 /**
   657 /**
   502  * Writes Class TApplicationProperty Info in XML. 
   658  * Writes Class TApplicationProperty Info in XML. 
   508 					)
   664 					)
   509 {
   665 {
   510 	std::vector<AppProperty>::const_iterator filePropIter;
   666 	std::vector<AppProperty>::const_iterator filePropIter;
   511 	for( filePropIter = aAppProperty.begin() ; filePropIter != aAppProperty.end() ; ++filePropIter)
   667 	for( filePropIter = aAppProperty.begin() ; filePropIter != aAppProperty.end() ; ++filePropIter)
   512 	{
   668 	{
   513 		DOMElement* filePropRoot = AddTag(aRootElement, aDocument, L"ApplicationProperty");
   669 		DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KApplicationProperty);
   514 
   670 
   515 
   671 		XercesString locale = IntegerToXercesString(filePropIter->iLocale);
   516 		std::wstring iLocale = Utils::IntegerToWideString(filePropIter->iLocale);
   672 		AddChildElement(filePropRoot,aDocument, KLocale, locale.c_str());
   517 		AddChildElement(filePropRoot,aDocument, L"Locale", iLocale.c_str());
   673 
   518 
   674 		XercesString name = WStringToXercesString(filePropIter->iName);
   519 		AddChildElement(filePropRoot,aDocument, L"Name", filePropIter->iName.c_str());
   675 		AddChildElement(filePropRoot,aDocument, KName, name.c_str());
   520 
   676 
   521 		std::wstring iServiceUid = Utils::IntegerToWideString(filePropIter->iServiceUid);
   677 		XercesString serviceUid = IntegerToXercesString(filePropIter->iServiceUid);
   522 		AddChildElement(filePropRoot,aDocument, L"ServiceUid", iServiceUid.c_str());
   678 		AddChildElement(filePropRoot,aDocument, KServiceUid, serviceUid.c_str());
   523 
   679 
   524 		std::wstring iIntValue = Utils::IntegerToWideString(filePropIter->iIntValue);
   680 		XercesString intValue = IntegerToXercesString(filePropIter->iIntValue);
   525 		AddChildElement(filePropRoot,aDocument, L"IntValue", iIntValue.c_str());
   681 		AddChildElement(filePropRoot,aDocument, KIntValue, intValue.c_str());
   526 
   682 
   527 		AddChildElement(filePropRoot, aDocument, L"StrValue", filePropIter->iStrValue.c_str());
   683 		XercesString strValue = WStringToXercesString(filePropIter->iStrValue);
   528 
   684 		AddChildElement(filePropRoot, aDocument, KStrValue, strValue.c_str());
   529 		std::wstring iIsStr8Bit = Utils::IntegerToWideString(filePropIter->iIsStr8Bit);
   685 
   530 		AddChildElement(filePropRoot,aDocument, L"IsStr8Bit", iIsStr8Bit.c_str());
   686 		XercesString isStr8Bit = IntegerToXercesString(filePropIter->iIsStr8Bit);
   531 
   687 		AddChildElement(filePropRoot,aDocument, KIsStr8Bit, isStr8Bit.c_str());
   532 	}
   688 	}
   533 }
   689 }
   534 
   690 
   535 void CXmlGenerator::WriteComponentFiles	
   691 void CXmlGenerator::WriteComponentFiles	
   536 					( 
   692 					( 
   539 					)
   695 					)
   540 	{
   696 	{
   541 	std::vector<ComponentFile>::const_iterator compFileIter;
   697 	std::vector<ComponentFile>::const_iterator compFileIter;
   542 	for( compFileIter = aComponentFiles.begin() ; compFileIter != aComponentFiles.end() ; ++compFileIter)
   698 	for( compFileIter = aComponentFiles.begin() ; compFileIter != aComponentFiles.end() ; ++compFileIter)
   543 		{
   699 		{
   544 		DOMElement* compFileRoot = AddTag(aRootElement, aDocument, L"ComponentFile");
   700 		DOMElement* compFileRoot = AddTag(aRootElement, aDocument, KComponentFile);
   545 
   701 
   546 		WriteFileProperties(compFileRoot, aDocument, compFileIter->iFileProperties);
   702 		WriteFileProperties(compFileRoot, aDocument, compFileIter->iFileProperties);
   547 		
   703 		
   548 		compFileRoot->setAttribute(L"Location", compFileIter->iLocation.c_str());
   704 		compFileRoot->setAttribute(KLocation, compFileIter->Location().c_str());
   549 		}
   705 		}
   550 	}
   706 	}
   551 
   707 
   552 void CXmlGenerator::WriteFileProperties	
   708 void CXmlGenerator::WriteFileProperties	
   553 					( 
   709 					( 
   556 					)
   712 					)
   557 	{
   713 	{
   558 	std::vector<FileProperty>::const_iterator filePropIter;
   714 	std::vector<FileProperty>::const_iterator filePropIter;
   559 	for( filePropIter = aFileProperties.begin() ; filePropIter != aFileProperties.end() ; ++filePropIter)
   715 	for( filePropIter = aFileProperties.begin() ; filePropIter != aFileProperties.end() ; ++filePropIter)
   560 		{
   716 		{
   561 		DOMElement* filePropRoot = AddTag(aRootElement, aDocument, L"FileProperty");
   717 		DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KFileProperty);
   562 		DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, L"FileProperty_Value");
   718 		DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, KFileProperty_Value);
   563 
   719 
   564 		if(filePropIter->iIsIntValue)
   720 		if(filePropIter->iIsIntValue)
   565 			{
   721 			{
   566 			AddChildElement(filePropValueRoot, aDocument, L"FileProperty_IntValue", filePropIter->iValue.c_str());
   722 			AddChildElement(filePropValueRoot, aDocument, KFileProperty_IntValue, filePropIter->Value().c_str());
   567 			}
   723 			}
   568 		else
   724 		else
   569 			{
   725 			{
   570 			AddChildElement(filePropValueRoot, aDocument, L"FileProperty_StrValue", filePropIter->iValue.c_str());
   726 			AddChildElement(filePropValueRoot, aDocument, KFileProperty_StrValue, filePropIter->Value().c_str());
   571 			}
   727 			}
   572 		filePropRoot->setAttribute(L"Name", filePropIter->iName.c_str());
   728 		filePropRoot->setAttribute(KName, filePropIter->Name().c_str());
   573 		}
   729 		}
   574 	}
   730 	}
   575 
   731 
   576 
   732 
   577 void CXmlGenerator::WriteComponentDependencies	
   733 void CXmlGenerator::WriteComponentDependencies	
   585 		return;
   741 		return;
   586 
   742 
   587 	std::vector<ComponentDependencyDetail> componentDependencyList = aComponentDependency.iComponentDependencyList;
   743 	std::vector<ComponentDependencyDetail> componentDependencyList = aComponentDependency.iComponentDependencyList;
   588 	std::vector<ComponentDependencyDetail>::const_iterator compDepIter;
   744 	std::vector<ComponentDependencyDetail>::const_iterator compDepIter;
   589 
   745 
   590 	DOMElement* compDepRoot = AddTag(aRootElement, aDocument, L"ComponentDependency");
   746 	DOMElement* compDepRoot = AddTag(aRootElement, aDocument, KComponentDependency);
   591 
   747 
   592 	for( compDepIter = componentDependencyList.begin() ; compDepIter != componentDependencyList.end() ; ++compDepIter)
   748 	for( compDepIter = componentDependencyList.begin() ; compDepIter != componentDependencyList.end() ; ++compDepIter)
   593 		{
   749 		{
   594 		DOMElement* compDepListRoot = AddTag( compDepRoot, aDocument, L"DependencyList" );
   750 		DOMElement* compDepListRoot = AddTag( compDepRoot, aDocument, KDependencyList );
   595 		AddChildElement( compDepListRoot, aDocument, L"SupplierId", compDepIter->iSupplierId.c_str() );
   751 		AddChildElement( compDepListRoot, aDocument, KSupplierId, compDepIter->SupplierId().c_str() );
   596 		AddChildElement( compDepListRoot, aDocument, L"FromVersion", compDepIter->iFromVersion.c_str() );
   752 		AddChildElement( compDepListRoot, aDocument, KFromVersion, compDepIter->FromVersion().c_str() );
   597 		AddChildElement( compDepListRoot, aDocument, L"ToVersion", compDepIter->iToVersion.c_str() );
   753 		AddChildElement( compDepListRoot, aDocument, KToVersion, compDepIter->ToVersion().c_str() );
   598 		}
   754 		}
   599 	compDepRoot->setAttribute(L"DependentId", aComponentDependency.iDependentId.c_str());
   755 	compDepRoot->setAttribute(KDependentId, aComponentDependency.DependentId().c_str());
   600 	}
   756 	}
   601 
   757 
   602 
   758 
   603 void CXmlGenerator::AddChildElement( DOMElement* aRootElement, DOMDocument* aDocument, const wchar_t* aElementName, const wchar_t* aTextValue )
   759 void CXmlGenerator::AddChildElement( DOMElement* aRootElement, DOMDocument* aDocument, const XMLCh* aElementName, const XMLCh* aTextValue )
   604 	{
   760 	{
   605 	DOMElement*  element = aDocument->createElement(aElementName);
   761 	DOMElement*  element = aDocument->createElement(aElementName);
   606 	aRootElement->appendChild(element);
   762 	aRootElement->appendChild(element);
   607 
   763 
   608 	DOMText* textValue = aDocument->createTextNode(aTextValue);
   764 	DOMText* textValue = aDocument->createTextNode(aTextValue);
   609 	element->appendChild(textValue);
   765 	element->appendChild(textValue);
   610 	}
   766 	}
   611 
   767 
   612 DOMElement* CXmlGenerator::AddTag( DOMElement* aRootElement, DOMDocument* aDocument, const wchar_t* aTagName)
   768 DOMElement* CXmlGenerator::AddTag( DOMElement* aRootElement, DOMDocument* aDocument, const XMLCh* aTagName)
   613 	{
   769 	{
   614 	DOMElement*  tagName = aDocument->createElement(aTagName);
   770 	DOMElement*  tagName = aDocument->createElement(aTagName);
   615 	aRootElement->appendChild(tagName);
   771 	aRootElement->appendChild(tagName);
   616 
   772 
   617 	return tagName;
   773 	return tagName;
   621 /**
   777 /**
   622  * Handles all warnings received while xml parsing. 
   778  * Handles all warnings received while xml parsing. 
   623  */
   779  */
   624 bool SchemaDomErrorHandler::handleError(const DOMError& domError)
   780 bool SchemaDomErrorHandler::handleError(const DOMError& domError)
   625 	{
   781 	{
   626 	const XMLCh* message = domError.getMessage();
   782 	const XMLCh* message = domError.getMessage();	
   627 	return false;
   783 	return false;
   628 	}
   784 	}
       
   785 
       
   786