|
1 /* |
|
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * xmlparser.h |
|
16 * CScrXmlParser - Used to retrieve details from xml files for creating database and |
|
17 * Software environment updates. |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 /** |
|
23 @file |
|
24 @released |
|
25 @internalTechnology |
|
26 */ |
|
27 |
|
28 #ifndef XMLGENERATOR_H |
|
29 #define XMLGENERATOR_H |
|
30 #pragma warning(disable: 4786) |
|
31 #pragma warning(disable: 4291) |
|
32 |
|
33 #include <vector> |
|
34 #include <string> |
|
35 |
|
36 #include "xmlparser.h" |
|
37 #include <xercesc/parsers/XercesDOMParser.hpp> |
|
38 #include <xercesc/sax/ErrorHandler.hpp> |
|
39 #include <xercesc/dom/DOM.hpp> |
|
40 |
|
41 |
|
42 #define ComponentLocalizable XmlDetails::TScrPreProvisionDetail::TComponentLocalizable |
|
43 #define ComponentProperty XmlDetails::TScrPreProvisionDetail::TComponentProperty |
|
44 #define ComponentFile XmlDetails::TScrPreProvisionDetail::TComponentFile |
|
45 #define FileProperty XmlDetails::TScrPreProvisionDetail::TComponentFile::TFileProperty |
|
46 #define ComponentDependency XmlDetails::TScrPreProvisionDetail::TComponentDependency |
|
47 #define ComponentDependencyDetail XmlDetails::TScrPreProvisionDetail::TComponentDependency::TComponentDependencyDetail |
|
48 |
|
49 class CXmlGenerator |
|
50 { |
|
51 |
|
52 public: |
|
53 |
|
54 /** |
|
55 * Initializes the xml parser and logging feature based on supplied logging parameters. |
|
56 */ |
|
57 CXmlGenerator(); |
|
58 |
|
59 /** |
|
60 * Frees allocated memory. |
|
61 */ |
|
62 ~CXmlGenerator(); |
|
63 |
|
64 /** |
|
65 * Retrieves software environment details, from the supplied xml file. |
|
66 */ |
|
67 void WritePreProvisionDetails(const std::wstring aXmlFileName, const XmlDetails::TScrPreProvisionDetail& aPreProvisionDetail); |
|
68 |
|
69 |
|
70 private: |
|
71 |
|
72 void WriteComponent( XERCES_CPP_NAMESPACE::DOMElement* aRootElement, |
|
73 XERCES_CPP_NAMESPACE::DOMDocument* aDocument, |
|
74 const XmlDetails::TScrPreProvisionDetail::TComponent& aComponent |
|
75 ); |
|
76 |
|
77 void WriteComponentVersion ( |
|
78 XERCES_CPP_NAMESPACE::DOMElement* aRootElement, |
|
79 XERCES_CPP_NAMESPACE::DOMDocument* aDocument, |
|
80 XmlDetails::TScrPreProvisionDetail::TComponentDetails::TVersion aVersion |
|
81 ); |
|
82 |
|
83 void WriteComponentLocalizables |
|
84 ( |
|
85 XERCES_CPP_NAMESPACE::DOMElement* aRootElement, |
|
86 XERCES_CPP_NAMESPACE::DOMDocument* aDocument, |
|
87 const std::vector<ComponentLocalizable>& aComponentLocalizable |
|
88 ); |
|
89 |
|
90 void WriteComponentProperties |
|
91 ( |
|
92 XERCES_CPP_NAMESPACE::DOMElement* aRootElement, |
|
93 XERCES_CPP_NAMESPACE::DOMDocument* aDocument, |
|
94 const std::vector<ComponentProperty>& aComponentProperties |
|
95 ); |
|
96 |
|
97 void WriteComponentFiles |
|
98 ( |
|
99 XERCES_CPP_NAMESPACE::DOMElement* aRootElement, |
|
100 XERCES_CPP_NAMESPACE::DOMDocument* aDocument, |
|
101 const std::vector<ComponentFile>& aComponentFiles |
|
102 ); |
|
103 |
|
104 void WriteComponentDependencies |
|
105 ( |
|
106 XERCES_CPP_NAMESPACE::DOMElement* aRootElement, |
|
107 XERCES_CPP_NAMESPACE::DOMDocument* aDocument, |
|
108 const ComponentDependency& aComponentDependency |
|
109 ); |
|
110 |
|
111 void WriteFileProperties |
|
112 ( |
|
113 XERCES_CPP_NAMESPACE::DOMElement* aRootElement, |
|
114 XERCES_CPP_NAMESPACE::DOMDocument* aDocument, |
|
115 const std::vector<FileProperty>& aFileProperties |
|
116 ); |
|
117 |
|
118 void AddChildElement( |
|
119 XERCES_CPP_NAMESPACE::DOMElement* aRootElement, |
|
120 XERCES_CPP_NAMESPACE::DOMDocument* aDocument, |
|
121 const wchar_t* aElementName, |
|
122 const wchar_t* aTextValue |
|
123 ); |
|
124 |
|
125 XERCES_CPP_NAMESPACE::DOMElement* AddTag |
|
126 ( |
|
127 XERCES_CPP_NAMESPACE::DOMElement* aRootElement, |
|
128 XERCES_CPP_NAMESPACE::DOMDocument* aDocument, |
|
129 const wchar_t* aTagName |
|
130 ); |
|
131 |
|
132 void SetWriterFeatures(XERCES_CPP_NAMESPACE::DOMWriter* aDomWriter); |
|
133 |
|
134 }; |
|
135 |
|
136 |
|
137 XERCES_CPP_NAMESPACE_BEGIN |
|
138 |
|
139 class SchemaDomErrorHandler : public DOMErrorHandler |
|
140 { |
|
141 public: |
|
142 bool handleError(const DOMError& domError); |
|
143 }; |
|
144 |
|
145 XERCES_CPP_NAMESPACE_END |
|
146 |
|
147 |
|
148 #endif // XMLGENERATOR_H |