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 |
66 CXmlGenerator::~CXmlGenerator() |
195 CXmlGenerator::~CXmlGenerator() |
67 {} |
196 {} |
68 |
197 |
69 |
198 |
70 void CXmlGenerator::WritePreProvisionDetails(const std::wstring aXmlFileName, const XmlDetails::TScrPreProvisionDetail& aPreProvisionDetail) |
199 void CXmlGenerator::WritePreProvisionDetails(const std::wstring aXmlFileName, |
|
200 const XmlDetails::TScrPreProvisionDetail& aPreProvisionDetail, |
|
201 int& aRomApplication |
|
202 ) |
71 { |
203 { |
72 try |
204 try |
73 { |
205 { |
74 XMLPlatformUtils::Initialize(); |
206 XMLPlatformUtils::Initialize(); |
75 static_fn_auto_ptr<xmlPlatform> xmlPlatformTerm(&XMLPlatformUtils::Terminate); |
207 static_fn_auto_ptr<xmlPlatform> xmlPlatformTerm(&XMLPlatformUtils::Terminate); |
81 SetWriterFeatures(domWriter.get()); |
213 SetWriterFeatures(domWriter.get()); |
82 |
214 |
83 std::auto_ptr < SchemaDomErrorHandler > errHandler(new SchemaDomErrorHandler()); |
215 std::auto_ptr < SchemaDomErrorHandler > errHandler(new SchemaDomErrorHandler()); |
84 domWriter->setErrorHandler(errHandler.get()); |
216 domWriter->setErrorHandler(errHandler.get()); |
85 |
217 |
|
218 #ifdef _WIN32 |
|
219 // XMLString::trascode() function should be used for conversion. |
86 std::auto_ptr < XMLFormatTarget > outputFile( new LocalFileFormatTarget( aXmlFileName.c_str() ) ); |
220 std::auto_ptr < XMLFormatTarget > outputFile( new LocalFileFormatTarget( aXmlFileName.c_str() ) ); |
87 |
221 #else |
88 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"); |
89 if(NULL == epocRoot) |
226 if(NULL == epocRoot) |
90 { |
227 { |
91 throw std::runtime_error("EPOCROOT environment variable not specified."); |
228 throw std::runtime_error("EPOCROOT environment variable not specified."); |
92 } |
229 } |
93 |
230 |
94 std::string epocRootStr(epocRoot); |
231 std::string epocRootStr(epocRoot); |
95 |
232 |
96 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 |
97 |
238 |
98 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()) ); |
99 DOMDocumentType* documentType = domImpl->createDocumentType(L"PreProvisionInformation",NULL, dtdPath.get()); |
240 DOMDocumentType* documentType = domImpl->createDocumentType(KPreProvisionInformation,NULL, dtdPath.get()); |
100 |
241 |
101 |
242 |
102 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) ); |
103 |
244 |
104 DOMElement* rootElement = domDocument->getDocumentElement(); |
245 DOMElement* rootElement = domDocument->getDocumentElement(); |
105 |
246 |
106 // SoftwareTypeName |
247 // SoftwareTypeName |
107 AddChildElement(rootElement, domDocument.get(), SoftwareTypeName.c_str(), aPreProvisionDetail.iSoftwareTypeName.c_str() ); |
248 AddChildElement(rootElement, domDocument.get(), KSoftwareTypeName, aPreProvisionDetail.SoftwareTypeName().c_str() ); |
108 |
249 |
109 std::vector<XmlDetails::TScrPreProvisionDetail::TComponent>::const_iterator compIter; |
250 std::vector<XmlDetails::TScrPreProvisionDetail::TComponent>::const_iterator compIter; |
110 for(compIter = aPreProvisionDetail.iComponents.begin(); compIter != aPreProvisionDetail.iComponents.end() ; ++compIter) |
251 for(compIter = aPreProvisionDetail.iComponents.begin(); compIter != aPreProvisionDetail.iComponents.end() ; ++compIter) |
111 { |
252 { |
112 DOMElement* component = domDocument->createElement(L"Component"); |
253 DOMElement* component = domDocument->createElement(KComponent); |
113 rootElement->appendChild(component); |
254 rootElement->appendChild(component); |
114 |
255 |
115 WriteComponent(component,domDocument.get(), *compIter); |
256 WriteComponent(component,domDocument.get(), *compIter, aRomApplication); |
116 } |
257 } |
117 |
|
118 // do the serialization through DOMWriter::writeNode(); |
258 // do the serialization through DOMWriter::writeNode(); |
119 domWriter->writeNode(outputFile.get(), *domDocument.get()); |
259 domWriter->writeNode(outputFile.get(), *domDocument.get()); |
120 |
|
121 } |
260 } |
122 catch (const XMLException& toCatch) |
261 catch (const XMLException& toCatch) |
123 { |
262 { |
124 char* message = XMLString::transcode(toCatch.getMessage()); |
263 char* message = XMLString::transcode(toCatch.getMessage()); |
125 XMLString::release(&message); |
264 XMLString::release(&message); |
158 aDomWriter->setFeature(XMLUni::fgDOMWRTBOM, true); |
297 aDomWriter->setFeature(XMLUni::fgDOMWRTBOM, true); |
159 |
298 |
160 if (aDomWriter->canSetFeature(XMLUni::fgDOMXMLDeclaration, true)) |
299 if (aDomWriter->canSetFeature(XMLUni::fgDOMXMLDeclaration, true)) |
161 aDomWriter->setFeature(XMLUni::fgDOMXMLDeclaration, true); |
300 aDomWriter->setFeature(XMLUni::fgDOMXMLDeclaration, true); |
162 |
301 |
163 aDomWriter->setEncoding(L"UTF-16"); |
302 aDomWriter->setEncoding(KUTF16); |
164 } |
303 } |
165 |
304 |
166 void CXmlGenerator::WriteComponent( DOMElement* aRootElement, DOMDocument* aDocument, const XmlDetails::TScrPreProvisionDetail::TComponent& aComponent) |
305 void CXmlGenerator::WriteComponent( DOMElement* aRootElement, DOMDocument* aDocument, |
167 { |
306 const XmlDetails::TScrPreProvisionDetail::TComponent& aComponent, |
168 std::wstring isRemovable = Utils::IntegerToWideString(aComponent.iComponentDetails.iIsRemovable); |
307 int& aRomApplication |
169 AddChildElement(aRootElement, aDocument, L"Removable", isRemovable.c_str() ); |
308 ) |
170 |
309 { |
171 std::wstring size = Utils::Int64ToWideString(aComponent.iComponentDetails.iSize); |
310 |
172 AddChildElement(aRootElement, aDocument, L"Size", size.c_str() ); |
311 if (aRomApplication) |
173 |
312 { |
174 std::wstring scomoState = Utils::IntegerToWideString(aComponent.iComponentDetails.iScomoState); |
313 int isRomApplication = 1; |
175 AddChildElement(aRootElement, aDocument, L"ScomoState", scomoState.c_str() ); |
314 XercesString isRomApp = IntegerToXercesString(isRomApplication); |
176 |
315 AddChildElement(aRootElement, aDocument, KRomApplication, isRomApp.c_str()); |
177 AddChildElement(aRootElement, aDocument, L"GlobalId", aComponent.iComponentDetails.iGlobalId.c_str() ); |
316 } |
|
317 |
|
318 XercesString isRemovable = IntegerToXercesString(aComponent.iComponentDetails.iIsRemovable); |
|
319 AddChildElement(aRootElement, aDocument, KRemovable, isRemovable.c_str() ); |
|
320 |
|
321 |
|
322 XercesString size = Int64ToXercesString(aComponent.iComponentDetails.iSize); |
|
323 AddChildElement(aRootElement, aDocument, KSize, size.c_str() ); |
|
324 |
|
325 XercesString scomoState = IntegerToXercesString(aComponent.iComponentDetails.iScomoState); |
|
326 AddChildElement(aRootElement, aDocument, KScomoState, scomoState.c_str() ); |
|
327 |
|
328 AddChildElement(aRootElement, aDocument, KGlobalId, aComponent.iComponentDetails.GlobalId().c_str() ); |
178 |
329 |
179 WriteComponentVersion(aRootElement, aDocument, aComponent.iComponentDetails.iVersion); |
330 WriteComponentVersion(aRootElement, aDocument, aComponent.iComponentDetails.iVersion); |
180 |
331 |
181 std::wstring isOriginVerified = Utils::IntegerToWideString(aComponent.iComponentDetails.iOriginVerified); |
332 XercesString isOriginVerified = Int64ToXercesString(aComponent.iComponentDetails.iOriginVerified); |
182 AddChildElement(aRootElement, aDocument, L"OriginVerified", isOriginVerified.c_str() ); |
333 AddChildElement(aRootElement, aDocument, KOriginVerified, isOriginVerified.c_str() ); |
183 |
334 |
184 std::wstring isHidden = Utils::IntegerToWideString(aComponent.iComponentDetails.iIsHidden); |
335 XercesString isHidden = IntegerToXercesString(aComponent.iComponentDetails.iIsHidden); |
185 AddChildElement(aRootElement, aDocument, L"Hidden", isHidden.c_str() ); |
336 AddChildElement(aRootElement, aDocument, KHidden, isHidden.c_str() ); |
186 |
337 |
187 WriteComponentLocalizables(aRootElement, aDocument, aComponent.iComponentLocalizables); |
338 WriteComponentLocalizables(aRootElement, aDocument, aComponent.iComponentLocalizables); |
188 |
339 |
189 WriteComponentProperties(aRootElement, aDocument, aComponent.iComponentProperties); |
340 WriteComponentProperties(aRootElement, aDocument, aComponent.iComponentProperties); |
190 |
341 |
191 WriteComponentFiles(aRootElement, aDocument, aComponent.iComponentFiles); |
342 WriteComponentFiles(aRootElement, aDocument, aComponent.iComponentFiles); |
192 |
343 |
193 WriteComponentDependencies(aRootElement, aDocument, aComponent.iComponentDependency); |
344 WriteComponentDependencies(aRootElement, aDocument, aComponent.iComponentDependency); |
|
345 |
|
346 WriteAppRegInfo(aRootElement, aDocument, aComponent.iApplicationRegistrationInfo); |
|
347 |
194 } |
348 } |
195 |
349 |
196 void CXmlGenerator::WriteComponentVersion |
350 void CXmlGenerator::WriteComponentVersion |
197 ( |
351 ( |
198 DOMElement* aRootElement, |
352 DOMElement* aRootElement, |
199 DOMDocument* aDocument, |
353 DOMDocument* aDocument, |
200 XmlDetails::TScrPreProvisionDetail::TComponentDetails::TVersion aVersion |
354 XmlDetails::TScrPreProvisionDetail::TComponentDetails::TVersion aVersion |
201 ) |
355 ) |
202 { |
356 { |
203 DOMElement* version = aDocument->createElement(L"Version"); |
357 DOMElement* version = aDocument->createElement(KVersion); |
204 aRootElement->appendChild(version); |
358 aRootElement->appendChild(version); |
205 version->setAttribute( L"Major", aVersion.iMajor.c_str() ); |
359 version->setAttribute( KMajor, aVersion.MajorVersion().c_str() ); |
206 version->setAttribute( L"Minor", aVersion.iMinor.c_str() ); |
360 version->setAttribute( KMinor, aVersion.MinorVersion().c_str() ); |
207 version->setAttribute( L"Build", aVersion.iBuild.c_str() ); |
361 version->setAttribute( KBuild, aVersion.BuildVersion().c_str() ); |
208 } |
362 } |
209 |
363 |
210 void CXmlGenerator::WriteComponentLocalizables |
364 void CXmlGenerator::WriteComponentLocalizables |
211 ( |
365 ( |
212 DOMElement* aRootElement, DOMDocument* aDocument, |
366 DOMElement* aRootElement, DOMDocument* aDocument, |
232 { |
388 { |
233 std::vector<ComponentProperty>::const_iterator compPropIter; |
389 std::vector<ComponentProperty>::const_iterator compPropIter; |
234 for( compPropIter = aComponentProperties.begin() ; compPropIter != aComponentProperties.end() ; ++compPropIter) |
390 for( compPropIter = aComponentProperties.begin() ; compPropIter != aComponentProperties.end() ; ++compPropIter) |
235 { |
391 { |
236 |
392 |
237 DOMElement* compPropRoot = AddTag(aRootElement, aDocument, L"ComponentProperty"); |
393 DOMElement* compPropRoot = AddTag(aRootElement, aDocument, KComponentProperty); |
238 |
394 |
239 std::wstring locale = Utils::IntegerToWideString(compPropIter->iLocale); |
395 XercesString locale = IntegerToXercesString(compPropIter->iLocale); |
240 AddChildElement(compPropRoot,aDocument, L"ComponentProperty_Locale", locale.c_str()); |
396 AddChildElement(compPropRoot,aDocument, KComponentProperty_Locale, locale.c_str()); |
241 |
397 |
242 DOMElement* compPropValueRoot = AddTag(compPropRoot, aDocument, L"ComponentProperty_Value"); |
398 DOMElement* compPropValueRoot = AddTag(compPropRoot, aDocument, KComponentProperty_Value); |
243 |
399 |
244 std::wstring isBinary = Utils::IntegerToWideString(compPropIter->iIsStr8Bit); |
400 XercesString isBinary = IntegerToXercesString(compPropIter->iIsStr8Bit); |
245 |
401 |
246 if(compPropIter->iIsIntValue) |
402 if(compPropIter->iIsIntValue) |
247 { |
403 { |
248 AddChildElement(compPropValueRoot,aDocument, L"ComponentProperty_IntValue", compPropIter->iValue.c_str()); |
404 AddChildElement(compPropValueRoot,aDocument, KComponentProperty_IntValue, compPropIter->Value().c_str()); |
249 } |
405 } |
250 else |
406 else |
251 { |
407 { |
252 AddChildElement(compPropValueRoot,aDocument, L"ComponentProperty_StrValue", compPropIter->iValue.c_str()); |
408 AddChildElement(compPropValueRoot,aDocument, KComponentProperty_StrValue, compPropIter->Value().c_str()); |
253 } |
409 } |
254 |
410 |
255 |
411 |
256 AddChildElement(compPropRoot,aDocument, L"ComponentProperty_IsBinary", isBinary.c_str()); |
412 AddChildElement(compPropRoot,aDocument, KComponentProperty_IsBinary, isBinary.c_str()); |
257 |
413 |
258 compPropRoot->setAttribute(L"Name", compPropIter->iName.c_str()); |
414 compPropRoot->setAttribute(KName, compPropIter->Name().c_str()); |
259 |
415 |
260 } |
416 } |
261 } |
417 } |
|
418 |
|
419 |
|
420 /** |
|
421 * Writes Class TAppRegistrationInfo Info in XML. |
|
422 */ |
|
423 |
|
424 void CXmlGenerator::WriteAppRegInfo |
|
425 ( |
|
426 DOMElement* aRootElement, DOMDocument* aDocument, |
|
427 const std::vector<AppRegistrationInfo>& aAppRegInfo |
|
428 ) |
|
429 { |
|
430 std::vector<AppRegistrationInfo>::const_iterator compFileIter; |
|
431 for( compFileIter = aAppRegInfo.begin() ; compFileIter != aAppRegInfo.end() ; ++compFileIter) |
|
432 { |
|
433 DOMElement* compFileRoot = AddTag(aRootElement, aDocument, KApplicationRegistrationInfo); |
|
434 |
|
435 WriteAppAttributes(compFileRoot, aDocument, compFileIter->iApplicationAttribute); |
|
436 |
|
437 const std::vector<AppOpaqueDataType>& aAppOpaqueDataType = compFileIter->iOpaqueDataType; |
|
438 std::vector<AppOpaqueDataType>::const_iterator fileAppOpaqueDataType; |
|
439 |
|
440 for( fileAppOpaqueDataType = aAppOpaqueDataType.begin() ; fileAppOpaqueDataType != aAppOpaqueDataType.end() ; ++fileAppOpaqueDataType) |
|
441 { |
|
442 if(0 == fileAppOpaqueDataType->iServiceUid) |
|
443 { |
|
444 DOMElement* filePropValueRoot = AddTag(compFileRoot, aDocument, KOpaqueData); |
|
445 |
|
446 if(fileAppOpaqueDataType->iIsBinary) |
|
447 { |
|
448 std::string temp = wstring2string(fileAppOpaqueDataType->iOpaqueData); |
|
449 std::string binStrData = Util::Base64Encode(temp); |
|
450 std::wstring binData = string2wstring(binStrData); |
|
451 XercesString opaqueBinData = WStringToXercesString(binData); |
|
452 AddChildElement(filePropValueRoot,aDocument, KData, opaqueBinData.c_str()); |
|
453 } |
|
454 else |
|
455 { |
|
456 XercesString opaqueData = WStringToXercesString(fileAppOpaqueDataType->iOpaqueData); |
|
457 AddChildElement(filePropValueRoot,aDocument, KData, opaqueData.c_str()); |
|
458 } |
|
459 |
|
460 XercesString locale = IntegerToXercesString(fileAppOpaqueDataType->iLocale); |
|
461 AddChildElement(filePropValueRoot,aDocument, KOpaqueLocale, locale.c_str()); |
|
462 |
|
463 XercesString iBinary = IntegerToXercesString(fileAppOpaqueDataType->iIsBinary); |
|
464 AddChildElement(filePropValueRoot,aDocument, KIsBinary, iBinary.c_str()); |
|
465 |
|
466 } |
|
467 } |
|
468 |
|
469 for(vector<std::wstring>::iterator mimeiter = compFileIter->iFileOwnershipInfo.begin() ; mimeiter != compFileIter->iFileOwnershipInfo.end() ; ++mimeiter ) |
|
470 { |
|
471 DOMElement* filePropRoot = AddTag(compFileRoot, aDocument, KFileOwnershipinfo); |
|
472 |
|
473 XercesString temp = WStringToXercesString(*mimeiter); |
|
474 AddChildElement(filePropRoot,aDocument, KFileName, temp.c_str()); |
|
475 } |
|
476 |
|
477 WriteAppServiceInfo(compFileRoot, aDocument, compFileIter->iApplicationServiceInfo, compFileIter->iOpaqueDataType); |
|
478 WriteAppLocalizableInfo(compFileRoot, aDocument, compFileIter->iApplicationLocalizableInfo); |
|
479 } |
|
480 } |
|
481 |
|
482 /** |
|
483 * Writes Class TAppLocalizableInfo Info in XML. |
|
484 */ |
|
485 |
|
486 void CXmlGenerator::WriteAppLocalizableInfo |
|
487 ( |
|
488 DOMElement* aRootElement, DOMDocument* aDocument, |
|
489 const std::vector<AppLocalizableInfo>& aAppLocalizableInfo |
|
490 ) |
|
491 { |
|
492 std::vector<AppLocalizableInfo>::const_iterator filePropIter; |
|
493 for( filePropIter = aAppLocalizableInfo.begin() ; filePropIter != aAppLocalizableInfo.end() ; ++filePropIter) |
|
494 { |
|
495 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KApplicationLocalizableInfo); |
|
496 |
|
497 WriteAppLocalizableAttribute(filePropRoot, aDocument, filePropIter->iLocalizableAttribute); |
|
498 WriteAppLocalizableViewData(filePropRoot, aDocument, filePropIter->iViewData); |
|
499 } |
|
500 } |
|
501 |
|
502 /** |
|
503 * Writes Class TAppLocalizableAttribute Info in XML. |
|
504 */ |
|
505 |
|
506 void CXmlGenerator::WriteAppLocalizableAttribute |
|
507 ( |
|
508 DOMElement* aRootElement, DOMDocument* aDocument, |
|
509 const std::vector<AppLocalizableAttribute>& aAppLocalizableAttribute |
|
510 ) |
|
511 { |
|
512 std::vector<AppLocalizableAttribute>::const_iterator filePropIter; |
|
513 for( filePropIter = aAppLocalizableAttribute.begin() ; filePropIter != aAppLocalizableAttribute.end() ; ++filePropIter) |
|
514 { |
|
515 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KLocalizableAttribute); |
|
516 DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, KLocalizableAttribute_Value); |
|
517 |
|
518 XercesString value = WStringToXercesString(filePropIter->iValue); |
|
519 if(filePropIter->iIsIntValue) |
|
520 { |
|
521 AddChildElement(filePropValueRoot, aDocument, KLocalizableAttribute_IntValue, value.c_str()); |
|
522 } |
|
523 else |
|
524 { |
|
525 AddChildElement(filePropValueRoot, aDocument, KLocalizableAttribute_StrValue, value.c_str()); |
|
526 } |
|
527 XercesString name = WStringToXercesString(filePropIter->iName); |
|
528 filePropRoot->setAttribute(KName, name.c_str()); |
|
529 } |
|
530 } |
|
531 |
|
532 /** |
|
533 * Writes Class TAppViewData Info in XML. |
|
534 */ |
|
535 |
|
536 void CXmlGenerator::WriteAppLocalizableViewData |
|
537 ( |
|
538 DOMElement* aRootElement, DOMDocument* aDocument, |
|
539 const std::vector<AppViewData>& aAppViewData |
|
540 ) |
|
541 { |
|
542 std::vector<AppViewData>::const_iterator filePropIter; |
|
543 for( filePropIter = aAppViewData.begin() ; filePropIter != aAppViewData.end() ; ++filePropIter) |
|
544 { |
|
545 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KViewData); |
|
546 WriteAppLocalizableViewDataAttributes(filePropRoot, aDocument, filePropIter->iViewDataAttributes); |
|
547 } |
|
548 } |
|
549 |
|
550 void CXmlGenerator::WriteAppLocalizableViewDataAttributes |
|
551 ( |
|
552 DOMElement* aRootElement, DOMDocument* aDocument, |
|
553 const std::vector<AppViewDataAttributes>& aAppViewDataAttributes |
|
554 ) |
|
555 { |
|
556 std::vector<AppViewDataAttributes>::const_iterator filePropIter; |
|
557 for( filePropIter = aAppViewDataAttributes.begin() ; filePropIter != aAppViewDataAttributes.end() ; ++filePropIter) |
|
558 { |
|
559 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KViewDataAttribute); |
|
560 DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, KViewData_Value); |
|
561 |
|
562 XercesString value = WStringToXercesString(filePropIter->iValue); |
|
563 if(filePropIter->iIsIntValue) |
|
564 { |
|
565 AddChildElement(filePropValueRoot, aDocument, KViewData_IntValue, value.c_str()); |
|
566 |
|
567 } |
|
568 else |
|
569 { |
|
570 AddChildElement(filePropValueRoot, aDocument, KViewData_StrValue, value.c_str()); |
|
571 |
|
572 } |
|
573 |
|
574 XercesString name = WStringToXercesString(filePropIter->iName); |
|
575 filePropRoot->setAttribute(KName, name.c_str()); |
|
576 } |
|
577 } |
|
578 |
|
579 /** |
|
580 * Writes Class TAppServiceInfo Info in XML. |
|
581 */ |
|
582 |
|
583 void CXmlGenerator::WriteAppServiceInfo |
|
584 ( |
|
585 DOMElement* aRootElement, DOMDocument* aDocument, |
|
586 const std::vector<AppServiceInfo>& aAppServiceInfo, |
|
587 const std::vector<AppOpaqueDataType>& aAppOpaqueData |
|
588 ) |
|
589 { |
|
590 std::vector<AppServiceInfo>::const_iterator filePropIter; |
|
591 std::vector<AppOpaqueDataType>::const_iterator fileAppPropIter; |
|
592 for( filePropIter = aAppServiceInfo.begin() ; filePropIter != aAppServiceInfo.end() ; ++filePropIter) |
|
593 { |
|
594 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KApplicationServiceInfo); |
|
595 |
|
596 XercesString uid = IntegerToXercesString(filePropIter->iUid); |
|
597 AddChildElement(filePropRoot,aDocument, KUid, uid.c_str()); |
|
598 |
|
599 |
|
600 for( fileAppPropIter = aAppOpaqueData.begin() ; fileAppPropIter != aAppOpaqueData.end() ; ++fileAppPropIter) |
|
601 { |
|
602 if(filePropIter->iUid == fileAppPropIter->iServiceUid) |
|
603 { |
|
604 if(!fileAppPropIter->iOpaqueData.empty()) |
|
605 { |
|
606 DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, KServiceOpaqueData); |
|
607 |
|
608 XercesString opaqueData = WStringToXercesString(fileAppPropIter->iOpaqueData); |
|
609 AddChildElement(filePropValueRoot,aDocument, KServiceData, opaqueData.c_str()); |
|
610 |
|
611 XercesString locale = IntegerToXercesString(fileAppPropIter->iLocale); |
|
612 AddChildElement(filePropValueRoot,aDocument, KServiceOpaqueLocale, locale.c_str()); |
|
613 } |
|
614 } |
|
615 } |
|
616 |
|
617 WriteAppDataType(filePropRoot, aDocument, filePropIter->iDataType); |
|
618 } |
|
619 } |
|
620 |
|
621 /** |
|
622 * Writes Class TDataType Info in XML. |
|
623 */ |
|
624 |
|
625 void CXmlGenerator::WriteAppDataType |
|
626 ( |
|
627 DOMElement* aRootElement, DOMDocument* aDocument, |
|
628 const std::vector<AppDataType>& aAppDataType |
|
629 ) |
|
630 { |
|
631 std::vector<AppDataType>::const_iterator filePropIter; |
|
632 for( filePropIter = aAppDataType.begin() ; filePropIter != aAppDataType.end() ; ++filePropIter) |
|
633 { |
|
634 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KApplicationDataType); |
|
635 |
|
636 XercesString priority = IntegerToXercesString(filePropIter->iPriority); |
|
637 AddChildElement(filePropRoot,aDocument, KPriority, priority.c_str()); |
|
638 |
|
639 XercesString type = WStringToXercesString(filePropIter->iType); |
|
640 AddChildElement(filePropRoot, aDocument, KType, type.c_str()); |
|
641 } |
|
642 } |
|
643 |
|
644 /** |
|
645 * Writes Class TApplicationAttribute Info in XML. |
|
646 */ |
|
647 |
|
648 void CXmlGenerator::WriteAppAttributes |
|
649 ( |
|
650 DOMElement* aRootElement, DOMDocument* aDocument, |
|
651 const std::vector<ApplicationAttribute>& aAppAttributes |
|
652 ) |
|
653 { |
|
654 std::vector<ApplicationAttribute>::const_iterator filePropIter; |
|
655 for( filePropIter = aAppAttributes.begin() ; filePropIter != aAppAttributes.end() ; ++filePropIter) |
|
656 { |
|
657 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KApplicationAttribute); |
|
658 |
|
659 DOMElement* filePropValueRoot = AddTag(filePropRoot, aDocument, KApplicationAttribute_Value); |
|
660 |
|
661 XercesString value = WStringToXercesString(filePropIter->iValue); |
|
662 if(filePropIter->iIsIntValue) |
|
663 { |
|
664 AddChildElement(filePropValueRoot, aDocument, KApplicationAttribute_IntValue, value.c_str()); |
|
665 } |
|
666 else |
|
667 { |
|
668 AddChildElement(filePropValueRoot, aDocument, KApplicationAttribute_StrValue, value.c_str()); |
|
669 } |
|
670 |
|
671 XercesString name = WStringToXercesString(filePropIter->iName); |
|
672 filePropRoot->setAttribute(KName, name.c_str()); |
|
673 } |
|
674 } |
|
675 |
|
676 /** |
|
677 * Writes Class TApplicationProperty Info in XML. |
|
678 */ |
|
679 void CXmlGenerator::WriteAppProperty |
|
680 ( |
|
681 DOMElement* aRootElement, DOMDocument* aDocument, |
|
682 const std::vector<AppProperty>& aAppProperty |
|
683 ) |
|
684 { |
|
685 std::vector<AppProperty>::const_iterator filePropIter; |
|
686 for( filePropIter = aAppProperty.begin() ; filePropIter != aAppProperty.end() ; ++filePropIter) |
|
687 { |
|
688 DOMElement* filePropRoot = AddTag(aRootElement, aDocument, KApplicationProperty); |
|
689 |
|
690 XercesString locale = IntegerToXercesString(filePropIter->iLocale); |
|
691 AddChildElement(filePropRoot,aDocument, KLocale, locale.c_str()); |
|
692 |
|
693 XercesString name = WStringToXercesString(filePropIter->iName); |
|
694 AddChildElement(filePropRoot,aDocument, KName, name.c_str()); |
|
695 |
|
696 XercesString serviceUid = IntegerToXercesString(filePropIter->iServiceUid); |
|
697 AddChildElement(filePropRoot,aDocument, KServiceUid, serviceUid.c_str()); |
|
698 |
|
699 XercesString intValue = IntegerToXercesString(filePropIter->iIntValue); |
|
700 AddChildElement(filePropRoot,aDocument, KIntValue, intValue.c_str()); |
|
701 |
|
702 XercesString strValue = WStringToXercesString(filePropIter->iStrValue); |
|
703 AddChildElement(filePropRoot, aDocument, KStrValue, strValue.c_str()); |
|
704 |
|
705 XercesString isStr8Bit = IntegerToXercesString(filePropIter->iIsStr8Bit); |
|
706 AddChildElement(filePropRoot,aDocument, KIsStr8Bit, isStr8Bit.c_str()); |
|
707 } |
|
708 } |
262 |
709 |
263 void CXmlGenerator::WriteComponentFiles |
710 void CXmlGenerator::WriteComponentFiles |
264 ( |
711 ( |
265 DOMElement* aRootElement, DOMDocument* aDocument, |
712 DOMElement* aRootElement, DOMDocument* aDocument, |
266 const std::vector<ComponentFile>& aComponentFiles |
713 const std::vector<ComponentFile>& aComponentFiles |
267 ) |
714 ) |
268 { |
715 { |
269 std::vector<ComponentFile>::const_iterator compFileIter; |
716 std::vector<ComponentFile>::const_iterator compFileIter; |
270 for( compFileIter = aComponentFiles.begin() ; compFileIter != aComponentFiles.end() ; ++compFileIter) |
717 for( compFileIter = aComponentFiles.begin() ; compFileIter != aComponentFiles.end() ; ++compFileIter) |
271 { |
718 { |
272 DOMElement* compFileRoot = AddTag(aRootElement, aDocument, L"ComponentFile"); |
719 DOMElement* compFileRoot = AddTag(aRootElement, aDocument, KComponentFile); |
273 |
720 |
274 WriteFileProperties(compFileRoot, aDocument, compFileIter->iFileProperties); |
721 WriteFileProperties(compFileRoot, aDocument, compFileIter->iFileProperties); |
275 |
722 |
276 compFileRoot->setAttribute(L"Location", compFileIter->iLocation.c_str()); |
723 compFileRoot->setAttribute(KLocation, compFileIter->Location().c_str()); |
277 } |
724 } |
278 } |
725 } |
279 |
726 |
280 void CXmlGenerator::WriteFileProperties |
727 void CXmlGenerator::WriteFileProperties |
281 ( |
728 ( |
313 return; |
760 return; |
314 |
761 |
315 std::vector<ComponentDependencyDetail> componentDependencyList = aComponentDependency.iComponentDependencyList; |
762 std::vector<ComponentDependencyDetail> componentDependencyList = aComponentDependency.iComponentDependencyList; |
316 std::vector<ComponentDependencyDetail>::const_iterator compDepIter; |
763 std::vector<ComponentDependencyDetail>::const_iterator compDepIter; |
317 |
764 |
318 DOMElement* compDepRoot = AddTag(aRootElement, aDocument, L"ComponentDependency"); |
765 DOMElement* compDepRoot = AddTag(aRootElement, aDocument, KComponentDependency); |
319 |
766 |
320 for( compDepIter = componentDependencyList.begin() ; compDepIter != componentDependencyList.end() ; ++compDepIter) |
767 for( compDepIter = componentDependencyList.begin() ; compDepIter != componentDependencyList.end() ; ++compDepIter) |
321 { |
768 { |
322 DOMElement* compDepListRoot = AddTag( compDepRoot, aDocument, L"DependencyList" ); |
769 DOMElement* compDepListRoot = AddTag( compDepRoot, aDocument, KDependencyList ); |
323 AddChildElement( compDepListRoot, aDocument, L"SupplierId", compDepIter->iSupplierId.c_str() ); |
770 AddChildElement( compDepListRoot, aDocument, KSupplierId, compDepIter->SupplierId().c_str() ); |
324 AddChildElement( compDepListRoot, aDocument, L"FromVersion", compDepIter->iFromVersion.c_str() ); |
771 AddChildElement( compDepListRoot, aDocument, KFromVersion, compDepIter->FromVersion().c_str() ); |
325 AddChildElement( compDepListRoot, aDocument, L"ToVersion", compDepIter->iToVersion.c_str() ); |
772 AddChildElement( compDepListRoot, aDocument, KToVersion, compDepIter->ToVersion().c_str() ); |
326 } |
773 } |
327 compDepRoot->setAttribute(L"DependentId", aComponentDependency.iDependentId.c_str()); |
774 compDepRoot->setAttribute(KDependentId, aComponentDependency.DependentId().c_str()); |
328 } |
775 } |
329 |
776 |
330 |
777 |
331 void CXmlGenerator::AddChildElement( DOMElement* aRootElement, DOMDocument* aDocument, const wchar_t* aElementName, const wchar_t* aTextValue ) |
778 void CXmlGenerator::AddChildElement( DOMElement* aRootElement, DOMDocument* aDocument, const XMLCh* aElementName, const XMLCh* aTextValue ) |
332 { |
779 { |
333 DOMElement* element = aDocument->createElement(aElementName); |
780 DOMElement* element = aDocument->createElement(aElementName); |
334 aRootElement->appendChild(element); |
781 aRootElement->appendChild(element); |
335 |
782 |
336 DOMText* textValue = aDocument->createTextNode(aTextValue); |
783 DOMText* textValue = aDocument->createTextNode(aTextValue); |
337 element->appendChild(textValue); |
784 element->appendChild(textValue); |
338 } |
785 } |
339 |
786 |
340 DOMElement* CXmlGenerator::AddTag( DOMElement* aRootElement, DOMDocument* aDocument, const wchar_t* aTagName) |
787 DOMElement* CXmlGenerator::AddTag( DOMElement* aRootElement, DOMDocument* aDocument, const XMLCh* aTagName) |
341 { |
788 { |
342 DOMElement* tagName = aDocument->createElement(aTagName); |
789 DOMElement* tagName = aDocument->createElement(aTagName); |
343 aRootElement->appendChild(tagName); |
790 aRootElement->appendChild(tagName); |
344 |
791 |
345 return tagName; |
792 return tagName; |