|
1 /* |
|
2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: XML DOM Implementation header file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __INC_CXMLELEMENTIMPL__ |
|
20 #define __INC_CXMLELEMENTIMPL__ |
|
21 |
|
22 #if !defined(__E32BASE_H__) |
|
23 #include <e32base.h> |
|
24 #endif |
|
25 |
|
26 #include "SVGXmlElement.h" |
|
27 |
|
28 |
|
29 |
|
30 class MXmlDocument; |
|
31 |
|
32 |
|
33 /** |
|
34 * Class description |
|
35 */ |
|
36 class CXmlElementImpl : public CBase, public MXmlElement |
|
37 { |
|
38 public: |
|
39 |
|
40 /** |
|
41 * Set the attribute value for a given attribute name of the current XML element |
|
42 * Actual specification requires a new node object be created for the new attribute |
|
43 * This implementation just sets a variable in the element class instance |
|
44 * |
|
45 * @since 1.0 |
|
46 * @param aName - A string buffer containig the name of the attribute to be set |
|
47 * @param aValue - A string buffer containig the value of the attribute to be set |
|
48 * @return An integer containing success/failure for this action |
|
49 */ |
|
50 virtual TInt SetAttributeL( const TDesC& aName, |
|
51 const TDesC& aValue ); |
|
52 |
|
53 |
|
54 /** |
|
55 * Remove attribute for an XML element |
|
56 * Actual specification requires the attribute node be removed |
|
57 * Since this implementation does not create an attribute node, it |
|
58 * just changes the state of the corresponding variable |
|
59 * |
|
60 * @since 1.0 |
|
61 * @param aName - A string buffer containing the name of the attribute to |
|
62 * be removed |
|
63 * @return An integer containing success/failure for this action |
|
64 */ |
|
65 virtual TInt RemoveAttribute( const TDesC& aName ); |
|
66 |
|
67 |
|
68 /** |
|
69 * Accessor for the tag name of an XML element |
|
70 * |
|
71 * @since 1.0 |
|
72 * @param None |
|
73 * @return A string buffer containing the tag name |
|
74 */ |
|
75 virtual const TDesC& TagName(); |
|
76 |
|
77 |
|
78 /** |
|
79 * Append child method for an XML element |
|
80 * |
|
81 * @since 1.0 |
|
82 * @param aAppendChild - The element object that needs to be appended |
|
83 * @return NULL if failed to append; |
|
84 * A MXmlElement pointer to the object that was just appended |
|
85 */ |
|
86 virtual MXmlElement* AppendChildL( MXmlElement* aAppendChild, TBool aIsJSR226Element = EFalse ); |
|
87 |
|
88 |
|
89 /** |
|
90 * Remove child method for an XML element |
|
91 * |
|
92 * @since 1.0 |
|
93 * @param aRemoveChild - A pointer to the object that is to be removed |
|
94 * @return None |
|
95 */ |
|
96 virtual void RemoveChild ( MXmlElement* aRemoveChild ); |
|
97 |
|
98 |
|
99 /** |
|
100 * 'Has child nodes' method that finds out if the current element has any child |
|
101 * nodes |
|
102 * |
|
103 * @since 1.0 |
|
104 * @param None |
|
105 * @return A boolean |
|
106 * ETrue if there are child nodes; EFalse otherwise |
|
107 */ |
|
108 virtual TBool HasChildNodes(); |
|
109 |
|
110 |
|
111 /** |
|
112 * Accessor method for 'first child' of an XML element |
|
113 * |
|
114 * @since 1.0 |
|
115 * @param None |
|
116 * @return An MXmlElement pointer to the first child of the current XML element |
|
117 */ |
|
118 virtual MXmlElement* FirstChild(); |
|
119 |
|
120 |
|
121 /** |
|
122 * Accessor method for 'last child' of an XML element |
|
123 * |
|
124 * @since 1.0 |
|
125 * @param None |
|
126 * @return An MXmlElement pointer to the last child of the current XML element |
|
127 */ |
|
128 virtual MXmlElement* LastChild(); |
|
129 |
|
130 |
|
131 /** |
|
132 * Accessor method for 'owner document' of an XML element |
|
133 * |
|
134 * @since 1.0 |
|
135 * @param None |
|
136 * @return A MXmlDocument pointer to the document object for this XML document |
|
137 */ |
|
138 virtual MXmlDocument* OwnerDocument(); |
|
139 |
|
140 |
|
141 /** |
|
142 * Accessor method for 'next sibling' of an XML element |
|
143 * |
|
144 * @since 1.0 |
|
145 * @param None |
|
146 * @return An MXmlElement pointer to the next sibling of the current XML element |
|
147 */ |
|
148 virtual MXmlElement* NextSibling(); |
|
149 virtual MXmlElement* PreviousSibling(); |
|
150 |
|
151 /** |
|
152 * Accessor method for 'parent node' of an XML element |
|
153 * |
|
154 * @since 1.0 |
|
155 * @param None |
|
156 * @return An MXmlElement pointer to the parent node of the current XML element |
|
157 */ |
|
158 virtual MXmlElement* ParentNode(); |
|
159 |
|
160 |
|
161 /** |
|
162 * Accessor to set first child of an XML element |
|
163 * |
|
164 * @since 1.0 |
|
165 * @param An MXmlElement pointer to the object that is being set as first child |
|
166 * @return None |
|
167 */ |
|
168 virtual void SetFirstChild( MXmlElement* ); |
|
169 |
|
170 |
|
171 /** |
|
172 * Accessor to set last child of an XML element |
|
173 * |
|
174 * @since 1.0 |
|
175 * @param An MXmlElement pointer to the object that is being set as last child |
|
176 * @return None |
|
177 */ |
|
178 virtual void SetLastChild( MXmlElement* ); |
|
179 |
|
180 |
|
181 /** |
|
182 * Accessor to set owner document of an XML element |
|
183 * |
|
184 * @since 1.0 |
|
185 * @param An MXmlDocument pointer to the object that is being set as owner document |
|
186 * @return None |
|
187 */ |
|
188 virtual void SetOwnerDocument( MXmlDocument* ); |
|
189 |
|
190 |
|
191 /** |
|
192 * Accessor to set next sibling of an XML element |
|
193 * |
|
194 * @since 1.0 |
|
195 * @param An MXmlElement pointer to the object that is being set as next sibling |
|
196 * @return None |
|
197 */ |
|
198 virtual void SetNextSibling( MXmlElement* ); |
|
199 |
|
200 |
|
201 /** |
|
202 * Accessor to set parent node of an XML element |
|
203 * |
|
204 * @since 1.0 |
|
205 * @param An MXmlElement pointer to the object that is being set as parent node |
|
206 * @return None |
|
207 */ |
|
208 virtual void SetParentNode( MXmlElement* ); |
|
209 |
|
210 |
|
211 /** |
|
212 * Need method description |
|
213 * |
|
214 * @since 1.0 |
|
215 * @param |
|
216 * @return |
|
217 */ |
|
218 // static CXmlElementImpl* NewL( const TDesC& aTagName ); |
|
219 |
|
220 |
|
221 /** |
|
222 * Need method description |
|
223 * |
|
224 * @since 1.0 |
|
225 * @param |
|
226 * @return |
|
227 */ |
|
228 // static CXmlElementImpl* NewLC( const TDesC& aTagName ); |
|
229 |
|
230 |
|
231 /** |
|
232 * Need method description |
|
233 * |
|
234 * @since 1.0 |
|
235 * @param |
|
236 * @return |
|
237 */ |
|
238 virtual ~CXmlElementImpl(); |
|
239 |
|
240 protected: |
|
241 |
|
242 |
|
243 |
|
244 TUint8 iElemID; |
|
245 /** |
|
246 * Initialize the state of XML element object |
|
247 * |
|
248 * @since 1.0 |
|
249 * @param aTagName - A string buffer containing the tag name with which |
|
250 * the element object is being built |
|
251 * @return None |
|
252 */ |
|
253 virtual void InitializeL( const TUint8 aElemID ); |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 MXmlElement* iParentNode; |
|
259 |
|
260 MXmlElement* iFirstChild; |
|
261 |
|
262 MXmlElement* iLastChild; |
|
263 |
|
264 MXmlElement* iNextSibling; |
|
265 |
|
266 MXmlDocument* iOwnerDocument; |
|
267 |
|
268 public: |
|
269 |
|
270 /** |
|
271 * A method that performs deep copy for this object |
|
272 * |
|
273 * @since 1.0 |
|
274 * @param None |
|
275 * @return An MXmlElement pointer to the newly created object |
|
276 */ |
|
277 MXmlElement* CloneL(MXmlElement* aParentElement); |
|
278 |
|
279 /** |
|
280 * A method that return integer ID of the element |
|
281 * |
|
282 * @since 1.0 |
|
283 * @param None |
|
284 * @return An TUint8 value correspondign the ID of the element |
|
285 */ |
|
286 |
|
287 virtual TUint8 ElemID(); |
|
288 |
|
289 protected: |
|
290 |
|
291 /** |
|
292 * Copy this object to an object that is already created and initialized |
|
293 * |
|
294 * @since 1.0 |
|
295 * @param aDestElement - A CXmlElementImpl pointer to an object |
|
296 * requiring the copy |
|
297 * @return None |
|
298 */ |
|
299 void CopyL( CXmlElementImpl* aDestElement ); |
|
300 |
|
301 }; |
|
302 |
|
303 |
|
304 |
|
305 #endif |