williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description: The abstract interface of an XML element
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
|
williamr@2
|
20 |
|
williamr@2
|
21 |
|
williamr@2
|
22 |
|
williamr@2
|
23 |
|
williamr@2
|
24 |
|
williamr@2
|
25 |
#ifndef M_SEN_ELEMENT_H
|
williamr@2
|
26 |
#define M_SEN_ELEMENT_H
|
williamr@2
|
27 |
|
williamr@2
|
28 |
// INCLUDES
|
williamr@2
|
29 |
#include <e32base.h>
|
williamr@2
|
30 |
#include <s32strm.h>
|
williamr@4
|
31 |
#include <xml/attribute.h>
|
williamr@2
|
32 |
|
williamr@2
|
33 |
// FORWARD DECLARATIONS
|
williamr@2
|
34 |
class CSenElement;
|
williamr@2
|
35 |
class CSenBaseAttribute;
|
williamr@2
|
36 |
class CSenNamespace;
|
williamr@2
|
37 |
|
williamr@2
|
38 |
using namespace Xml;
|
williamr@2
|
39 |
|
williamr@2
|
40 |
// CLASS DECLARATION
|
williamr@2
|
41 |
|
williamr@2
|
42 |
/**
|
williamr@2
|
43 |
* The abstract interface of an XML element
|
williamr@2
|
44 |
* @lib SenXML.dll
|
williamr@2
|
45 |
* @since Series60 3.0
|
williamr@2
|
46 |
*/
|
williamr@2
|
47 |
class MSenElement
|
williamr@2
|
48 |
{
|
williamr@2
|
49 |
public: // New functions
|
williamr@2
|
50 |
|
williamr@2
|
51 |
/**
|
williamr@2
|
52 |
* Getter for Element's local name.
|
williamr@2
|
53 |
* @return KNullDesC if not set
|
williamr@2
|
54 |
*/
|
williamr@2
|
55 |
virtual const TDesC8& LocalName() const = 0;
|
williamr@2
|
56 |
|
williamr@2
|
57 |
/**
|
williamr@2
|
58 |
* Getter for Element's namespace URI.
|
williamr@2
|
59 |
* @return Namespace URI or KNullDesC if not set.
|
williamr@2
|
60 |
*/
|
williamr@2
|
61 |
virtual const TDesC8& NamespaceURI() const = 0;
|
williamr@2
|
62 |
|
williamr@2
|
63 |
/**
|
williamr@2
|
64 |
* Setter for Element's namespace URI.
|
williamr@2
|
65 |
* @param aNsUri: Namespace URI
|
williamr@2
|
66 |
*/
|
williamr@2
|
67 |
virtual void SetNamespaceL(const TDesC8& aNsUri) = 0;
|
williamr@2
|
68 |
|
williamr@2
|
69 |
/**
|
williamr@2
|
70 |
* Setter for Element's namespace URI.
|
williamr@2
|
71 |
* @param aNsPrefix: Namespace prefix
|
williamr@2
|
72 |
* @param aNsUri: Namespace URI
|
williamr@2
|
73 |
*/
|
williamr@2
|
74 |
virtual void SetNamespaceL( const TDesC8& aNsPrefix,
|
williamr@2
|
75 |
const TDesC8& aNsUri) = 0;
|
williamr@2
|
76 |
|
williamr@2
|
77 |
/**
|
williamr@2
|
78 |
* Method for adding a namespace for the Element.
|
williamr@2
|
79 |
* @param aNsPrefix: Namespace prefix
|
williamr@2
|
80 |
* @param aNsUri: Namespace URI
|
williamr@2
|
81 |
* @return the added Namespace, or the equivalent pre-existing one.
|
williamr@2
|
82 |
*/
|
williamr@2
|
83 |
virtual const CSenNamespace* AddNamespaceL( const TDesC8& aPrefix,
|
williamr@2
|
84 |
const TDesC8& aUri) = 0;
|
williamr@2
|
85 |
|
williamr@2
|
86 |
/**
|
williamr@2
|
87 |
* Adds a namespace declaration.
|
williamr@2
|
88 |
* If this element (or its parent if parameter aCheckInParent is ETrue)
|
williamr@2
|
89 |
* already has a Namespace with the same prefix and URI the given
|
williamr@2
|
90 |
* Namespace is not added.
|
williamr@2
|
91 |
* @param aNewNamespace
|
williamr@2
|
92 |
* @param aCheckInParent
|
williamr@2
|
93 |
* @return the added Namespace, or the equivalent pre-existing one.
|
williamr@2
|
94 |
*/
|
williamr@2
|
95 |
virtual const CSenNamespace* AddNamespaceL( CSenNamespace& aNewNamespace,
|
williamr@2
|
96 |
TBool aCheckInParent) = 0;
|
williamr@2
|
97 |
/**
|
williamr@2
|
98 |
* Getter for Element's namespace.
|
williamr@2
|
99 |
* @return const pointer to the CSenNamespace object of this Element.
|
williamr@2
|
100 |
* NULL if not set.
|
williamr@2
|
101 |
*/
|
williamr@2
|
102 |
virtual const CSenNamespace* Namespace() = 0;
|
williamr@2
|
103 |
|
williamr@2
|
104 |
/**
|
williamr@2
|
105 |
* Get namespace that is declared for the given prefix
|
williamr@2
|
106 |
* @param aNsPrefix: The prefix to be used in searching.
|
williamr@2
|
107 |
* @return the found Namespace that is declared for the given prefix
|
williamr@2
|
108 |
* within the scope of this Element or NULL if not found.
|
williamr@2
|
109 |
*/
|
williamr@2
|
110 |
virtual const CSenNamespace* Namespace( const TDesC8& aNsPrefix) = 0;
|
williamr@2
|
111 |
|
williamr@2
|
112 |
/**
|
williamr@2
|
113 |
* Get namespace that is declared for the given prefix and namespace
|
williamr@2
|
114 |
* URI within the scope of this Element.
|
williamr@2
|
115 |
*
|
williamr@2
|
116 |
* @param aNsPrefix: The prefix used to search
|
williamr@2
|
117 |
* @param aUri: The namespace URI used to search.
|
williamr@2
|
118 |
* @return the found Namespace that is declared for the given prefix and namespace
|
williamr@2
|
119 |
* URI within the scope of this Element or NULL if not found.
|
williamr@2
|
120 |
*/
|
williamr@2
|
121 |
virtual const CSenNamespace* Namespace( const TDesC8& aNsPrefix,
|
williamr@2
|
122 |
const TDesC8& aUri) = 0;
|
williamr@2
|
123 |
|
williamr@2
|
124 |
/**
|
williamr@2
|
125 |
* Get namespace that is declared for the given prefix and namespace
|
williamr@2
|
126 |
* URI within the scope of this Element.
|
williamr@2
|
127 |
*
|
williamr@2
|
128 |
* @param aNsPrefix: The prefix used to search
|
williamr@2
|
129 |
* @param aCheckInParent: The flag indicating whether to check parent's
|
williamr@2
|
130 |
* namespaces too if not found in the current
|
williamr@2
|
131 |
* element.
|
williamr@2
|
132 |
* ETrue to check, EFalse for not to check.
|
williamr@2
|
133 |
* @return the found Namespace that is declared for the given prefix and namespace
|
williamr@2
|
134 |
* URI within the scope of this Element or NULL if not found
|
williamr@2
|
135 |
*/
|
williamr@2
|
136 |
virtual const CSenNamespace* Namespace( const TDesC8& aNsPrefix,
|
williamr@2
|
137 |
const TBool aCheckInParent) = 0;
|
williamr@2
|
138 |
|
williamr@2
|
139 |
/**
|
williamr@2
|
140 |
* Getter for namespace prefix of this element.
|
williamr@2
|
141 |
* @return namespace prefix or KNullDesC8 if not set.
|
williamr@2
|
142 |
*/
|
williamr@2
|
143 |
virtual const TDesC8& NsPrefix() const = 0;
|
williamr@2
|
144 |
|
williamr@2
|
145 |
/**
|
williamr@2
|
146 |
* Setter for namespace prefix of this element.
|
williamr@2
|
147 |
* @param aPrefix: new namespace prefix for the element.
|
williamr@2
|
148 |
*/
|
williamr@2
|
149 |
virtual void SetPrefixL(const TDesC8& aPrefix) = 0;
|
williamr@2
|
150 |
|
williamr@2
|
151 |
/**
|
williamr@2
|
152 |
* Method for checking if the element has any content within.
|
williamr@2
|
153 |
* @return ETrue if has content, EFalse if not.
|
williamr@2
|
154 |
*/
|
williamr@2
|
155 |
virtual TBool HasContent() const = 0;
|
williamr@2
|
156 |
|
williamr@2
|
157 |
/**
|
williamr@2
|
158 |
* Getter for the content of the element.
|
williamr@2
|
159 |
* @return the content or KNullDesC8 if empty.
|
williamr@2
|
160 |
*/
|
williamr@2
|
161 |
virtual TPtrC8 Content() const = 0;
|
williamr@2
|
162 |
|
williamr@2
|
163 |
/**
|
williamr@2
|
164 |
* Getter for the content of the element, unicode version.
|
williamr@2
|
165 |
* @return content as unicode. Ownership IS TRANSFERRED to the caller.
|
williamr@2
|
166 |
*/
|
williamr@2
|
167 |
virtual HBufC* ContentUnicodeL() const = 0;
|
williamr@2
|
168 |
|
williamr@2
|
169 |
/**
|
williamr@2
|
170 |
* Sets the content to the element. Old content is overwritten.
|
williamr@2
|
171 |
* @param aContent: The content to be set. Can be KNullDesC8.
|
williamr@2
|
172 |
* @return The content of the element or KNullDesC8 if no content was set.
|
williamr@2
|
173 |
*/
|
williamr@2
|
174 |
virtual TPtrC8 SetContentL(const TDesC8& aContent) = 0;
|
williamr@2
|
175 |
|
williamr@2
|
176 |
/**
|
williamr@2
|
177 |
* Gets the write stream for the content for easy appending.
|
williamr@2
|
178 |
* Writing 8-bit (UTF-8) string to the returned stream will be appended
|
williamr@2
|
179 |
* to the content.
|
williamr@2
|
180 |
* @return reference to the RWriteStream.
|
williamr@2
|
181 |
*/
|
williamr@2
|
182 |
virtual RWriteStream& ContentWriteStreamL() = 0;
|
williamr@2
|
183 |
|
williamr@2
|
184 |
/**
|
williamr@2
|
185 |
* Checks if element matches to another element by its content and
|
williamr@2
|
186 |
* child elements. Element can contain more data than the given
|
williamr@2
|
187 |
* pattern.
|
williamr@2
|
188 |
* @since Series60 3.0
|
williamr@2
|
189 |
* @param aCandidate The pattern to be matched. Must contain same or
|
williamr@2
|
190 |
* less data for match to come true.
|
williamr@2
|
191 |
* @return ETrue if content and possible children match exactly
|
williamr@2
|
192 |
* to given pattern. EFalse otherwise.
|
williamr@2
|
193 |
*/
|
williamr@2
|
194 |
virtual TBool ConsistsOfL(MSenElement& aCandidate) = 0;
|
williamr@2
|
195 |
|
williamr@2
|
196 |
/**
|
williamr@2
|
197 |
* Getting the child elements of this element.
|
williamr@2
|
198 |
* @return an array of child elements. This is an empty array if there
|
williamr@2
|
199 |
* are no children. Any modifications made on the returned array
|
williamr@2
|
200 |
* modify the element object.
|
williamr@2
|
201 |
*/
|
williamr@2
|
202 |
virtual RPointerArray<CSenElement>& ElementsL() = 0;
|
williamr@2
|
203 |
|
williamr@2
|
204 |
/**
|
williamr@2
|
205 |
* Gets a child element from a specified index.
|
williamr@2
|
206 |
* @param aIndex: the index what to get
|
williamr@2
|
207 |
* @return child element from a current index. NULL if no child in given
|
williamr@2
|
208 |
* index is found
|
williamr@2
|
209 |
*/
|
williamr@2
|
210 |
virtual CSenElement* Child(TInt aIndex) = 0;
|
williamr@2
|
211 |
|
williamr@2
|
212 |
/**
|
williamr@2
|
213 |
* Gets the value of the given attribute.
|
williamr@2
|
214 |
* @param aName: Name of the attribute in question.
|
williamr@2
|
215 |
* @return the value of the attribute, or NULL if not found. Ownership is
|
williamr@2
|
216 |
* NOT TRANSFERRED.
|
williamr@2
|
217 |
*/
|
williamr@2
|
218 |
virtual const TDesC8* AttrValue(const TDesC8& aName) = 0;
|
williamr@2
|
219 |
|
williamr@2
|
220 |
/**
|
williamr@2
|
221 |
* Adds an attribute. If attribute is already existing,
|
williamr@2
|
222 |
* the value of the attribute will be replaced.
|
williamr@2
|
223 |
* @param aName Name of the attribute to be added.
|
williamr@2
|
224 |
* @param aValue Value of the attribute to be added.
|
williamr@2
|
225 |
*/
|
williamr@2
|
226 |
virtual void AddAttrL(const TDesC8& aName, const TDesC8& aValue) = 0;
|
williamr@2
|
227 |
|
williamr@2
|
228 |
/**
|
williamr@2
|
229 |
* Gets all the attributes of this element in an array.
|
williamr@2
|
230 |
* @return array of attributes. Array will be empty if element has
|
williamr@2
|
231 |
* no attributes.
|
williamr@2
|
232 |
*/
|
williamr@2
|
233 |
virtual RPointerArray<CSenBaseAttribute>& AttributesL() = 0;
|
williamr@2
|
234 |
|
williamr@2
|
235 |
/**
|
williamr@2
|
236 |
* Gets all the namespaces of this element in an array.
|
williamr@2
|
237 |
* @return array of namespaces. Array will be empty if element has
|
williamr@2
|
238 |
* no namespaces.
|
williamr@2
|
239 |
*/
|
williamr@2
|
240 |
virtual RPointerArray<CSenNamespace>& NamespacesL() = 0;
|
williamr@2
|
241 |
|
williamr@2
|
242 |
/**
|
williamr@2
|
243 |
* Gets the parent element of this element.
|
williamr@2
|
244 |
* @return the parent element or NULL if no parent set.
|
williamr@2
|
245 |
* Ownership is NOT transferred to the caller.
|
williamr@2
|
246 |
*/
|
williamr@2
|
247 |
virtual CSenElement* Parent() = 0;
|
williamr@2
|
248 |
|
williamr@2
|
249 |
/**
|
williamr@2
|
250 |
* Sets the parent element to this element. Notice that the element is not
|
williamr@2
|
251 |
* automatically added as a child of the parent. Parent's
|
williamr@2
|
252 |
* AddElementL() should be called instead.
|
williamr@2
|
253 |
* @param apParent: The wanted parent. Can be NULL.
|
williamr@2
|
254 |
* @return the parent element
|
williamr@2
|
255 |
*/
|
williamr@2
|
256 |
virtual CSenElement* SetParent(CSenElement* apParent) = 0;
|
williamr@2
|
257 |
|
williamr@2
|
258 |
/**
|
williamr@2
|
259 |
* Detach the element from its parent.
|
williamr@2
|
260 |
* If the element, or one of its children, is dependent
|
williamr@2
|
261 |
* on a namespace declared in the scope of the parent
|
williamr@2
|
262 |
* copy those namespace declarations to this element.
|
williamr@2
|
263 |
* @return this Element. Ownership is NOT transferred to the caller.
|
williamr@2
|
264 |
* Returns NULL if no parent was set, and nothing was detached.
|
williamr@2
|
265 |
*/
|
williamr@2
|
266 |
virtual CSenElement* DetachL() = 0;
|
williamr@2
|
267 |
|
williamr@2
|
268 |
/**
|
williamr@2
|
269 |
* Gets the root element. If no parent element, returns this element.
|
williamr@2
|
270 |
* @return the root of the tree. Ownership is not transferred.
|
williamr@2
|
271 |
*/
|
williamr@2
|
272 |
virtual MSenElement& Root() = 0;
|
williamr@2
|
273 |
|
williamr@2
|
274 |
/**
|
williamr@2
|
275 |
* Gets the child element with the specified local name.
|
williamr@2
|
276 |
* Assumes that namespace is the same as this parent element.
|
williamr@2
|
277 |
* @return the child element or NULL if the child with the specified
|
williamr@2
|
278 |
* local name is not found. Ownership is NOT transferred.
|
williamr@2
|
279 |
*/
|
williamr@2
|
280 |
virtual CSenElement* Element(const TDesC8& aLocalName) = 0;
|
williamr@2
|
281 |
|
williamr@2
|
282 |
/**
|
williamr@2
|
283 |
* Gets the child element with the specified local name and namespace URI.
|
williamr@2
|
284 |
* @return the child element or NULL if the child with the specified
|
williamr@2
|
285 |
* criterias is not found. Ownership is NOT transferred.
|
williamr@2
|
286 |
*/
|
williamr@2
|
287 |
virtual CSenElement* Element(const TDesC8& aNsUri,
|
williamr@2
|
288 |
const TDesC8& aLocalName) = 0;
|
williamr@2
|
289 |
|
williamr@2
|
290 |
/**
|
williamr@2
|
291 |
* Create a new element ready for adding or insertion.
|
williamr@2
|
292 |
* If the given namespace prefix is not declared yet
|
williamr@2
|
293 |
* the element will not be created and NULL will be returned.
|
williamr@2
|
294 |
* @param aNsPrefix: The namespace prefix
|
williamr@2
|
295 |
* @param aLocalName: The new elements localname
|
williamr@2
|
296 |
* @return the new Element just created, or NULL if given prefix was not
|
williamr@2
|
297 |
* declared yet. Ownership is transferred to the caller.
|
williamr@2
|
298 |
* Leave codes:
|
williamr@2
|
299 |
* KErrSenInvalidCharacters if aLocalName or aQName contain illegal
|
williamr@2
|
300 |
* characters.
|
williamr@2
|
301 |
* KErrSenZeroLengthDescriptor if aLocalName is zero length.
|
williamr@2
|
302 |
*/
|
williamr@2
|
303 |
virtual CSenElement* CreateElementL(const TDesC8& aNsPrefix,
|
williamr@2
|
304 |
const TDesC8& aLocalName) = 0;
|
williamr@2
|
305 |
|
williamr@2
|
306 |
/**
|
williamr@2
|
307 |
* Insert an Element into the list of children elements
|
williamr@2
|
308 |
* so that the inserted Element is placed right before the aBeforeElement.
|
williamr@2
|
309 |
* If aBeforeElement is not found, element will be appended to the last
|
williamr@2
|
310 |
* position.
|
williamr@2
|
311 |
* Function leaves if error occurs in inserting.
|
williamr@2
|
312 |
* @param aInsertedElement: the element to be inserted.
|
williamr@2
|
313 |
* Ownership is transferred.
|
williamr@2
|
314 |
* @param aBeforeElement: the element which will be right next to the
|
williamr@2
|
315 |
* element just inserted.
|
williamr@2
|
316 |
* @return the inserted Element
|
williamr@2
|
317 |
*/
|
williamr@2
|
318 |
virtual CSenElement& InsertElementL(CSenElement& aInsertedElement,
|
williamr@2
|
319 |
const CSenElement& aBeforeElement) = 0;
|
williamr@2
|
320 |
|
williamr@2
|
321 |
/**
|
williamr@2
|
322 |
* Adds an Element to the children elements.
|
williamr@2
|
323 |
* Sets this element to be the new parent of the given element.
|
williamr@2
|
324 |
* @param aElement: the element to be added. Ownership is transferred.
|
williamr@2
|
325 |
* @return the added Element
|
williamr@2
|
326 |
*/
|
williamr@2
|
327 |
virtual CSenElement& AddElementL(CSenElement& aElement) = 0;
|
williamr@2
|
328 |
|
williamr@2
|
329 |
/**
|
williamr@2
|
330 |
* Constructs and adds a new element to the children elements.
|
williamr@2
|
331 |
* Sets this element to be the new parent of the given element.
|
williamr@2
|
332 |
* @param aNsUri: namespace URI of the new element
|
williamr@2
|
333 |
* @param aLocalName: local name of the new element
|
williamr@2
|
334 |
* @return the added Element
|
williamr@2
|
335 |
* Leave codes:
|
williamr@2
|
336 |
* KErrSenInvalidCharacters if aLocalName contains illegal characters.
|
williamr@2
|
337 |
* KErrSenZeroLengthDescriptor if aLocalName is zero length.
|
williamr@2
|
338 |
*/
|
williamr@2
|
339 |
virtual CSenElement& AddElementL(const TDesC8& aNsUri,
|
williamr@2
|
340 |
const TDesC8& aLocalName) = 0;
|
williamr@2
|
341 |
|
williamr@2
|
342 |
/**
|
williamr@2
|
343 |
* Constructs and adds a new element to the children elements.
|
williamr@2
|
344 |
* Sets this element to be the new parent of the given element.
|
williamr@2
|
345 |
* @param aNsUri: namespace URI of the new element
|
williamr@2
|
346 |
* @param aLocalName: local name of the new element
|
williamr@2
|
347 |
* @param aQName: qualified name of the new element
|
williamr@2
|
348 |
* @return the added Element
|
williamr@2
|
349 |
* Leave codes:
|
williamr@2
|
350 |
* KErrSenInvalidCharacters if aLocalName or aQName contain illegal
|
williamr@2
|
351 |
* characters.
|
williamr@2
|
352 |
* KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
|
williamr@2
|
353 |
*/
|
williamr@2
|
354 |
virtual CSenElement& AddElementL(const TDesC8& aNsUri,
|
williamr@2
|
355 |
const TDesC8& aLocalName,
|
williamr@2
|
356 |
const TDesC8& aQName) = 0;
|
williamr@2
|
357 |
|
williamr@2
|
358 |
/**
|
williamr@2
|
359 |
* Constructs and adds a new element to the children elements.
|
williamr@2
|
360 |
* Sets this element to be the new parent of the given element.
|
williamr@2
|
361 |
* Note: Element is created with no specific namespace, default namespace
|
williamr@2
|
362 |
* of some of the upper level elements are in effect if there is such a
|
williamr@2
|
363 |
* namespace.
|
williamr@2
|
364 |
* @param aLocalName: local name of the new element
|
williamr@2
|
365 |
* @return the added Element
|
williamr@2
|
366 |
* Leave codes:
|
williamr@2
|
367 |
* KErrSenInvalidCharacters if aLocalName contains illegal characters.
|
williamr@2
|
368 |
* KErrSenZeroLengthDescriptor if aLocalName is zero length.
|
williamr@2
|
369 |
*/
|
williamr@2
|
370 |
virtual CSenElement& AddElementL(const TDesC8& aLocalName) = 0;
|
williamr@2
|
371 |
|
williamr@2
|
372 |
/**
|
williamr@2
|
373 |
* Remove an element from the childs.
|
williamr@2
|
374 |
* @param aElement: the element to be removed.
|
williamr@2
|
375 |
* @return The removed element. May be NULL if nothing was removed
|
williamr@2
|
376 |
* (if element was not found from the childs).
|
williamr@2
|
377 |
* The caller TAKES OWNERSHIP of the removed element.
|
williamr@2
|
378 |
*/
|
williamr@2
|
379 |
virtual CSenElement* RemoveElement(CSenElement& aElement) = 0;
|
williamr@2
|
380 |
|
williamr@2
|
381 |
/**
|
williamr@2
|
382 |
* Remove an element from the childs.
|
williamr@2
|
383 |
* @param aNsUri: the namespace URI of the element to be removed.
|
williamr@2
|
384 |
* @param aLocalName: the local name of the element to be removed.
|
williamr@2
|
385 |
* @return The removed element. May be NULL if nothing was removed
|
williamr@2
|
386 |
* (if element was not found from the childs).
|
williamr@2
|
387 |
* The caller TAKES OWNERSHIP of the removed element.
|
williamr@2
|
388 |
*/
|
williamr@2
|
389 |
virtual CSenElement* RemoveElement( const TDesC8& aNsUri,
|
williamr@2
|
390 |
const TDesC8& aLocalName) = 0;
|
williamr@2
|
391 |
|
williamr@2
|
392 |
/**
|
williamr@2
|
393 |
* Remove an element from the childs.
|
williamr@2
|
394 |
* @param aLocalName: the local name of the element to be removed.
|
williamr@2
|
395 |
* @return The removed element. May be NULL if nothing was removed
|
williamr@2
|
396 |
* (if element was not found from the childs).
|
williamr@2
|
397 |
* The caller TAKES OWNERSHIP of the removed element.
|
williamr@2
|
398 |
*/
|
williamr@2
|
399 |
virtual CSenElement* RemoveElement(const TDesC8& aLocalName) = 0;
|
williamr@2
|
400 |
|
williamr@2
|
401 |
/**
|
williamr@2
|
402 |
* Replaces an element from the childs with another element.
|
williamr@2
|
403 |
* Element's local name and namespace URI will be used to match the
|
williamr@2
|
404 |
* element to be replaced. If matching element is not found, will
|
williamr@2
|
405 |
* normally add the given element to the childs.
|
williamr@2
|
406 |
*
|
williamr@2
|
407 |
* @param aElement: the element to be added. Ownership is transferred.
|
williamr@2
|
408 |
* @return The old element. May be NULL if nothing was replaced
|
williamr@2
|
409 |
* (if element was not found from the childs).
|
williamr@2
|
410 |
* The caller TAKES OWNERSHIP of the old element.
|
williamr@2
|
411 |
*/
|
williamr@2
|
412 |
virtual CSenElement* ReplaceElementL(CSenElement& aElement) = 0;
|
williamr@2
|
413 |
|
williamr@2
|
414 |
/**
|
williamr@2
|
415 |
* Gets element as an UTF-8 form XML.
|
williamr@2
|
416 |
* @return element as XML (in UTF-8 format). Caller takes ownership.
|
williamr@2
|
417 |
*/
|
williamr@2
|
418 |
virtual HBufC8* AsXmlL() = 0;
|
williamr@2
|
419 |
|
williamr@2
|
420 |
/**
|
williamr@2
|
421 |
* Gets the element as XML fragment in Unicode UCS2 format.
|
williamr@2
|
422 |
* @since Series60 3.0
|
williamr@2
|
423 |
* @return the service description as XML, which ownership is
|
williamr@2
|
424 |
* transferred to the caller.
|
williamr@2
|
425 |
*/
|
williamr@2
|
426 |
virtual HBufC* AsXmlUnicodeL() = 0;
|
williamr@2
|
427 |
|
williamr@2
|
428 |
/**
|
williamr@2
|
429 |
* Writes this element as XML, in UTF-8 form to a stream
|
williamr@2
|
430 |
* @since Series60 3.0
|
williamr@2
|
431 |
* @param aWriteStream to write into.
|
williamr@2
|
432 |
*/
|
williamr@2
|
433 |
virtual void WriteAsXMLToL(RWriteStream& aWriteStream) = 0;
|
williamr@2
|
434 |
|
williamr@2
|
435 |
/**
|
williamr@2
|
436 |
* Element writes its namespaces to a write stream using UTF-8 charset
|
williamr@2
|
437 |
* encoding.
|
williamr@2
|
438 |
*
|
williamr@2
|
439 |
* @param aWriteStream: The stream to write to.
|
williamr@2
|
440 |
*/
|
williamr@2
|
441 |
virtual void WriteNamespacesToL(RWriteStream& aWriteStream) = 0;
|
williamr@2
|
442 |
|
williamr@2
|
443 |
/**
|
williamr@2
|
444 |
* Gets the current element as XML element. Mostly used to get the
|
williamr@2
|
445 |
* classes which implement this interface as an instance of this
|
williamr@2
|
446 |
* interface.
|
williamr@2
|
447 |
* @return the current object as element. Ownership is NOT transferred.
|
williamr@2
|
448 |
*/
|
williamr@2
|
449 |
virtual MSenElement* AsElement() = 0;
|
williamr@2
|
450 |
|
williamr@2
|
451 |
/**
|
williamr@2
|
452 |
* Copies content from given element to this element appending to the
|
williamr@2
|
453 |
* existing content if there is any.
|
williamr@2
|
454 |
* @param aSource: The source element.
|
williamr@2
|
455 |
*/
|
williamr@2
|
456 |
virtual void CopyFromL(CSenElement& aSource) = 0;
|
williamr@2
|
457 |
|
williamr@2
|
458 |
/**
|
williamr@2
|
459 |
* (Re-) Set the name and namespace of this Element. The element will be
|
williamr@2
|
460 |
* given the localName in the the given namespace. A prefix will be
|
williamr@2
|
461 |
* computed from the qualified name.
|
williamr@2
|
462 |
*
|
williamr@2
|
463 |
* This method should be used with care and is mainly intended for
|
williamr@2
|
464 |
* protected use in implementations.
|
williamr@2
|
465 |
*
|
williamr@2
|
466 |
* @param aNamespaceURI: The new namespace URI.
|
williamr@2
|
467 |
* @param aLocalName: The new local name.
|
williamr@2
|
468 |
* @param aQName: The new qualified name.
|
williamr@2
|
469 |
*/
|
williamr@2
|
470 |
virtual void Set(const TDesC8& aNamespaceURI,
|
williamr@2
|
471 |
const TDesC8& aLocalName,
|
williamr@2
|
472 |
const TDesC8& aQName) = 0;
|
williamr@2
|
473 |
|
williamr@2
|
474 |
/**
|
williamr@2
|
475 |
* Adds new attributes to the element.
|
williamr@2
|
476 |
* @param aAttrs: the array of attributes.
|
williamr@2
|
477 |
*/
|
williamr@2
|
478 |
virtual void AddAttributesL(const RAttributeArray& aAttrs) = 0;
|
williamr@2
|
479 |
|
williamr@2
|
480 |
};
|
williamr@2
|
481 |
|
williamr@2
|
482 |
#endif // M_SEN_ELEMENT_H
|
williamr@2
|
483 |
|
williamr@2
|
484 |
// End of File
|
williamr@2
|
485 |
|
williamr@2
|
486 |
|