53 typedef void (XERCES_CPP_NAMESPACE::DOMDocument::*releaseDOMDoc) (); |
56 typedef void (XERCES_CPP_NAMESPACE::DOMDocument::*releaseDOMDoc) (); |
54 typedef void (XERCES_CPP_NAMESPACE::DOMWriter::*releaseDOMWriter) (); |
57 typedef void (XERCES_CPP_NAMESPACE::DOMWriter::*releaseDOMWriter) (); |
55 typedef void (*xmlPlatform) (); |
58 typedef void (*xmlPlatform) (); |
56 typedef void (*releaseXmlChPtr) (XMLCh** buf); |
59 typedef void (*releaseXmlChPtr) (XMLCh** buf); |
57 |
60 |
58 // constants used for writing to the xml file |
61 |
59 std::wstring PreProvisionInformation(L"PreProvisionInformation"); |
62 //------------------------------------- Literals ------------------------------------------ |
60 std::wstring SoftwareTypeName(L"SoftwareTypeName"); |
63 // Xerces literals are of type XMLCh*. For gcc XMLCh is defined as unsigned short (UCS16). |
|
64 // In windows wchar_t has the same size as XMLCh therefor literals defined as L"This is a |
|
65 // literal" will work. But in linux size of wchar_t is 4 (UCS32) bytes and hence L cannot |
|
66 // be used for defining literals. To avoid string conversion and dynamic memory allocation |
|
67 // following method is used to represent unsigned short literal. Current compiler has the |
|
68 // limitation to represent such literals. |
|
69 //----------------------------------------------------------------------------------------- |
|
70 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"; |
|
71 const XMLCh* KSoftwareTypeName = (const XMLCh*) "S\0o\0f\0t\0w\0a\0r\0e\0T\0y\0p\0e\0N\0a\0m\0e\0\0\0"; |
|
72 const XMLCh* KUTF16 = (const XMLCh*) "U\0T\0F\0-\0001\0006\0\0\0"; |
|
73 const XMLCh* KComponent = (const XMLCh*) "C\0o\0m\0p\0o\0n\0e\0n\0t\0\0\0"; |
|
74 const XMLCh* KDependentId = (const XMLCh*) "D\0e\0p\0e\0n\0d\0e\0n\0t\0I\0d\0\0\0"; |
|
75 const XMLCh* KToVersion = (const XMLCh*) "T\0o\0V\0e\0r\0s\0i\0o\0n\0\0\0"; |
|
76 const XMLCh* KFromVersion = (const XMLCh*) "F\0r\0o\0m\0V\0e\0r\0s\0i\0o\0n\0\0\0"; |
|
77 const XMLCh* KSupplierId = (const XMLCh*) "S\0u\0p\0p\0l\0i\0e\0r\0I\0d\0\0\0"; |
|
78 const XMLCh* KName = (const XMLCh*) "N\0a\0m\0e\0\0\0"; |
|
79 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"; |
|
80 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"; |
|
81 const XMLCh* KLocation = (const XMLCh*) "L\0o\0c\0a\0t\0i\0o\0n\0\0\0"; |
|
82 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"; |
|
83 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"; |
|
84 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"; |
|
85 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"; |
|
86 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"; |
|
87 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"; |
|
88 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"; |
|
89 const XMLCh* KBuild = (const XMLCh*) "B\0u\0i\0l\0d\0\0\0"; |
|
90 const XMLCh* KMinor = (const XMLCh*) "M\0i\0n\0o\0r\0\0\0"; |
|
91 const XMLCh* KMajor = (const XMLCh*) "M\0a\0j\0o\0r\0\0\0"; |
|
92 const XMLCh* KVersion = (const XMLCh*) "V\0e\0r\0s\0i\0o\0n\0\0\0"; |
|
93 const XMLCh* KHidden = (const XMLCh*) "H\0i\0d\0d\0e\0n\0\0\0"; |
|
94 const XMLCh* KOriginVerified = (const XMLCh*) "O\0r\0i\0g\0i\0n\0V\0e\0r\0i\0f\0i\0e\0d\0\0\0"; |
|
95 const XMLCh* KGlobalId = (const XMLCh*) "G\0l\0o\0b\0a\0l\0I\0d\0\0\0"; |
|
96 const XMLCh* KScomoState = (const XMLCh*) "S\0c\0o\0m\0o\0S\0t\0a\0t\0e\0\0\0"; |
|
97 const XMLCh* KSize = (const XMLCh*) "S\0i\0z\0e\0\0\0"; |
|
98 const XMLCh* KRemovable = (const XMLCh*) "R\0e\0m\0o\0v\0a\0b\0l\0e\0\0\0"; |
|
99 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"; |
|
100 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"; |
|
101 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"; |
|
102 const XMLCh* KComponentFile = (const XMLCh*) "C\0o\0m\0p\0o\0n\0e\0n\0t\0F\0i\0l\0e\0\0\0"; |
|
103 const XMLCh* KFileProperty = (const XMLCh*) "F\0i\0l\0e\0P\0r\0o\0p\0e\0r\0t\0y\0\0\0"; |
|
104 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"; |
|
105 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"; |
|
106 const XMLCh* KDependencyList = (const XMLCh*) "D\0e\0p\0e\0n\0d\0e\0n\0c\0y\0L\0i\0s\0t\0\0\0"; |
|
107 const XMLCh* KRomApplication = (const XMLCh*) "R\0o\0m\0A\0p\0p\0l\0i\0c\0a\0t\0i\0o\0n\0\0\0"; |
|
108 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"; |
|
109 const XMLCh* KOpaqueData = (const XMLCh*) "O\0p\0a\0q\0u\0e\0D\0a\0t\0a\0\0\0"; |
|
110 const XMLCh* KData = (const XMLCh*) "D\0a\0t\0a\0\0\0"; |
|
111 const XMLCh* KOpaqueLocale = (const XMLCh*) "O\0p\0a\0q\0u\0e\0L\0o\0c\0a\0l\0e\0\0\0"; |
|
112 const XMLCh* KIsBinary = (const XMLCh*) "I\0s\0B\0i\0n\0a\0r\0y\0\0\0"; |
|
113 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"; |
|
114 const XMLCh* KFileName = (const XMLCh*) "F\0i\0l\0e\0N\0a\0m\0e\0\0\0"; |
|
115 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"; |
|
116 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"; |
|
117 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"; |
|
118 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"; |
|
119 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"; |
|
120 const XMLCh* KViewData = (const XMLCh*) "V\0i\0e\0w\0D\0a\0t\0a\0\0\0"; |
|
121 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"; |
|
122 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"; |
|
123 const XMLCh* KPriority = (const XMLCh*) "P\0r\0i\0o\0r\0i\0t\0y\0\0\0"; |
|
124 const XMLCh* KType = (const XMLCh*) "T\0y\0p\0e\0\0\0"; |
|
125 const XMLCh* KViewData_Value = (const XMLCh*) "V\0i\0e\0w\0D\0a\0t\0a\0_\0V\0a\0l\0u\0e\0\0\0"; |
|
126 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"; |
|
127 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"; |
|
128 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"; |
|
129 const XMLCh* KUid = (const XMLCh*) "U\0i\0d\0\0\0"; |
|
130 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"; |
|
131 const XMLCh* KServiceData = (const XMLCh*) "S\0e\0r\0v\0i\0c\0e\0D\0a\0t\0a\0\0\0"; |
|
132 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"; |
|
133 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"; |
|
134 const XMLCh* KLocale = (const XMLCh*) "L\0o\0c\0a\0l\0e\0\0\0"; |
|
135 const XMLCh* KServiceUid = (const XMLCh*) "S\0e\0r\0v\0i\0c\0e\0U\0i\0d\0\0\0"; |
|
136 const XMLCh* KIntValue = (const XMLCh*) "I\0n\0t\0V\0a\0l\0u\0e\0\0\0"; |
|
137 const XMLCh* KStrValue = (const XMLCh*) "S\0t\0r\0V\0a\0l\0u\0e\0\0\0"; |
|
138 const XMLCh* KIsStr8Bit = (const XMLCh*) "I\0s\0S\0t\0r\08\0B\0i\0t\0\0\0"; |
|
139 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"; |
|
140 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"; |
|
141 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"; |
|
142 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"; |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 //----------------------------------------------------------------------------------------- |
|
148 |
|
149 //------------------------------------------------------------------------------------------------------------------------------ |
|
150 // UTILITY FUNCTIONS |
|
151 //------------------------------------------------------------------------------------------------------------------------------ |
|
152 |
|
153 XercesString ConvertToXercesString(const char* aString, int aLength) |
|
154 { |
|
155 XMLCh* buffer = new UTF16[aLength + 1]; |
|
156 XMLCh* temp = buffer; // save as buffer gets modified.. |
|
157 ConvertUTF8toUTF16(&aString, aString + aLength, &temp, buffer + aLength, lenientConversion); |
|
158 |
|
159 // Appending NUL to the converted buffer. |
|
160 *temp = 0; |
|
161 |
|
162 XercesString result; |
|
163 |
|
164 result.append(buffer); |
|
165 delete[] buffer; |
|
166 |
|
167 return result; |
|
168 } |
|
169 |
|
170 XercesString IntegerToXercesString(int aValue) |
|
171 { |
|
172 std::stringstream str; |
|
173 str << aValue; |
|
174 |
|
175 return ConvertToXercesString(str.str().c_str(), str.str().length()); |
|
176 } |
|
177 |
|
178 |
|
179 XercesString Int64ToXercesString(TInt64 aInt) |
|
180 { |
|
181 char str[50]; |
|
182 |
|
183 sprintf(str, "%I64u", aInt); |
|
184 |
|
185 return ConvertToXercesString(str, strlen(str)); |
|
186 } |
|
187 |
|
188 |
|
189 //------------------------------------------------------------------------------------------------------------------------------ |
61 |
190 |
62 |
191 |
63 CXmlGenerator::CXmlGenerator() |
192 CXmlGenerator::CXmlGenerator() |
64 {} |
193 {} |
65 |
194 |
84 SetWriterFeatures(domWriter.get()); |
213 SetWriterFeatures(domWriter.get()); |
85 |
214 |
86 std::auto_ptr < SchemaDomErrorHandler > errHandler(new SchemaDomErrorHandler()); |
215 std::auto_ptr < SchemaDomErrorHandler > errHandler(new SchemaDomErrorHandler()); |
87 domWriter->setErrorHandler(errHandler.get()); |
216 domWriter->setErrorHandler(errHandler.get()); |
88 |
217 |
|
218 #ifdef _WIN32 |
|
219 // XMLString::trascode() function should be used for conversion. |
89 std::auto_ptr < XMLFormatTarget > outputFile( new LocalFileFormatTarget( aXmlFileName.c_str() ) ); |
220 std::auto_ptr < XMLFormatTarget > outputFile( new LocalFileFormatTarget( aXmlFileName.c_str() ) ); |
90 |
221 #else |
91 const char* epocRoot = getenv("EPOCROOT"); |
222 std::string fileName = wstring2string(aXmlFileName); |
|
223 std::auto_ptr < XMLFormatTarget > outputFile( new LocalFileFormatTarget( fileName.c_str() ) ); |
|
224 #endif // _WIN32 |
|
225 const char* epocRoot = getenv("EPOCROOT"); |
92 if(NULL == epocRoot) |
226 if(NULL == epocRoot) |
93 { |
227 { |
94 throw std::runtime_error("EPOCROOT environment variable not specified."); |
228 throw std::runtime_error("EPOCROOT environment variable not specified."); |
95 } |
229 } |
96 |
230 |
97 std::string epocRootStr(epocRoot); |
231 std::string epocRootStr(epocRoot); |
98 |
232 |
99 std::string dtdFilePath = epocRootStr + "epoc32\\tools\\preprovision.dtd"; |
233 #ifdef __LINUX__ |
|
234 std::string dtdFilePath = epocRootStr + "epoc32/tools/preprovision.dtd"; |
|
235 #else |
|
236 std::string dtdFilePath = epocRootStr + "epoc32\\tools\\preprovision.dtd"; |
|
237 #endif |
100 |
238 |
101 fn_auto_ptr<releaseXmlChPtr, XMLCh> dtdPath( &XMLString::release, XMLString::transcode(dtdFilePath.c_str()) ); |
239 fn_auto_ptr<releaseXmlChPtr, XMLCh> dtdPath( &XMLString::release, XMLString::transcode(dtdFilePath.c_str()) ); |
102 DOMDocumentType* documentType = domImpl->createDocumentType(L"PreProvisionInformation",NULL, dtdPath.get()); |
240 DOMDocumentType* documentType = domImpl->createDocumentType(KPreProvisionInformation,NULL, dtdPath.get()); |
103 |
241 |
104 |
242 |
105 mem_fn_auto_ptr< releaseDOMDoc, DOMDocument* > domDocument( &XERCES_CPP_NAMESPACE::DOMDocument::release, domImpl->createDocument( 0, PreProvisionInformation.c_str(), documentType) ); |
243 mem_fn_auto_ptr< releaseDOMDoc, DOMDocument* > domDocument( &XERCES_CPP_NAMESPACE::DOMDocument::release, domImpl->createDocument( 0, KPreProvisionInformation, documentType) ); |
106 |
244 |
107 DOMElement* rootElement = domDocument->getDocumentElement(); |
245 DOMElement* rootElement = domDocument->getDocumentElement(); |
108 |
246 |
109 // SoftwareTypeName |
247 // SoftwareTypeName |
110 AddChildElement(rootElement, domDocument.get(), SoftwareTypeName.c_str(), aPreProvisionDetail.iSoftwareTypeName.c_str() ); |
248 AddChildElement(rootElement, domDocument.get(), KSoftwareTypeName, aPreProvisionDetail.SoftwareTypeName().c_str() ); |
111 |
249 |
112 std::vector<XmlDetails::TScrPreProvisionDetail::TComponent>::const_iterator compIter; |
250 std::vector<XmlDetails::TScrPreProvisionDetail::TComponent>::const_iterator compIter; |
113 for(compIter = aPreProvisionDetail.iComponents.begin(); compIter != aPreProvisionDetail.iComponents.end() ; ++compIter) |
251 for(compIter = aPreProvisionDetail.iComponents.begin(); compIter != aPreProvisionDetail.iComponents.end() ; ++compIter) |
114 { |
252 { |
115 DOMElement* component = domDocument->createElement(L"Component"); |
253 DOMElement* component = domDocument->createElement(KComponent); |
116 rootElement->appendChild(component); |
254 rootElement->appendChild(component); |
117 |
255 |
118 WriteComponent(component,domDocument.get(), *compIter, aRomApplication); |
256 WriteComponent(component,domDocument.get(), *compIter, aRomApplication); |
119 } |
257 } |
120 |
|
121 // do the serialization through DOMWriter::writeNode(); |
258 // do the serialization through DOMWriter::writeNode(); |
122 domWriter->writeNode(outputFile.get(), *domDocument.get()); |
259 domWriter->writeNode(outputFile.get(), *domDocument.get()); |
123 |
|
124 } |
260 } |
125 catch (const XMLException& toCatch) |
261 catch (const XMLException& toCatch) |
126 { |
262 { |
127 char* message = XMLString::transcode(toCatch.getMessage()); |
263 char* message = XMLString::transcode(toCatch.getMessage()); |
128 XMLString::release(&message); |
264 XMLString::release(&message); |
173 { |
309 { |
174 |
310 |
175 if (aRomApplication) |
311 if (aRomApplication) |
176 { |
312 { |
177 int isRomApplication = 1; |
313 int isRomApplication = 1; |
178 std::wstring isRomApp = Utils::IntegerToWideString(isRomApplication); |
314 XercesString isRomApp = IntegerToXercesString(isRomApplication); |
179 AddChildElement(aRootElement, aDocument, L"RomApplication", isRomApp.c_str()); |
315 AddChildElement(aRootElement, aDocument, KRomApplication, isRomApp.c_str()); |
180 } |
316 } |
181 |
317 |
182 std::wstring isRemovable = Utils::IntegerToWideString(aComponent.iComponentDetails.iIsRemovable); |
318 XercesString isRemovable = IntegerToXercesString(aComponent.iComponentDetails.iIsRemovable); |
183 AddChildElement(aRootElement, aDocument, L"Removable", isRemovable.c_str() ); |
319 AddChildElement(aRootElement, aDocument, KRemovable, isRemovable.c_str() ); |
184 |
320 |
185 std::wstring size = Utils::Int64ToWideString(aComponent.iComponentDetails.iSize); |
321 |
186 AddChildElement(aRootElement, aDocument, L"Size", size.c_str() ); |
322 XercesString size = Int64ToXercesString(aComponent.iComponentDetails.iSize); |
187 |
323 AddChildElement(aRootElement, aDocument, KSize, size.c_str() ); |
188 std::wstring scomoState = Utils::IntegerToWideString(aComponent.iComponentDetails.iScomoState); |
324 |
189 AddChildElement(aRootElement, aDocument, L"ScomoState", scomoState.c_str() ); |
325 XercesString scomoState = IntegerToXercesString(aComponent.iComponentDetails.iScomoState); |
190 |
326 AddChildElement(aRootElement, aDocument, KScomoState, scomoState.c_str() ); |
191 AddChildElement(aRootElement, aDocument, L"GlobalId", aComponent.iComponentDetails.iGlobalId.c_str() ); |
327 |
|
328 AddChildElement(aRootElement, aDocument, KGlobalId, aComponent.iComponentDetails.GlobalId().c_str() ); |
192 |
329 |
193 WriteComponentVersion(aRootElement, aDocument, aComponent.iComponentDetails.iVersion); |
330 WriteComponentVersion(aRootElement, aDocument, aComponent.iComponentDetails.iVersion); |
194 |
331 |
195 std::wstring isOriginVerified = Utils::IntegerToWideString(aComponent.iComponentDetails.iOriginVerified); |
332 XercesString isOriginVerified = Int64ToXercesString(aComponent.iComponentDetails.iOriginVerified); |
196 AddChildElement(aRootElement, aDocument, L"OriginVerified", isOriginVerified.c_str() ); |
333 AddChildElement(aRootElement, aDocument, KOriginVerified, isOriginVerified.c_str() ); |
197 |
334 |
198 std::wstring isHidden = Utils::IntegerToWideString(aComponent.iComponentDetails.iIsHidden); |
335 XercesString isHidden = IntegerToXercesString(aComponent.iComponentDetails.iIsHidden); |
199 AddChildElement(aRootElement, aDocument, L"Hidden", isHidden.c_str() ); |
336 AddChildElement(aRootElement, aDocument, KHidden, isHidden.c_str() ); |
200 |
337 |
201 WriteComponentLocalizables(aRootElement, aDocument, aComponent.iComponentLocalizables); |
338 WriteComponentLocalizables(aRootElement, aDocument, aComponent.iComponentLocalizables); |
202 |
339 |
203 WriteComponentProperties(aRootElement, aDocument, aComponent.iComponentProperties); |
340 WriteComponentProperties(aRootElement, aDocument, aComponent.iComponentProperties); |
204 |
341 |
249 { |
388 { |
250 std::vector<ComponentProperty>::const_iterator compPropIter; |
389 std::vector<ComponentProperty>::const_iterator compPropIter; |
251 for( compPropIter = aComponentProperties.begin() ; compPropIter != aComponentProperties.end() ; ++compPropIter) |
390 for( compPropIter = aComponentProperties.begin() ; compPropIter != aComponentProperties.end() ; ++compPropIter) |
252 { |
391 { |
253 |
392 |
254 DOMElement* compPropRoot = AddTag(aRootElement, aDocument, L"ComponentProperty"); |
393 DOMElement* compPropRoot = AddTag(aRootElement, aDocument, KComponentProperty); |
255 |
394 |
256 std::wstring locale = Utils::IntegerToWideString(compPropIter->iLocale); |
395 XercesString locale = IntegerToXercesString(compPropIter->iLocale); |
257 AddChildElement(compPropRoot,aDocument, L"ComponentProperty_Locale", locale.c_str()); |
396 AddChildElement(compPropRoot,aDocument, KComponentProperty_Locale, locale.c_str()); |
258 |
397 |
259 DOMElement* compPropValueRoot = AddTag(compPropRoot, aDocument, L"ComponentProperty_Value"); |
398 DOMElement* compPropValueRoot = AddTag(compPropRoot, aDocument, KComponentProperty_Value); |
260 |
399 |
261 std::wstring isBinary = Utils::IntegerToWideString(compPropIter->iIsStr8Bit); |
400 XercesString isBinary = IntegerToXercesString(compPropIter->iIsStr8Bit); |
262 |
401 |
263 if(compPropIter->iIsIntValue) |
402 if(compPropIter->iIsIntValue) |
264 { |
403 { |
265 AddChildElement(compPropValueRoot,aDocument, L"ComponentProperty_IntValue", compPropIter->iValue.c_str()); |
404 AddChildElement(compPropValueRoot,aDocument, KComponentProperty_IntValue, compPropIter->Value().c_str()); |
266 } |
405 } |
267 else |
406 else |
268 { |
407 { |
269 AddChildElement(compPropValueRoot,aDocument, L"ComponentProperty_StrValue", compPropIter->iValue.c_str()); |
408 AddChildElement(compPropValueRoot,aDocument, KComponentProperty_StrValue, compPropIter->Value().c_str()); |
270 } |
409 } |
271 |
410 |
272 |
411 |
273 AddChildElement(compPropRoot,aDocument, L"ComponentProperty_IsBinary", isBinary.c_str()); |
412 AddChildElement(compPropRoot,aDocument, KComponentProperty_IsBinary, isBinary.c_str()); |
274 |
413 |
275 compPropRoot->setAttribute(L"Name", compPropIter->iName.c_str()); |
414 compPropRoot->setAttribute(KName, compPropIter->Name().c_str()); |
276 |
415 |
277 } |
416 } |
278 } |
417 } |
279 |
418 |
280 |
419 |
289 ) |
428 ) |
290 { |
429 { |
291 std::vector<AppRegistrationInfo>::const_iterator compFileIter; |
430 std::vector<AppRegistrationInfo>::const_iterator compFileIter; |
292 for( compFileIter = aAppRegInfo.begin() ; compFileIter != aAppRegInfo.end() ; ++compFileIter) |
431 for( compFileIter = aAppRegInfo.begin() ; compFileIter != aAppRegInfo.end() ; ++compFileIter) |
293 { |
432 { |
294 DOMElement* compFileRoot = AddTag(aRootElement, aDocument, L"ApplicationRegistrationInfo"); |
433 DOMElement* compFileRoot = AddTag(aRootElement, aDocument, KApplicationRegistrationInfo); |
295 |
434 |
296 WriteAppAttributes(compFileRoot, aDocument, compFileIter->iApplicationAttribute); |
435 WriteAppAttributes(compFileRoot, aDocument, compFileIter->iApplicationAttribute); |
297 |
436 |
298 const std::vector<AppOpaqueDataType>& aAppOpaqueDataType = compFileIter->iOpaqueDataType; |
437 const std::vector<AppOpaqueDataType>& aAppOpaqueDataType = compFileIter->iOpaqueDataType; |
299 std::vector<AppOpaqueDataType>::const_iterator fileAppOpaqueDataType; |
438 std::vector<AppOpaqueDataType>::const_iterator fileAppOpaqueDataType; |
300 |
439 |
301 for( fileAppOpaqueDataType = aAppOpaqueDataType.begin() ; fileAppOpaqueDataType != aAppOpaqueDataType.end() ; ++fileAppOpaqueDataType) |
440 for( fileAppOpaqueDataType = aAppOpaqueDataType.begin() ; fileAppOpaqueDataType != aAppOpaqueDataType.end() ; ++fileAppOpaqueDataType) |
302 { |
441 { |
303 if(0 == fileAppOpaqueDataType->iServiceUid) |
442 if(0 == fileAppOpaqueDataType->iServiceUid) |
304 { |
443 { |
305 DOMElement* filePropValueRoot = AddTag(compFileRoot, aDocument, L"OpaqueData"); |
444 DOMElement* filePropValueRoot = AddTag(compFileRoot, aDocument, KOpaqueData); |
306 AddChildElement(filePropValueRoot,aDocument, L"Data", fileAppOpaqueDataType->iOpaqueData.c_str()); |
445 |
307 std::wstring iLocale = Utils::IntegerToWideString(fileAppOpaqueDataType->iLocale); |
446 if(fileAppOpaqueDataType->iIsBinary) |
308 AddChildElement(filePropValueRoot,aDocument, L"OpaqueLocale", iLocale.c_str()); |
447 { |
|
448 std::string temp = wstring2string(fileAppOpaqueDataType->iOpaqueData); |
|
449 std::string binStrData = Util::Base64Encode(temp); |
|
450 std::wstring binData = string2wstring(binStrData); |
|
451 AddChildElement(filePropValueRoot,aDocument, KData, binData.c_str()); |
|
452 } |
|
453 else |
|
454 { |
|
455 AddChildElement(filePropValueRoot,aDocument, KData, fileAppOpaqueDataType->iOpaqueData.c_str()); |
|
456 } |
|
457 |
|
458 XercesString locale = IntegerToXercesString(fileAppOpaqueDataType->iLocale); |
|
459 AddChildElement(filePropValueRoot,aDocument, KOpaqueLocale, locale.c_str()); |
|
460 |
|
461 XercesString iBinary = IntegerToXercesString(fileAppOpaqueDataType->iIsBinary); |
|
462 AddChildElement(filePropValueRoot,aDocument, KIsBinary, iBinary.c_str()); |
|
463 |
309 } |
464 } |
310 } |
465 } |
311 |
466 |
312 for(vector<std::wstring>::iterator mimeiter = compFileIter->iFileOwnershipInfo.begin() ; mimeiter != compFileIter->iFileOwnershipInfo.end() ; ++mimeiter ) |
467 for(vector<std::wstring>::iterator mimeiter = compFileIter->iFileOwnershipInfo.begin() ; mimeiter != compFileIter->iFileOwnershipInfo.end() ; ++mimeiter ) |
313 { |
468 { |
314 DOMElement* filePropRoot = AddTag(compFileRoot, aDocument, L"FileOwnershipinfo"); |
469 DOMElement* filePropRoot = AddTag(compFileRoot, aDocument, KFileOwnershipinfo); |
315 |
470 |
316 AddChildElement(filePropRoot,aDocument, L"FileName", mimeiter->c_str()); |
471 XercesString temp = WStringToXercesString(*mimeiter); |
|
472 AddChildElement(filePropRoot,aDocument, KFileName, temp.c_str()); |
317 } |
473 } |
318 |
474 |
319 WriteAppServiceInfo(compFileRoot, aDocument, compFileIter->iApplicationServiceInfo, compFileIter->iOpaqueDataType); |
475 WriteAppServiceInfo(compFileRoot, aDocument, compFileIter->iApplicationServiceInfo, compFileIter->iOpaqueDataType); |
320 WriteAppLocalizableInfo(compFileRoot, aDocument, compFileIter->iApplicationLocalizableInfo); |
476 WriteAppLocalizableInfo(compFileRoot, aDocument, compFileIter->iApplicationLocalizableInfo); |
321 } |
477 } |
352 ) |
508 ) |
353 { |
509 { |
354 std::vector<AppLocalizableAttribute>::const_iterator filePropIter; |
510 std::vector<AppLocalizableAttribute>::const_iterator filePropIter; |
355 for( filePropIter = aAppLocalizableAttribute.begin() ; filePropIter != aAppLocalizableAttribute.end() ; ++filePropIter) |
511 for( filePropIter = aAppLocalizableAttribute.begin() ; filePropIter != aAppLocalizableAttribute.end() ; ++filePropIter) |
356 { |
512 { |
357 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, L"LocalizableAttribute"); |
513 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KLocalizableAttribute); |
358 DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, L"LocalizableAttribute_Value"); |
514 DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, KLocalizableAttribute_Value); |
359 |
515 |
|
516 XercesString value = WStringToXercesString(filePropIter->iValue); |
360 if(filePropIter->iIsIntValue) |
517 if(filePropIter->iIsIntValue) |
361 { |
518 { |
362 AddChildElement(filePropValueRoot, aDocument, L"LocalizableAttribute_IntValue", filePropIter->iValue.c_str()); |
519 AddChildElement(filePropValueRoot, aDocument, KLocalizableAttribute_IntValue, value.c_str()); |
363 } |
520 } |
364 else |
521 else |
365 { |
522 { |
366 AddChildElement(filePropValueRoot, aDocument, L"LocalizableAttribute_StrValue", filePropIter->iValue.c_str()); |
523 AddChildElement(filePropValueRoot, aDocument, KLocalizableAttribute_StrValue, value.c_str()); |
367 } |
524 } |
368 filePropRoot->setAttribute(L"Name", filePropIter->iName.c_str()); |
525 XercesString name = WStringToXercesString(filePropIter->iName); |
|
526 filePropRoot->setAttribute(KName, name.c_str()); |
369 } |
527 } |
370 } |
528 } |
371 |
529 |
372 /** |
530 /** |
373 * Writes Class TAppViewData Info in XML. |
531 * Writes Class TAppViewData Info in XML. |
394 ) |
552 ) |
395 { |
553 { |
396 std::vector<AppViewDataAttributes>::const_iterator filePropIter; |
554 std::vector<AppViewDataAttributes>::const_iterator filePropIter; |
397 for( filePropIter = aAppViewDataAttributes.begin() ; filePropIter != aAppViewDataAttributes.end() ; ++filePropIter) |
555 for( filePropIter = aAppViewDataAttributes.begin() ; filePropIter != aAppViewDataAttributes.end() ; ++filePropIter) |
398 { |
556 { |
399 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, L"ViewDataAttribute"); |
557 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KViewDataAttribute); |
400 DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, L"ViewData_Value"); |
558 DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, KViewData_Value); |
401 |
559 |
|
560 XercesString value = WStringToXercesString(filePropIter->iValue); |
402 if(filePropIter->iIsIntValue) |
561 if(filePropIter->iIsIntValue) |
403 { |
562 { |
404 AddChildElement(filePropValueRoot, aDocument, L"ViewData_IntValue", filePropIter->iValue.c_str()); |
563 AddChildElement(filePropValueRoot, aDocument, KViewData_IntValue, value.c_str()); |
|
564 |
405 } |
565 } |
406 else |
566 else |
407 { |
567 { |
408 AddChildElement(filePropValueRoot, aDocument, L"ViewData_StrValue", filePropIter->iValue.c_str()); |
568 AddChildElement(filePropValueRoot, aDocument, KViewData_StrValue, value.c_str()); |
|
569 |
409 } |
570 } |
410 filePropRoot->setAttribute(L"Name", filePropIter->iName.c_str()); |
571 |
|
572 XercesString name = WStringToXercesString(filePropIter->iName); |
|
573 filePropRoot->setAttribute(KName, name.c_str()); |
411 } |
574 } |
412 } |
575 } |
413 |
576 |
414 /** |
577 /** |
415 * Writes Class TAppServiceInfo Info in XML. |
578 * Writes Class TAppServiceInfo Info in XML. |
424 { |
587 { |
425 std::vector<AppServiceInfo>::const_iterator filePropIter; |
588 std::vector<AppServiceInfo>::const_iterator filePropIter; |
426 std::vector<AppOpaqueDataType>::const_iterator fileAppPropIter; |
589 std::vector<AppOpaqueDataType>::const_iterator fileAppPropIter; |
427 for( filePropIter = aAppServiceInfo.begin() ; filePropIter != aAppServiceInfo.end() ; ++filePropIter) |
590 for( filePropIter = aAppServiceInfo.begin() ; filePropIter != aAppServiceInfo.end() ; ++filePropIter) |
428 { |
591 { |
429 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, L"ApplicationServiceInfo"); |
592 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KApplicationServiceInfo); |
430 |
593 |
431 std::wstring iUid = Utils::IntegerToWideString(filePropIter->iUid); |
594 XercesString uid = IntegerToXercesString(filePropIter->iUid); |
432 AddChildElement(filePropRoot,aDocument, L"Uid", iUid.c_str()); |
595 AddChildElement(filePropRoot,aDocument, KUid, uid.c_str()); |
|
596 |
433 |
597 |
434 for( fileAppPropIter = aAppOpaqueData.begin() ; fileAppPropIter != aAppOpaqueData.end() ; ++fileAppPropIter) |
598 for( fileAppPropIter = aAppOpaqueData.begin() ; fileAppPropIter != aAppOpaqueData.end() ; ++fileAppPropIter) |
435 { |
599 { |
436 if(filePropIter->iUid == fileAppPropIter->iServiceUid) |
600 if(filePropIter->iUid == fileAppPropIter->iServiceUid) |
437 { |
601 { |
438 if(!fileAppPropIter->iOpaqueData.empty()) |
602 if(!fileAppPropIter->iOpaqueData.empty()) |
439 { |
603 { |
440 DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, L"ServiceOpaqueData"); |
604 DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, KServiceOpaqueData); |
441 AddChildElement(filePropValueRoot,aDocument, L"ServiceData", fileAppPropIter->iOpaqueData.c_str()); |
605 |
442 std::wstring iLocale = Utils::IntegerToWideString(fileAppPropIter->iLocale); |
606 XercesString opaqueData = WStringToXercesString(fileAppPropIter->iOpaqueData); |
443 AddChildElement(filePropValueRoot,aDocument, L"ServiceOpaqueLocale", iLocale.c_str()); |
607 AddChildElement(filePropValueRoot,aDocument, KServiceData, opaqueData.c_str()); |
|
608 |
|
609 XercesString locale = IntegerToXercesString(fileAppPropIter->iLocale); |
|
610 AddChildElement(filePropValueRoot,aDocument, KServiceOpaqueLocale, locale.c_str()); |
444 } |
611 } |
445 } |
612 } |
446 } |
613 } |
447 |
614 |
448 WriteAppDataType(filePropRoot, aDocument, filePropIter->iDataType); |
615 WriteAppDataType(filePropRoot, aDocument, filePropIter->iDataType); |
481 ) |
650 ) |
482 { |
651 { |
483 std::vector<ApplicationAttribute>::const_iterator filePropIter; |
652 std::vector<ApplicationAttribute>::const_iterator filePropIter; |
484 for( filePropIter = aAppAttributes.begin() ; filePropIter != aAppAttributes.end() ; ++filePropIter) |
653 for( filePropIter = aAppAttributes.begin() ; filePropIter != aAppAttributes.end() ; ++filePropIter) |
485 { |
654 { |
486 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, L"ApplicationAttribute"); |
655 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KApplicationAttribute); |
487 DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, L"ApplicationAttribute_Value"); |
656 |
488 |
657 DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, KApplicationAttribute_Value); |
|
658 |
|
659 XercesString value = WStringToXercesString(filePropIter->iValue); |
489 if(filePropIter->iIsIntValue) |
660 if(filePropIter->iIsIntValue) |
490 { |
661 { |
491 AddChildElement(filePropValueRoot, aDocument, L"ApplicationAttribute_IntValue", filePropIter->iValue.c_str()); |
662 AddChildElement(filePropValueRoot, aDocument, KApplicationAttribute_IntValue, value.c_str()); |
492 } |
663 } |
493 else |
664 else |
494 { |
665 { |
495 AddChildElement(filePropValueRoot, aDocument, L"ApplicationAttribute_StrValue", filePropIter->iValue.c_str()); |
666 AddChildElement(filePropValueRoot, aDocument, KApplicationAttribute_StrValue, value.c_str()); |
496 } |
667 } |
497 filePropRoot->setAttribute(L"Name", filePropIter->iName.c_str()); |
668 |
|
669 XercesString name = WStringToXercesString(filePropIter->iName); |
|
670 filePropRoot->setAttribute(KName, name.c_str()); |
498 } |
671 } |
499 } |
672 } |
500 |
673 |
501 /** |
674 /** |
502 * Writes Class TApplicationProperty Info in XML. |
675 * Writes Class TApplicationProperty Info in XML. |
508 ) |
681 ) |
509 { |
682 { |
510 std::vector<AppProperty>::const_iterator filePropIter; |
683 std::vector<AppProperty>::const_iterator filePropIter; |
511 for( filePropIter = aAppProperty.begin() ; filePropIter != aAppProperty.end() ; ++filePropIter) |
684 for( filePropIter = aAppProperty.begin() ; filePropIter != aAppProperty.end() ; ++filePropIter) |
512 { |
685 { |
513 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, L"ApplicationProperty"); |
686 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KApplicationProperty); |
514 |
687 |
515 |
688 XercesString locale = IntegerToXercesString(filePropIter->iLocale); |
516 std::wstring iLocale = Utils::IntegerToWideString(filePropIter->iLocale); |
689 AddChildElement(filePropRoot,aDocument, KLocale, locale.c_str()); |
517 AddChildElement(filePropRoot,aDocument, L"Locale", iLocale.c_str()); |
690 |
518 |
691 XercesString name = WStringToXercesString(filePropIter->iName); |
519 AddChildElement(filePropRoot,aDocument, L"Name", filePropIter->iName.c_str()); |
692 AddChildElement(filePropRoot,aDocument, KName, name.c_str()); |
520 |
693 |
521 std::wstring iServiceUid = Utils::IntegerToWideString(filePropIter->iServiceUid); |
694 XercesString serviceUid = IntegerToXercesString(filePropIter->iServiceUid); |
522 AddChildElement(filePropRoot,aDocument, L"ServiceUid", iServiceUid.c_str()); |
695 AddChildElement(filePropRoot,aDocument, KServiceUid, serviceUid.c_str()); |
523 |
696 |
524 std::wstring iIntValue = Utils::IntegerToWideString(filePropIter->iIntValue); |
697 XercesString intValue = IntegerToXercesString(filePropIter->iIntValue); |
525 AddChildElement(filePropRoot,aDocument, L"IntValue", iIntValue.c_str()); |
698 AddChildElement(filePropRoot,aDocument, KIntValue, intValue.c_str()); |
526 |
699 |
527 AddChildElement(filePropRoot, aDocument, L"StrValue", filePropIter->iStrValue.c_str()); |
700 XercesString strValue = WStringToXercesString(filePropIter->iStrValue); |
528 |
701 AddChildElement(filePropRoot, aDocument, KStrValue, strValue.c_str()); |
529 std::wstring iIsStr8Bit = Utils::IntegerToWideString(filePropIter->iIsStr8Bit); |
702 |
530 AddChildElement(filePropRoot,aDocument, L"IsStr8Bit", iIsStr8Bit.c_str()); |
703 XercesString isStr8Bit = IntegerToXercesString(filePropIter->iIsStr8Bit); |
531 |
704 AddChildElement(filePropRoot,aDocument, KIsStr8Bit, isStr8Bit.c_str()); |
532 } |
705 } |
533 } |
706 } |
534 |
707 |
535 void CXmlGenerator::WriteComponentFiles |
708 void CXmlGenerator::WriteComponentFiles |
536 ( |
709 ( |
556 ) |
729 ) |
557 { |
730 { |
558 std::vector<FileProperty>::const_iterator filePropIter; |
731 std::vector<FileProperty>::const_iterator filePropIter; |
559 for( filePropIter = aFileProperties.begin() ; filePropIter != aFileProperties.end() ; ++filePropIter) |
732 for( filePropIter = aFileProperties.begin() ; filePropIter != aFileProperties.end() ; ++filePropIter) |
560 { |
733 { |
561 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, L"FileProperty"); |
734 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KFileProperty); |
562 DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, L"FileProperty_Value"); |
735 DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, KFileProperty_Value); |
563 |
736 |
564 if(filePropIter->iIsIntValue) |
737 if(filePropIter->iIsIntValue) |
565 { |
738 { |
566 AddChildElement(filePropValueRoot, aDocument, L"FileProperty_IntValue", filePropIter->iValue.c_str()); |
739 AddChildElement(filePropValueRoot, aDocument, KFileProperty_IntValue, filePropIter->Value().c_str()); |
567 } |
740 } |
568 else |
741 else |
569 { |
742 { |
570 AddChildElement(filePropValueRoot, aDocument, L"FileProperty_StrValue", filePropIter->iValue.c_str()); |
743 AddChildElement(filePropValueRoot, aDocument, KFileProperty_StrValue, filePropIter->Value().c_str()); |
571 } |
744 } |
572 filePropRoot->setAttribute(L"Name", filePropIter->iName.c_str()); |
745 filePropRoot->setAttribute(KName, filePropIter->Name().c_str()); |
573 } |
746 } |
574 } |
747 } |
575 |
748 |
576 |
749 |
577 void CXmlGenerator::WriteComponentDependencies |
750 void CXmlGenerator::WriteComponentDependencies |
585 return; |
758 return; |
586 |
759 |
587 std::vector<ComponentDependencyDetail> componentDependencyList = aComponentDependency.iComponentDependencyList; |
760 std::vector<ComponentDependencyDetail> componentDependencyList = aComponentDependency.iComponentDependencyList; |
588 std::vector<ComponentDependencyDetail>::const_iterator compDepIter; |
761 std::vector<ComponentDependencyDetail>::const_iterator compDepIter; |
589 |
762 |
590 DOMElement* compDepRoot = AddTag(aRootElement, aDocument, L"ComponentDependency"); |
763 DOMElement* compDepRoot = AddTag(aRootElement, aDocument, KComponentDependency); |
591 |
764 |
592 for( compDepIter = componentDependencyList.begin() ; compDepIter != componentDependencyList.end() ; ++compDepIter) |
765 for( compDepIter = componentDependencyList.begin() ; compDepIter != componentDependencyList.end() ; ++compDepIter) |
593 { |
766 { |
594 DOMElement* compDepListRoot = AddTag( compDepRoot, aDocument, L"DependencyList" ); |
767 DOMElement* compDepListRoot = AddTag( compDepRoot, aDocument, KDependencyList ); |
595 AddChildElement( compDepListRoot, aDocument, L"SupplierId", compDepIter->iSupplierId.c_str() ); |
768 AddChildElement( compDepListRoot, aDocument, KSupplierId, compDepIter->SupplierId().c_str() ); |
596 AddChildElement( compDepListRoot, aDocument, L"FromVersion", compDepIter->iFromVersion.c_str() ); |
769 AddChildElement( compDepListRoot, aDocument, KFromVersion, compDepIter->FromVersion().c_str() ); |
597 AddChildElement( compDepListRoot, aDocument, L"ToVersion", compDepIter->iToVersion.c_str() ); |
770 AddChildElement( compDepListRoot, aDocument, KToVersion, compDepIter->ToVersion().c_str() ); |
598 } |
771 } |
599 compDepRoot->setAttribute(L"DependentId", aComponentDependency.iDependentId.c_str()); |
772 compDepRoot->setAttribute(KDependentId, aComponentDependency.DependentId().c_str()); |
600 } |
773 } |
601 |
774 |
602 |
775 |
603 void CXmlGenerator::AddChildElement( DOMElement* aRootElement, DOMDocument* aDocument, const wchar_t* aElementName, const wchar_t* aTextValue ) |
776 void CXmlGenerator::AddChildElement( DOMElement* aRootElement, DOMDocument* aDocument, const XMLCh* aElementName, const XMLCh* aTextValue ) |
604 { |
777 { |
605 DOMElement* element = aDocument->createElement(aElementName); |
778 DOMElement* element = aDocument->createElement(aElementName); |
606 aRootElement->appendChild(element); |
779 aRootElement->appendChild(element); |
607 |
780 |
608 DOMText* textValue = aDocument->createTextNode(aTextValue); |
781 DOMText* textValue = aDocument->createTextNode(aTextValue); |
609 element->appendChild(textValue); |
782 element->appendChild(textValue); |
610 } |
783 } |
611 |
784 |
612 DOMElement* CXmlGenerator::AddTag( DOMElement* aRootElement, DOMDocument* aDocument, const wchar_t* aTagName) |
785 DOMElement* CXmlGenerator::AddTag( DOMElement* aRootElement, DOMDocument* aDocument, const XMLCh* aTagName) |
613 { |
786 { |
614 DOMElement* tagName = aDocument->createElement(aTagName); |
787 DOMElement* tagName = aDocument->createElement(aTagName); |
615 aRootElement->appendChild(tagName); |
788 aRootElement->appendChild(tagName); |
616 |
789 |
617 return tagName; |
790 return tagName; |