45 class MXmlEngUserData; |
41 class MXmlEngUserData; |
46 class TXmlEngBinaryContainer; |
42 class TXmlEngBinaryContainer; |
47 class TXmlEngChunkContainer; |
43 class TXmlEngChunkContainer; |
48 class TXmlEngDataContainer; |
44 class TXmlEngDataContainer; |
49 class TXmlEngFileContainer; |
45 class TXmlEngFileContainer; |
50 // |
|
51 |
46 |
52 /** |
47 /** |
53 * Instance of TXmlEngNode class represents an XML node in the DOM tree. |
48 This class represents an XML node in the DOM tree. |
54 * |
49 |
55 * Class implements methods that are similar for all XML node types |
50 As the base class for other node types (element, attribute, etc.) this class |
56 * i.e. element, attribute. |
51 implements common methods that are similar for all XML node types. |
57 * |
52 |
58 * Sample code for node tree modifications: |
53 Sample code for tree manipulations: |
59 * @code |
54 @code |
60 * RXmlEngDOMImplementation domImpl; |
55 RXmlEngDOMImplementation domImpl; |
61 * domImpl.OpenL(); ///< opening DOM implementation object |
56 domImpl.OpenL(); // opening DOM implementation object |
62 * RXmlEngDocument iDoc; ///< iDoc with created nodes tree |
57 RXmlEngDocument iDoc; // iDoc with created nodes tree |
63 * TXmlEngNode tmp = iDoc.DocumentElement(); |
58 TXmlEngNode tmp = iDoc.DocumentElement(); |
64 * ///< copying first child of iDoc to tmp2 node and appending it |
59 // copying first child of iDoc to tmp2 node and appending it |
65 * TXmlEngNode tmp2 = tmp.FirstChild().CopyL(); |
60 TXmlEngNode tmp2 = tmp.FirstChild().CopyL(); |
66 * tmp.AppendChildL(tmp2); |
61 tmp.AppendChildL(tmp2); |
67 * ///< copying next node to the first child of iDoc to the last child place |
62 // copying the second child of iDoc to the last child |
68 * tmp.FirstChild().NextSibling().CopyToL(tmp.LastChild()); |
63 tmp.FirstChild().NextSibling().CopyToL(tmp.LastChild()); |
69 * ///< replasing before last child with second child |
64 // replacing the second to last child with the second child |
70 * tmp.LastChild().PreviousSibling().ReplaceWith(tmp.FirstChild().NextSibling()); |
65 tmp.LastChild().PreviousSibling().ReplaceWith(tmp.FirstChild().NextSibling()); |
71 * ///< moving first child of iDoc to second child childrens |
66 // moving first child of iDoc to second child's children |
72 * tmp.FirstChild().MoveTo(tmp.FirstChild().NextSibling()); |
67 tmp.FirstChild().MoveTo(tmp.FirstChild().NextSibling()); |
73 * iDoc.Close(); ///< closing all opened objects |
68 iDoc.Close(); // closing all opened objects |
74 * domImpl.Close(); |
69 domImpl.Close(); |
75 * @endcode |
70 @endcode |
76 * |
71 |
77 * @lib XmlEngineDOM.lib |
72 A node is NULL when the internal data pointer is NULL. This is the default |
78 * @since S60 v3.1 |
73 state of a newly created node. Many DOM APIs that return TXmlEngNode objects |
79 */ |
74 use this NULL state to indicate a failure of some kind. The methods IsNull() |
|
75 and NotNull() can be used to determine whether a node is NULL. |
|
76 */ |
80 class TXmlEngNode |
77 class TXmlEngNode |
81 { |
78 { |
82 public: |
79 public: |
83 /** |
80 /** |
84 * The different element types carried by an XML tree. |
81 The different node types in a XML tree. |
85 * |
82 */ |
86 * @note This is synchronized with DOM Level 3 values |
|
87 * See http://www.w3.org/TR/DOM-Level-3-Core/ |
|
88 * |
|
89 */ |
|
90 enum TXmlEngDOMNodeType { |
83 enum TXmlEngDOMNodeType { |
91 EElement = 1, |
84 EElement = 1, |
92 EAttribute = 2, |
85 EAttribute = 2, |
93 EText = 3, |
86 EText = 3, |
94 ECDATASection = 4, |
87 ECDATASection = 4, |
95 EEntityReference = 5, |
88 EEntityReference = 5, |
96 EEntity = 6, //> Not supported currently |
89 /** Not supported */ |
|
90 EEntity = 6, |
97 EProcessingInstruction = 7, |
91 EProcessingInstruction = 7, |
98 EComment = 8, |
92 EComment = 8, |
99 EDocument = 9, |
93 EDocument = 9, |
100 EDocumentType = 10, //> Not supported currently |
94 /** Not supported */ |
|
95 EDocumentType = 10, |
101 EDocumentFragment = 11, |
96 EDocumentFragment = 11, |
102 ENotation = 12, //> Not supported currently |
97 /** Not supported */ |
103 ENamespaceDeclaration = 18, //> Not in DOM spec |
98 ENotation = 12, |
104 EBinaryContainer = 30, //> Not in DOM spec |
99 /** Extension to the DOM spec */ |
105 EChunkContainer = 31, //> Not in DOM spec |
100 ENamespaceDeclaration = 18, |
106 EFileContainer = 32 //> Not in DOM spec |
101 /** Extension to the DOM spec */ |
|
102 EBinaryContainer = 30, |
|
103 /** Extension to the DOM spec */ |
|
104 EChunkContainer = 31, |
|
105 /** Extension to the DOM spec */ |
|
106 EFileContainer = 32 |
107 }; |
107 }; |
108 |
108 |
109 public: |
109 public: |
110 /** |
110 /** Default constructor */ |
111 * Default constructor |
|
112 * |
|
113 * @since S60 v3.1 |
|
114 */ |
|
115 inline TXmlEngNode(); |
111 inline TXmlEngNode(); |
116 |
112 |
117 /** |
113 /** |
118 * Constructor |
114 Constructor |
119 * |
115 @param aInternal node pointer |
120 * @since S60 v3.1 |
116 */ |
121 * @param aInternal node pointer |
|
122 */ |
|
123 inline TXmlEngNode(void* aInternal); |
117 inline TXmlEngNode(void* aInternal); |
124 |
118 |
125 /** |
119 /** |
126 * Check if node is NULL |
120 Check if the node is NULL |
127 * |
121 @return ETrue if node is NULL, otherwise EFalse |
128 * @since S60 v3.1 |
122 */ |
129 * @return TRUE if node is NULL in other case FALSE |
|
130 */ |
|
131 inline TBool IsNull() const; |
123 inline TBool IsNull() const; |
132 |
124 |
133 /** |
125 /** |
134 * Check if node is NULL |
126 Check if node is not NULL |
135 * |
127 @return ETrue if node is not NULL, otherwise EFalse |
136 * @since S60 v3.1 |
128 */ |
137 * @return TRUE if node is not NULL in other case FALSE |
129 inline TBool NotNull() const; |
138 */ |
130 |
139 inline TBool NotNull()const; |
131 /** |
140 |
132 Cast to an attribute node. |
141 /** |
133 Note: |
142 * Cast node to attribute node. |
134 - Never cast nodes to the wrong node type! |
143 * |
135 - Casting removes the const'ness of the node |
144 * @since S60 v3.1 |
136 @return This node as an attribute node |
145 * @return Attribute node |
137 */ |
146 * |
138 inline TXmlEngAttr& AsAttr() const; |
147 * @note |
139 |
148 * - Never cast nodes to a wrong node type! |
140 /** |
149 * - Casting removes const'ness of the node |
141 Cast to a text node. |
150 */ |
142 Note: |
151 inline TXmlEngAttr& AsAttr() const; |
143 - Never cast nodes to the wrong node type! |
152 |
144 - Casting removes the const'ness of the node |
153 /** |
145 @return This node as a text node |
154 * Cast node to text node. |
146 */ |
155 * |
147 inline TXmlEngTextNode& AsText() const; |
156 * @since S60 v3.1 |
148 |
157 * @return Text node |
149 /** |
158 * |
150 Cast to a binary data container |
159 * @note |
151 Note: |
160 * - Never cast nodes to a wrong node type! |
152 - Never cast nodes to the wrong node type! |
161 * - Casting removes const'ness of the node |
153 - Casting removes the const'ness of the node |
162 */ |
154 @return This node as a binary container |
163 inline TXmlEngTextNode& AsText() const; |
155 */ |
164 |
156 inline TXmlEngBinaryContainer& AsBinaryContainer() const; |
165 /** |
157 |
166 * Cast node to binary data container |
158 /** |
167 * |
159 Cast to a memory chunk container |
168 * @since S60 v3.2 |
160 Note: |
169 * @return Binary container |
161 - Never cast nodes to the wrong node type! |
170 * |
162 - Casting removes the const'ness of the node |
171 * @note |
163 @return This node as a chunk container |
172 * - Never cast nodes to a wrong node type! |
164 */ |
173 * - Casting removes const'ness of the node |
165 inline TXmlEngChunkContainer& AsChunkContainer() const; |
174 */ |
166 |
175 inline TXmlEngBinaryContainer& AsBinaryContainer() const; |
167 /** |
176 |
168 Cast to a file container |
177 /** |
169 Note: |
178 * Cast node to memory chunk container |
170 - Never cast nodes to the wrong node type! |
179 * |
171 - Casting removes the const'ness of the node |
180 * @since S60 v3.2 |
172 @return This node as a file container |
181 * @return Chunk container |
173 */ |
182 * |
174 inline TXmlEngFileContainer& AsFileContainer() const; |
183 * @note |
175 |
184 * - Never cast nodes to a wrong node type! |
176 /** |
185 * - Casting removes const'ness of the node |
177 Cast to a memory chunk container |
186 */ |
178 Note: |
187 inline TXmlEngChunkContainer& AsChunkContainer() const; |
179 - Never cast nodes to the wrong node type! |
188 |
180 - Casting removes the const'ness of the node |
189 /** |
181 @return This node as a chunk container |
190 * Cast node to file container |
182 */ |
191 * |
183 inline TXmlEngDataContainer& AsDataContainer() const; |
192 * @since S60 v3.2 |
184 |
193 * @return File container |
185 /** |
194 * |
186 Cast to an element node. |
195 * @note |
187 Note: |
196 * - Never cast nodes to a wrong node type! |
188 - Never cast nodes to the wrong node type! |
197 * - Casting removes const'ness of the node |
189 - Casting removes the const'ness of the node |
198 */ |
190 @return This node as an element node |
199 inline TXmlEngFileContainer& AsFileContainer() const; |
191 */ |
200 |
|
201 /** |
|
202 * Cast node to memory chunk container |
|
203 * |
|
204 * @since S60 v3.1 |
|
205 * @return Chunk container |
|
206 * |
|
207 * @note |
|
208 * - Never cast nodes to a wrong node type! |
|
209 * - Casting removes const'ness of the node |
|
210 */ |
|
211 inline TXmlEngDataContainer& AsDataContainer() const; |
|
212 |
|
213 /** |
|
214 * Cast node to element node. |
|
215 * |
|
216 * @since S60 v3.1 |
|
217 * @return Element node |
|
218 * |
|
219 * @note |
|
220 * - Never cast nodes to a wrong node type! |
|
221 * - Casting removes const'ness of the node |
|
222 */ |
|
223 inline TXmlEngElement& AsElement() const; |
192 inline TXmlEngElement& AsElement() const; |
224 |
193 |
225 /** |
194 /** |
226 * Cast node to comment node. |
195 Cast to a comment node. |
227 * |
196 Note: |
228 * @since S60 v3.1 |
197 - Never cast nodes to the wrong node type! |
229 * @return Comment node |
198 - Casting removes the const'ness of the node |
230 * |
199 @return This node as a comment node |
231 * @note |
200 */ |
232 * - Never cast nodes to a wrong node type! |
|
233 * - Casting removes const'ness of the node |
|
234 */ |
|
235 inline TXmlEngComment& AsComment() const; |
201 inline TXmlEngComment& AsComment() const; |
236 |
202 |
237 /** |
203 /** |
238 * Cast node to namespace node. |
204 Cast to a namespace node. |
239 * |
205 Note: |
240 * @since S60 v3.1 |
206 - Never cast nodes to the wrong node type! |
241 * @return Namespace node |
207 - Casting removes the const'ness of the node |
242 * |
208 @return This node as a namespace node |
243 * @note |
209 */ |
244 * - Never cast nodes to a wrong node type! |
|
245 * - Casting removes const'ness of the node |
|
246 */ |
|
247 inline TXmlEngNamespace& AsNamespace() const; |
210 inline TXmlEngNamespace& AsNamespace() const; |
248 |
211 |
249 /** |
212 /** |
250 * Cast node to CDATA section node. |
213 Cast to a CDATA section node. |
251 * |
214 Note: |
252 * @since S60 v3.1 |
215 - Never cast nodes to the wrong node type! |
253 * @return CDATA section node |
216 - Casting removes the const'ness of the node |
254 * |
217 @return This node as a CDATA section node |
255 * @note |
218 */ |
256 * - Never cast nodes to a wrong node type! |
|
257 * - Casting removes const'ness of the node |
|
258 */ |
|
259 inline TXmlEngCDATASection& AsCDATASection() const; |
219 inline TXmlEngCDATASection& AsCDATASection() const; |
260 |
220 |
261 /** |
221 /** |
262 * Cast node to entity reference node. |
222 Cast to an entity reference node. |
263 * |
223 Note: |
264 * @since S60 v3.1 |
224 - Never cast nodes to the wrong node type! |
265 * @return Entity reference node |
225 - Casting removes the const'ness of the node |
266 * |
226 @return This node as an entity reference node |
267 * @note |
227 */ |
268 * - Never cast nodes to a wrong node type! |
|
269 * - Casting removes const'ness of the node |
|
270 */ |
|
271 inline TXmlEngEntityReference& AsEntityReference() const; |
228 inline TXmlEngEntityReference& AsEntityReference() const; |
272 |
229 |
273 /** |
230 /** |
274 * Cast node to processing instruction node. |
231 Cast to a Document Fragment. |
275 * |
232 Note: |
276 * @since S60 v3.1 |
233 - Never cast nodes to the wrong node type! |
277 * @return Processing instruction node |
234 - Casting removes the const'ness of the node |
278 * |
235 @return This node as a Document Fragment |
279 * @note |
236 */ |
280 * - Never cast nodes to a wrong node type! |
237 inline TXmlEngDocumentFragment& AsDocumentFragment() const; |
281 * - Casting removes const'ness of the node |
238 |
282 */ |
239 /** |
|
240 Cast to a processing instruction node. |
|
241 Note: |
|
242 - Never cast nodes to the wrong node type! |
|
243 - Casting removes the const'ness of the node |
|
244 @return This node as a Processing instruction node |
|
245 */ |
283 inline TXmlEngProcessingInstruction& AsProcessingInstruction() const; |
246 inline TXmlEngProcessingInstruction& AsProcessingInstruction() const; |
284 |
247 |
285 /** |
248 /** |
286 * Get innerXML string. This method returns all content of the node. |
249 Get the inner XML string. This method returns all content of the node, |
287 * Output text does not include node markup. |
250 exluding node markup. Child nodes will be included. Any existing contents |
288 * |
251 in aBuffer will be destroyed. This method allocates memory for the buffer. |
289 * @since S60 v3.1 |
252 |
290 * @param aBuffer RBuf8 in which output should be save |
253 @param aBuffer A buffer owned by the caller that contains the result |
291 * @return Size of output buffer |
254 @return Length of the output buffer |
292 * @note Returned RBuf8 should be freed |
255 @leave KXmlEngErrWrongUseOfAPI Node is NULL |
293 */ |
256 @leave - One of the system-wide error codes |
|
257 */ |
294 IMPORT_C TInt InnerXmlL(RBuf8& aBuffer); |
258 IMPORT_C TInt InnerXmlL(RBuf8& aBuffer); |
295 |
259 |
296 /** |
260 /** |
297 * Get outerXML string. This method returns all content of the node. |
261 Get the outer XML string. This method returns all content of the node, |
298 * Output text includes node markup. |
262 including node markup. Child nodes will be included. Any existing |
299 * |
263 contents in aBuffer will be destroyed. This method allocates memory for |
300 * @since S60 v3.1 |
264 the buffer. |
301 * @param aBuffer RBuf8 in which output should be save |
265 |
302 * @return Size of output buffer |
266 @param aBuffer A buffer owned by the caller that contains the result |
303 * @note Returned RBuf8 should be freed |
267 @return Length of the output buffer |
304 */ |
268 @leave KXmlEngErrWrongUseOfAPI Node is NULL |
|
269 @leave KXmlEngErrNegativeOutputSize Output has a negative length |
|
270 @leave - One of the system-wide error codes |
|
271 */ |
305 IMPORT_C TInt OuterXmlL(RBuf8& aBuffer); |
272 IMPORT_C TInt OuterXmlL(RBuf8& aBuffer); |
306 |
273 |
307 /** |
274 /** |
308 * Moves the node to become the first in the list of its siblings |
275 Moves the node to become the first in the list of its siblings |
309 * Node is expected to have a parent. |
276 @pre The node has a parent |
310 * |
277 */ |
311 * @since S60 v3.1 |
|
312 */ |
|
313 IMPORT_C void SetAsFirstSibling(); |
278 IMPORT_C void SetAsFirstSibling(); |
314 |
279 |
315 /** |
280 /** |
316 * Moves the node to become the last in the list of its siblings |
281 Moves the node to become the last in the list of its siblings |
317 * Node is expected to have a parent. |
282 @pre The node has a parent. |
318 * |
283 */ |
319 * @since S60 v3.1 |
|
320 */ |
|
321 IMPORT_C void SetAsLastSibling(); |
284 IMPORT_C void SetAsLastSibling(); |
322 |
285 |
323 /** |
286 /** |
324 * Moves the node in the list of sibling nodes before another node |
287 Moves the node to come before the specified node in the list of sibling |
325 * Node is expected to have a parent. |
288 nodes. This method does nothing if aSiblingNode is not one of the node's |
326 * Do nothing if aSiblingNode is not one of node's siblings |
289 siblings. |
327 * |
290 @pre The node has a parent. |
328 * @since S60 v3.1 |
291 @param aSiblingNode The node is moved to fall before this sibling |
329 * @param aSiblingNode Node that should be after current node |
292 */ |
330 */ |
|
331 IMPORT_C void MoveBeforeSibling(TXmlEngNode aSiblingNode); |
293 IMPORT_C void MoveBeforeSibling(TXmlEngNode aSiblingNode); |
332 |
294 |
333 /** |
295 /** |
334 * Moves the node in the list of sibling nodes after another node |
296 Moves the node to come after the specified node in the list of sibling |
335 * Node is expected to have a parent. |
297 nodes. This method does nothing if aSiblingNode is not one of the node's |
336 * Do nothing if aSiblingNode is not one of the node's siblings |
298 siblings. |
337 * |
299 @pre The node has a parent |
338 * @since S60 v3.1 |
300 @param aSiblingNode The node is moved to fall after this sibling |
339 * @param aSiblingNode Node that should be after current node |
301 */ |
340 */ |
|
341 IMPORT_C void MoveAfterSibling(TXmlEngNode aSiblingNode); |
302 IMPORT_C void MoveAfterSibling(TXmlEngNode aSiblingNode); |
342 |
303 |
343 /** |
304 /** |
344 * Moves the node to another part of the tree or another document |
305 Moves the node to another part of the tree or to another document. The |
345 * The node is unliked from current postion (if any) and appended |
306 node is unlinked from its current postion (if any) and appended to its new |
346 * to the its new parent. |
307 parent. |
347 * |
308 |
348 * @since S60 v3.1 |
309 Note: In many cases this method call should be followed by a call to |
349 * @param aParent Parent node |
310 ReconcileNamespacesL(). |
350 * @return Node handle |
311 |
351 * |
312 @param aParent This node will be moved to be a child of this node |
352 * @note |
313 @return This node |
353 * In many cases this method call should be followed by ReconcileNamespacesL() on the moved node |
314 @leave KXmlEngErrNullNode The node is NULL |
354 */ |
315 @leave - One of the system-wide error codes |
355 inline TXmlEngNode MoveTo(TXmlEngNode aParent); |
316 */ |
356 |
317 inline TXmlEngNode MoveToL(TXmlEngNode aParent); |
357 /** |
318 |
358 * Detaches a node from document tree |
319 /** |
359 * |
320 Moves the node to another part of the tree or to another document. The |
360 * @since S60 v3.1 |
321 node is unlinked from its current postion (if any) and appended to its new |
361 * @return This node, which is already not a part of any document |
322 parent. |
362 * @note Remember to use ReconcileNamespacesL() later, if extracted node (subtree) |
323 |
363 * contains references to namespace declarations outside of the subtree. |
324 Note: In many cases this method call should be followed by a call to |
364 * @see ReconcileNamespacesL() |
325 ReconcileNamespacesL(). |
365 * @note The document, from which the is being unlinked, becomes an owner of the node |
326 |
366 * until it is linked elsewhere. |
327 @see ReconcileNamespacesL() |
367 */ |
328 @param aParent This node will be moved to be a child of this node |
|
329 @return This node |
|
330 @leave KXmlEngErrNullNode The node is NULL |
|
331 @leave - One of the system-wide error codes |
|
332 |
|
333 @deprecated This method has been deprecated and will be removed in a future |
|
334 release. |
|
335 */ |
|
336 inline TXmlEngNode MoveTo(TXmlEngNode aParent); |
|
337 |
|
338 /** |
|
339 Detaches the node from the document tree. The document maintains ownership |
|
340 of the node until it is linked elsewhere. |
|
341 |
|
342 Note: Remember to use ReconcileNamespacesL() later, if the extracted node |
|
343 (or subtree) contains references to namespace declarations outside of the |
|
344 subtree. |
|
345 |
|
346 @see ReconcileNamespacesL() |
|
347 @return This node |
|
348 */ |
368 IMPORT_C TXmlEngNode Unlink(); |
349 IMPORT_C TXmlEngNode Unlink(); |
369 |
350 |
370 /** |
351 /** |
371 * Ensures that namespaces referred to in the node and its descendants are |
352 Ensures that namespaces referred to in the node and its descendants are |
372 * in the scope the node. |
353 within the scope of the node. |
373 * |
354 |
374 * This method checks that all the namespaces declared within the given |
355 This method checks that all the namespaces declared within the subtree |
375 * tree are properly declared. This is needed for example after Copy or Unlink |
356 parented by this node are properly declared. This is needed for example |
376 * and then Append operations. The subtree may still hold pointers to |
357 after a Copy or an Unlink followed by an Append operation. The subtree may |
377 * namespace declarations outside the subtree or they may be invalid/masked. As much |
358 still hold pointers to namespace declarations outside the subtree or they |
378 * as possible the function try to reuse the existing namespaces found in |
359 may be invalid/masked. The function tries to reuse the existing namespaces |
379 * the new environment. If not possible, the new namespaces are redeclared |
360 found in the new environment as much as possible. If not possible, the new |
380 * on the top of the subtree. |
361 namespaces are redeclared at the top of the subtree. |
381 * |
362 |
382 * This method should be used after unlinking nodes and inserting to another |
363 This method should be used after unlinking nodes and inserting them into |
383 * document tree or to a another part of the original tree, if some nodes of the subtree |
364 another document tree or into another part of the original tree, if some |
384 * are remove from the scope of a namespace declaration they refer to. |
365 nodes of the subtree are removed from the scope of the namespace |
385 * |
366 declaration they refer to. |
386 * When node is unlinked, it may still refer to namespace declarations from the previous location. |
367 |
387 * It is important to reconcile subtree's namespaces if previous parent tree is to be destroyed. |
368 When a node is unlinked, it may still refer to namespace declarations from |
388 * On the other hand, if the parent tree is not changed before pasting its unlinked part into another |
369 the previous location. It is important to reconcile the subtree's |
389 * tree, then reconciliation is needed only after paste operation. |
370 namespaces if the previous parent tree is to be destroyed. On the other |
390 * |
371 hand, if the parent tree is not changed before pasting its unlinked part |
391 * @since S60 v3.1 |
372 into another tree, then reconciliation is needed only after the paste |
392 */ |
373 operation. |
393 IMPORT_C void ReconcileNamespacesL(); |
374 @leave - One of the system-wide error codes |
394 |
375 */ |
395 /** |
376 IMPORT_C void ReconcileNamespacesL(); |
396 * Unlinks the node and destroys it; all child nodes are destroyed as well and all memory is freed |
377 |
397 * |
378 /** |
398 * @note Document nodes cannot be "removed" with this method, uses RXmlEngDocument-specific methods. |
379 Unlinks this node and destroys it; all child nodes are also destroyed and |
399 * |
380 all memory is freed. |
400 * @since S60 v3.1 |
381 |
401 */ |
382 Note: Document nodes cannot be removed with this method. Use |
402 IMPORT_C void Remove(); |
383 RXmlEngDocument::Close() instead. |
403 |
384 */ |
404 /** |
385 IMPORT_C void Remove(); |
405 * Current node is replaced with another node (subtree). |
386 |
406 * |
387 /** |
407 * The replacement node is linked into document tree instead of this node. |
388 This node is replaced with another node (or subtree). The replacement node |
408 * The replaced node is destroyed. |
389 is linked into the document tree instead of this node. The replaced node |
409 * |
390 is destroyed. Replacement of a node with a NULL TXmlEngNode is legal and |
410 * @since S60 v3.1 |
391 equivalent to removing the node. |
411 * @param aNode Node that repleace current node |
392 |
412 * |
393 aNode is unlinked from its previous location, which can be none (i.e. not |
413 * @see SubstituteFor(TXmlEngNode) |
394 linked), within the same document tree, or within another document tree. |
414 * |
395 |
415 * In both cases the argument node is unlinked from its previous location |
396 Note: Not applicable to document nodes. |
416 * (which can be NONE, i.e. not linked; SAME or ANOTHER document tree). |
397 |
417 * |
398 @see SubstituteForL(TXmlEngNode) |
418 * @note Replacement of a node with NULL TXmlEngNode is legal and equivalent to removing the node. |
399 @param aNode Node that replaces this node |
419 * @note Not applicable to document nodes |
400 @leave KXmlEngErrNullNode Node is NULL |
420 */ |
401 @leave KXmlEngErrWrongUseOfAPI Node is a document node |
|
402 @leave - One of the system-wide error codes |
|
403 */ |
|
404 IMPORT_C void ReplaceWithL(TXmlEngNode aNode); |
|
405 |
|
406 /** |
|
407 This node is replaced with another node (or subtree). The replacement node |
|
408 is linked into the document tree instead of this node. The replaced node |
|
409 is destroyed. Replacement of a node with a NULL TXmlEngNode is legal and |
|
410 equivalent to removing the node. |
|
411 |
|
412 aNode is unlinked from its previous location, which can be none (i.e. not |
|
413 linked), within the same document tree, or within another document tree. |
|
414 |
|
415 Note: Not applicable to document nodes. |
|
416 |
|
417 @see SubstituteForL(TXmlEngNode) |
|
418 @param aNode Node that replaces this node |
|
419 @deprecated This method has been deprecated and will be removed in a future |
|
420 release. |
|
421 */ |
421 IMPORT_C void ReplaceWith(TXmlEngNode aNode); |
422 IMPORT_C void ReplaceWith(TXmlEngNode aNode); |
422 |
423 |
423 /** |
424 /** |
424 * Another node is put instead of the current node. |
425 Unlinks this node and puts another in its place. This function is the same |
425 * |
426 as ReplaceWithL(), but this node is not freed. |
426 * Does the same as ReplaceWith(TXmlEngNode) but does not free node and just returns it. |
427 |
427 * |
428 aNode is unlinked from its previous location, which can be none (i.e. not |
428 * @since S60 v3.1 |
429 linked), within the same document tree, or within another document tree. |
429 * @param aNode Node that repleace current node |
430 |
430 * @return Current node after unlinking it from document tree |
431 It is possible to use a NULL TXmlEngNode object as an argument. In this |
431 * @see ReplaceWith(TXmlEngNode) |
432 case, this node will simply be removed from the tree, but not freed. |
432 * |
433 |
433 * In both cases the argument node is unlinked from its previous location |
434 Note: Not applicable to document nodes. |
434 * (which can be NONE, i.e. not linked; SAME or ANOTHER document tree) |
435 |
435 * |
436 @see ReplaceWithL() |
436 * It is possible to use NULL TXmlEngNode object as an argument. In such case |
437 @param aNode Node that replaces current node |
437 * no new node will be put instead of unlinked one. |
438 @return The current node after unlinking it from document tree |
438 * |
439 @leave KXmlEngErrNullNode Node is NULL |
439 * @note Not applicable to document nodes |
440 @leave KXmlEngErrWrongUseOfAPI Node is a document node |
440 */ |
441 @leave - One of the system-wide error codes |
|
442 */ |
441 IMPORT_C TXmlEngNode SubstituteForL(TXmlEngNode aNode); |
443 IMPORT_C TXmlEngNode SubstituteForL(TXmlEngNode aNode); |
442 |
444 |
443 /** |
445 /** |
444 * Retrieves a "handle" for namespace declaration that applies to the node's namespace |
446 Retrieves the namespace declaration that applies to the node's namespace |
445 * Note: DOM specs do not consider namespace declarations as a kind of nodes |
447 |
446 * This API adds TXmlEngNamespace type of nodes, which is derived from TXmlEngNode. |
448 Note: The DOM spec does not consider namespace declarations as a kind of |
447 * |
449 node. This API adds TXmlEngNamespace, which is derived from TXmlEngNode. |
448 * @since S60 v3.1 |
450 |
449 * @return Object that represents namespace declaration and prefix binding that |
451 @return The namespace declaration and prefix binding that act on the node; |
450 * act on the node; returns NULL object (check using TXmlEngNamespace.IsNull() |
452 returns a NULL object if no namespace associated |
451 * or TXmlEngNamespace.NotNull()) if no namespace associated |
453 */ |
452 */ |
454 IMPORT_C TXmlEngNamespace NamespaceDeclaration() const; |
453 IMPORT_C TXmlEngNamespace NamespaceDeclaration() const; |
455 |
454 |
456 /** |
455 /** |
457 Attaches a user data object to this node. The ownership of the object is |
456 * Attaches a user data object to this node. The ownership of the object is transferred. |
458 transferred. When the node is deleted, the Destroy method of the |
457 * When the (underlying) node is deleted the Destroy method of the MXmlEngUserData class will be |
459 MXmlEngUserData class will be called. If there is a user data object |
458 * called. If there already is a user data object associated with this node, it will be |
460 already associated with this node, it will be deleted before attaching the |
459 * deleted before attaching the new object. |
461 new object. |
460 * |
462 |
461 * @since S60 v3.1 |
463 Only TXmlEngElement and TXmlEngAttr nodes currently support this feature. |
462 * @param aData Pointer to the data object. |
464 |
463 * @return true if successful, false if for example underlying node type doesn't support |
465 User data is not copied when the node is copied. |
464 * attaching user data. |
466 |
465 * @note Only TXmlEngElement and Attribute nodes currently support this feature. |
467 @param aData Pointer to the data object. |
466 * User data is not copied, when node is copied. |
468 @return ETrue if successful or EFalse if the node type does not support this operation |
467 */ |
469 */ |
468 IMPORT_C TBool AddUserData(MXmlEngUserData* aData); |
470 IMPORT_C TBool AddUserData(MXmlEngUserData* aData); |
469 |
471 |
470 /** |
472 /** |
471 * Returns the user data object attached to this node. Ownership is not transferred. |
473 Gets the user data object attached to this node. Ownership is not transferred. |
472 * |
474 @return Pointer to data object or NULL if it doesn't exist. |
473 * @since S60 v3.1 |
475 */ |
474 * @return Pointer to data object or NULL if it doesn't exist. |
|
475 */ |
|
476 IMPORT_C MXmlEngUserData* UserData() const; |
476 IMPORT_C MXmlEngUserData* UserData() const; |
477 |
477 |
478 /** |
478 /** |
479 * Removes the user data onject attached to this node. Ownership is transferred |
479 Removes the user data object attached to this node and transfers ownership |
480 * (the object is not deleted). |
480 to the caller. The user data object is not deleted. |
481 * |
481 @return Pointer to the user data object or NULL if it doesn't exist. |
482 * @since S60 v3.1 |
482 */ |
483 * @return Pointer to data object or NULL if it doesn't exist. |
|
484 */ |
|
485 IMPORT_C MXmlEngUserData* RemoveUserData(); |
483 IMPORT_C MXmlEngUserData* RemoveUserData(); |
486 |
484 |
487 /** |
485 /** |
488 * Clones the node completely: all attributes and namespace declarations (for TXmlEngElement nodes), |
486 Creates a deep copy of the node. All values and children nodes are copied. |
489 * values and children nodes are copied as well. |
487 Attributes and namespace declarations are also copied for TXmlEngElement |
490 * |
488 nodes. Document nodes cannot be copied with this method. Use |
491 * Document nodes cannot be copied with this method: RXmlEngDocument::CloneDocumentL() must be used. |
489 RXmlEngDocument::CloneDocumentL() instead. |
492 * |
490 |
493 * @since S60 v3.1 |
491 User data stored with AddUserData() is not copied. |
494 * @return Complete copy of a node or leaves. |
492 |
495 * @note The node should not be NULL! |
493 @return A complete copy of the node or NULL if the node is a document node |
496 */ |
494 @leave KXmlEngErrNullNode Node is NULL |
|
495 @leave - One of the system-wide error codes |
|
496 */ |
497 IMPORT_C TXmlEngNode CopyL() const; |
497 IMPORT_C TXmlEngNode CopyL() const; |
498 |
498 |
499 /** |
499 /** |
500 * Creates a deep copy of the node and appends the subtree as a new child |
500 Creates a deep copy of the node and appends the subtree as a new child to |
501 * to the provided parent node. |
501 the provided parent node. Document nodes cannot be copied with this |
502 * |
502 method. Use RXmlEngDocument::CloneDocumentL() instead. |
503 * @since S60 v3.1 |
503 |
504 * @return Created copy of the node after linking it into the target document tree. |
504 User data stored with AddUserData() is not copied. |
505 * @note Document nodes cannot be copied with this method; use RXmlEngDocument::CloneDocumentL() |
505 |
506 */ |
506 @return Created copy of the node after linking it into the target document tree. |
|
507 @leave KXmlEngErrNullNode Node is NULL |
|
508 @leave KXmlEngErrWrongUseOfAPI Node is document node |
|
509 @leave - One of the system-wide error codes |
|
510 */ |
507 IMPORT_C TXmlEngNode CopyToL(TXmlEngNode aParent) const; |
511 IMPORT_C TXmlEngNode CopyToL(TXmlEngNode aParent) const; |
508 |
512 |
509 /** |
513 /** |
510 * Append a child node. |
514 Append a child node. This is a universal operation for any type of node. |
511 * |
515 Note that some types of nodes cannot have children and some types of nodes |
512 * This is universal operation for any types of nodes. |
516 are not allowed to be children of some other types. These relationships |
513 * Note, that some types of nodes cannot have children and |
517 are not enforced by this function. |
514 * some types of nodes are not allowed to be children of some other types. |
518 |
515 * |
519 @param aNewChild The node that should be added as a child |
516 * @since S60 v3.1 |
520 @return The appended node, which could be changed as a result of adding it to |
517 * @param aNewChild Child node that should be added |
521 list of child nodes (e.g. text nodes can coalesce together) |
518 * @return Appended node, which could changed as a result of adding it to |
522 @leave KXmlEngErrNullNode Node or aNewChild is NULL |
519 * list of child nodes (e.g. text nodes can coalesce together) |
523 @leave KErrNoMemory Memory allocation failure |
520 */ |
524 @leave - One of the system-wide error codes |
|
525 */ |
521 IMPORT_C TXmlEngNode AppendChildL(TXmlEngNode aNewChild); |
526 IMPORT_C TXmlEngNode AppendChildL(TXmlEngNode aNewChild); |
522 |
527 |
523 /** |
528 /** |
524 * Initializes a node list with all children of the node |
529 Gets the list of children. |
525 * |
530 @param aList The list of children returned |
526 * @since S60 v3.1 |
531 */ |
527 * @param aList node list that should be initialized |
|
528 */ |
|
529 IMPORT_C void GetChildNodes(RXmlEngNodeList<TXmlEngNode>& aList) const; |
532 IMPORT_C void GetChildNodes(RXmlEngNodeList<TXmlEngNode>& aList) const; |
530 |
533 |
531 /** |
534 /** |
532 * Get parent node of current node. |
535 Gets the parent node |
533 * |
536 @return The parent node or NULL if no parent exists |
534 * @since S60 v3.1 |
537 */ |
535 * @return Parent node of the node or NULL if no parent |
|
536 */ |
|
537 IMPORT_C TXmlEngNode ParentNode() const; |
538 IMPORT_C TXmlEngNode ParentNode() const; |
538 |
539 |
539 /** |
540 /** |
540 * Get first child of current node |
541 Gets the first child |
541 * |
542 @return The first child node or NULL if no children |
542 * @since S60 v3.1 |
543 */ |
543 * @return The first child node or NULL if no children |
|
544 */ |
|
545 IMPORT_C TXmlEngNode FirstChild() const; |
544 IMPORT_C TXmlEngNode FirstChild() const; |
546 |
545 |
547 /** |
546 /** |
548 * Get last child of current node |
547 Gets the last child |
549 * |
548 @return The last child node or NULL if no children |
550 * @since S60 v3.1 |
549 */ |
551 * @return The last child node or NULL if no children |
|
552 */ |
|
553 IMPORT_C TXmlEngNode LastChild() const; |
550 IMPORT_C TXmlEngNode LastChild() const; |
554 |
551 |
555 /** |
552 /** |
556 * Get previous node of current node |
553 Gets the previous sibling |
557 * |
554 @return The previous sibling or NULL if there is no sibling before |
558 * @since S60 v3.1 |
555 */ |
559 * @return Previous node in a child list or NULL if no sibling before |
|
560 */ |
|
561 IMPORT_C TXmlEngNode PreviousSibling() const; |
556 IMPORT_C TXmlEngNode PreviousSibling() const; |
562 |
557 |
563 /** |
558 /** |
564 * Get fallowing node of current node |
559 Gets the next sibling |
565 * |
560 @return The next sibling or NULL if there is no sibling after |
566 * @since S60 v3.1 |
561 */ |
567 * @return Following node in a child list or NULL if no sibling after |
|
568 */ |
|
569 IMPORT_C TXmlEngNode NextSibling() const; |
562 IMPORT_C TXmlEngNode NextSibling() const; |
570 |
563 |
571 /** |
564 /** |
572 * Get document handle |
565 Gets the owning document |
573 * |
566 |
574 * @since S60 v3.1 |
567 Note: An instance of the RXmlEngDocument class returns itself |
575 * @return A document node of the DOM tree this node belongs to |
568 |
576 * |
569 @pre Node must not be NULL. |
577 * @note An instance of RXmlEngDocument class returns itself |
570 @return The document node of the DOM tree that this node belongs to or a |
578 */ |
571 NULL document if no owning document. |
|
572 */ |
579 IMPORT_C RXmlEngDocument OwnerDocument() const; |
573 IMPORT_C RXmlEngDocument OwnerDocument() const; |
580 |
574 |
581 /** |
575 /** |
582 * Fetches value of this node, depending on its type. |
576 Gets the value of this node. |
583 * |
577 |
584 * @note It is better to always cast nodes to specific type and then use specific |
578 Note: Since this is not a virtual function, it is better to always cast |
585 * method for getting "node value" |
579 nodes to a specific type and then use the specific method for getting the |
586 * |
580 "node value". |
587 * @since S60 v3.1 |
581 |
588 * @return Node value |
582 @return The node value |
589 */ |
583 */ |
590 IMPORT_C TPtrC8 Value() const; |
584 IMPORT_C TPtrC8 Value() const; |
591 |
585 |
592 /** |
586 /** |
593 * Get copy of node's text content |
587 Gets a copy of the node's text content. What is returned depends on the |
594 * What is returned depends on the node type. |
588 node type. Any existing content in the specified buffer is destroyed. |
595 * Method caller is responsible for freeing returned string. |
589 This method allocates memory for the buffer. |
596 * |
590 |
597 * @since S60 v3.1 |
591 @param aOutput A buffer owned by the caller which holds the returned string |
598 * @return the content of the node |
592 @leave - One of the system-wide error codes |
599 */ |
593 */ |
600 IMPORT_C void WholeTextContentsCopyL(RBuf8& aOutput) const; |
594 IMPORT_C void WholeTextContentsCopyL(RBuf8& aOutput) const; |
601 |
595 |
602 /** |
596 /** |
603 * Sets value of this node. |
597 Copies the specified string and sets the value of this node. |
604 * |
598 @param aValue The value to set |
605 * @since S60 v3.1 |
599 @leave KXmlEngErrNullNode The node is NULL |
606 * @param aValue New value |
600 @leave - One of the system-wide error codes |
607 */ |
601 */ |
608 IMPORT_C void SetValueL(const TDesC8& aValue); |
602 IMPORT_C void SetValueL(const TDesC8& aValue); |
609 |
603 |
610 /** |
604 /** |
611 * Check if node content is "simple text". |
605 Check if the node content is "simple text" for element and attribute nodes. |
612 * |
606 |
613 * @since S60 v3.1 |
607 If the node content is "simple text" then it is represented by a single |
614 * @return Whether the value of the node is presented by only one TXmlEngTextNode node |
608 TXmlEngTextNode (or derived type). The contents can be obtained through a |
615 * |
609 call to Value(). A node that has multiple child text nodes does not have |
616 * If the value is <i>"simple text"</i> then it is possible to access it as TDOMString |
610 node content that is "simple text" and the contents must be obtained |
617 * without making copy, which combines values of all text nodes and entity reference nodes. |
611 through a call to WholeTextContentsCopyL(). |
618 * |
612 |
619 * @see TXmlEngNode::Value(), TXmlEngAttr::Value(), TXmlEngElement::Text() |
613 The contents of TXmlEngComment, TXmlEngCDATASection, TXmlEngTextNode, and |
620 * |
614 Processing Instuction data are always "simple". |
621 * This method is applicable to TXmlEngElement and TXmlEngAttr nodes. On other nodes FALSE is returned. |
615 |
622 * |
616 @see TXmlEngNode::Value() |
623 * @note |
617 @see TXmlEngAttr::Value() |
624 * Values (contents) of TXmlEngComment, TXmlEngCDATASection, TXmlEngTextNode, ProcessingInstuction data are |
618 @see TXmlEngElement::Text() |
625 * always "simple". |
619 @see TXmlEngNode::WholeTextContentsCopyL() |
626 * |
620 |
627 * When the returned result is FALSE, getting value of the node would not returned |
621 @return ETrue if the node is an element or attribute node and content is |
628 * whole contents because of either entity references present in the contents or |
622 represented by one TXmlEngTextNode or EFalse otherwise |
629 * the contents is mixed (for TXmlEngElement node). In this case WholeTextContentsCopyL() |
623 */ |
630 * should be used. |
624 IMPORT_C TBool IsSimpleTextContents() const; |
631 * |
625 |
632 * @see TXmlEngNode::WholeTextContentsCopyL() |
626 /** |
633 */ |
627 Gets the node type. Used to find out the type of the node prior to casting |
634 IMPORT_C TBool IsSimpleTextContents() const; |
628 the node to one of TXmlEngNode class to one of its derived subclasses |
635 |
629 (TXmlEngElement, TXmlEngAttr, TXmlEngTextNode, etc.). |
636 /** |
630 |
637 * Use NodeType() to find out the type of the node prior to casting object |
631 @see TXmlEngDOMNodeType |
638 * of TXmlEngNode class to one of its derived subclasses (TXmlEngElement, TXmlEngAttr, TXmlEngTextNode, etc.) |
632 @pre Node must not be NULL |
639 * |
633 @return The type of the node |
640 * @since S60 v3.1 |
634 */ |
641 * @return Type of the node |
|
642 * |
|
643 * @see TXmlEngDOMNodeType |
|
644 */ |
|
645 IMPORT_C TXmlEngDOMNodeType NodeType() const; |
635 IMPORT_C TXmlEngDOMNodeType NodeType() const; |
646 |
636 |
647 /** |
637 /** |
648 * Get node name |
638 Gets the node name. |
649 * |
639 |
650 * @since S60 v3.1 |
640 This method generally follows the DOM spec: |
651 * @return Name of the node |
641 ------------------------------------------------------------------------------- |
652 * |
642 The values of nodeName, nodeValue, and attributes vary according to the node |
653 * This method generally follows DOM spec : |
643 type as follows: |
654 * ------------------------------------------------------------------------------- |
644 |
655 * The values of nodeName, nodeValue, and attributes vary according to the node |
645 interface nodeName nodeValue attributes |
656 * type as follows: |
646 ------------------------------------------------------------------------------- |
657 * |
647 Attr = Attr.name = Attr.value = null |
658 * interface nodeName nodeValue attributes |
648 CDATASection = "#cdata-section" = CharacterData.data = null |
659 * ------------------------------------------------------------------------------- |
649 Comment = "#comment" = CharacterData.data = null |
660 * Attr = Attr.name = Attr.value = null |
650 Document = "#document" = null = null |
661 * CDATASection = "#cdata-section" = CharacterData.data = null |
651 DocumentFragment = "#document-fragment" = null = null |
662 * Comment = "#comment" = CharacterData.data = null |
652 DocumentType = DocumentType.name = null = null |
663 * Document = "#document" = null = null |
653 Element = Element.tagName = null = NamedNodeMap |
664 * DocumentFragment = "#document-fragment" = null = null |
654 Entity = entity name = null = null |
665 * DocumentType = DocumentType.name = null = null |
655 EntityReference = name of entity referenced = null = null |
666 * Element = Element.tagName = null = NamedNodeMap |
656 Notation = notation name = null = null |
667 * Entity = entity name = null = null |
657 ProcessingInstruction = target = data = null |
668 * EntityReference = name of entity referenced = null = null |
658 Text = "#text" = CharacterData.data = null |
669 * Notation = notation name = null = null |
659 ------------------------------------------------------------------------------- |
670 * ProcessingInstruction = target = data = null |
660 |
671 * Text = "#text" = CharacterData.data = null |
661 @return The name of the node |
672 * ------------------------------------------------------------------------------- |
662 */ |
673 */ |
|
674 IMPORT_C TPtrC8 Name() const; |
663 IMPORT_C TPtrC8 Name() const; |
675 |
664 |
676 |
665 |
677 /** |
666 /** |
678 * Check if node has child nodes. |
667 Check if the node has child nodes. |
679 * |
668 @return ETrue if the node has child nodes, EFalse otherwise |
680 * @since S60 v3.1 |
669 */ |
681 * @return True if the node is TXmlEngElement and has at least one child node |
|
682 */ |
|
683 IMPORT_C TBool HasChildNodes() const; |
670 IMPORT_C TBool HasChildNodes() const; |
684 |
671 |
685 /** |
672 /** |
686 * Check if node has attributes. |
673 Check if the node has attributes. Namespace-to-prefix bindings are not |
687 * |
674 considered attributes. |
688 * @since S60 v3.1 |
675 @return ETrue if the node is an Element node and has at least one |
689 * @return True if the node is TXmlEngElement and has at least one attribute |
676 attribute, EFalse otherwise |
690 * |
677 */ |
691 * @note Namespace-to-prefix bindings are not attributes. |
678 IMPORT_C TBool HasAttributes() const; |
692 */ |
679 |
693 IMPORT_C TBool HasAttributes() const; |
680 /** |
694 |
681 Evaluates the active base URI for the node by processing the xml:base |
695 /** |
682 attributes of the parents of the node. If no xml:base attributes exist, |
696 * Evaluates active base URI for the node by processing xml:base attributes of parents |
683 an empty string is returned. Any existing content in the specified buffer |
697 * |
684 is destroyed. This function allocates memory for the buffer. |
698 * @since S60 v3.1 |
685 |
699 * @return A copy of effective base URI for the node |
686 @param aBaseUri A buffer owned by the caller that holds the result. |
700 * @note It's up to the caller to free the string |
687 @leave - One of the system-wide error codes |
701 */ |
688 */ |
702 IMPORT_C void BaseUriL(RBuf8& aBaseUri) const; |
689 IMPORT_C void BaseUriL(RBuf8& aBaseUri) const; |
703 |
690 |
704 /** |
691 /** |
705 * Compares nodes. |
692 Checks if a node is the same as this node. Nodes are considered the same |
706 * |
693 if they refer to the same in-memory data structure. |
707 * The nodes are the same if they are referring to the same in-memory |
694 |
708 * data structure. |
695 @param aOther Node to compare |
709 * |
696 @return ETrue if the nodes are the same, EFalse otherwise |
710 * @since S60 v3.1 |
697 */ |
711 * @param aOther Node to compare |
|
712 * @return TRUE if the same |
|
713 */ |
|
714 inline TBool IsSameNode(TXmlEngNode aOther) const; |
698 inline TBool IsSameNode(TXmlEngNode aOther) const; |
715 |
699 |
716 /** |
700 /** |
717 * Get namespace uri. |
701 Gets the namespace URI. |
718 * |
702 |
719 * @since S60 v3.1 |
703 @return The namespace URI of a TXmlEngNamespace, TXmlEngAttr or |
720 * @return Namespace URI of a node |
704 TXmlEngElement node if bound, NULL in all other cases. |
721 * - NULL is returned for elements and attributes that do not |
705 */ |
722 * belong to any namespace. |
|
723 * - bound namespace URI is returned for namespace declaration nodes (instances of TXmlEngNamespace). |
|
724 * - NULL is returned to all other types of node. |
|
725 * |
|
726 * @note use IsNull() and NotNull() for testing returned result on the subject |
|
727 * of having some URI |
|
728 */ |
|
729 IMPORT_C TPtrC8 NamespaceUri() const; |
706 IMPORT_C TPtrC8 NamespaceUri() const; |
730 |
707 |
731 /** |
708 /** |
732 * Get namespace prefix. |
709 Gets the namespace prefix. |
733 * |
710 |
734 * @since S60 v3.1 |
711 @return The prefix of an element or attribute node if bound, NULL in all |
735 * @return Prefix of a node |
712 other cases. |
736 * Returns NULL for elements and attributes that do not have prefix |
713 */ |
737 * (node belongs to the default namespace or does not belong to any namespace) |
714 IMPORT_C TPtrC8 Prefix() const; |
738 * NULL is also returned for all types of node other than TXmlEngElement or TXmlEngAttr |
715 |
739 */ |
716 /** |
740 IMPORT_C TPtrC8 Prefix() const; |
717 Check if the given namespace is the same as the default namespace for this |
741 |
718 node. |
742 /** |
719 |
743 * Check if nemespace is default for this node |
720 Note: "" or NULL can be used to denote undefined namespace |
744 * |
721 |
745 * @since S60 v3.1 |
722 @param aNamespaceUri Namespace URI |
746 * @param aNamespaceUri Namespace URI |
723 @return ETrue if the node is an element node and its default namespace URI is the same as the given namespace URI, EFalse otherwise |
747 * @return True if given namespace URI is a default one for the node (applicable to elements only) |
724 @leave - One of the system-wide error codes |
748 * |
725 */ |
749 * @note "" or NULL can be used to denote undefined namespace |
|
750 */ |
|
751 IMPORT_C TBool IsDefaultNamespaceL(const TDesC8& aNamespaceUri) const; |
726 IMPORT_C TBool IsDefaultNamespaceL(const TDesC8& aNamespaceUri) const; |
752 |
727 |
753 /** |
728 /** |
754 * Searches the prefix that is bound to the given aNamespaceUri and |
729 Searches for the prefix bound to the given aNamespaceUri and applicable |
755 * applicable in the scope of this TXmlEngNode. |
730 within the scope of this node. |
756 * |
731 |
757 * @since S60 v3.1 |
732 @see TXmlEngElement::LookupNamespaceByUriL() |
758 * @param aNamespaceUri Namespace Uri that should be found |
733 |
759 * @return A sought prefix or NULL if not found or aNamespaceUri is the default namespace |
734 @param aNamespaceUri The Namespace URI to search for |
760 * |
735 |
761 * @see TXmlEngElement::LookupNamespaceByUriL(const TDesC8&) |
736 @return The sought prefix or NULL if not found or if aNamespaceUri is the default namespace |
762 */ |
737 @leave KXmlEngErrNullNode The node is NULL |
|
738 @leave - One of the system-wide error codes |
|
739 */ |
763 IMPORT_C TPtrC8 LookupPrefixL(const TDesC8& aNamespaceUri) const; |
740 IMPORT_C TPtrC8 LookupPrefixL(const TDesC8& aNamespaceUri) const; |
764 |
741 |
765 /** |
742 /** |
766 * Searches the namespace URI that is bound to the given prefix. |
743 Searches for the namespace URI that is bound to the given prefix. |
767 * |
744 |
768 * @since S60 v3.1 |
745 @see TXmlEngElement::LookupNamespaceByPrefixL(const TDesC8&) |
769 * @param aPrefix Namespace prefix that should be found |
746 |
770 * @return A sought URI or NULL if the prefix is not bound |
747 @param aPrefix The namespace prefix to search for |
771 * |
748 @return The sought URI or NULL if the prefix is not bound |
772 * @see TXmlEngElement::LookupNamespaceByPrefixL(const TDesC8&) |
749 @leave KXmlEngErrNullNode The node is NULL |
773 */ |
750 @leave - One of the system-wide error codes |
|
751 */ |
774 IMPORT_C TPtrC8 LookupNamespaceUriL(const TDesC8& aPrefix) const; |
752 IMPORT_C TPtrC8 LookupNamespaceUriL(const TDesC8& aPrefix) const; |
775 |
753 |
776 protected: |
754 protected: |
777 /** |
755 /** |
778 * Unlinks the internal libxml2's node from double-linked list. |
756 Unlinks the node from the double-linked list and relinks any neighbour |
779 * Relinks neighbour nodes.The node stays virtually linked to its old neighbours! Use with care!! |
757 nodes. Despite being removed from the list, the node retains links to its |
780 * |
758 old neighbours! Use with care!! |
781 * No checks are made; nor parent's, nor node's properties updated |
759 |
782 * |
760 No checks are made. Neither the parent's, nor the node's properties are |
783 * @since S60 v3.1 |
761 updated. |
784 */ |
762 */ |
785 void DoUnlinkNode(); |
763 void DoUnlinkNode(); |
786 |
764 |
787 /** |
765 /** |
788 * Inserts the node in a double-linked list of nodes before specified node. |
766 Inserts this node before the specified node in the double-linked list. |
789 * |
767 |
790 * No checks are made; nor parent's, nor node's properties updated (except prev/next) |
768 No checks are made. Neither the parent's, nor the node's properties are |
791 * |
769 updated. |
792 * @since S60 v3.1 |
770 |
793 * @param aNode Target node |
771 @param aNode After insertion, this node will come before aNode in the list |
794 */ |
772 */ |
795 void LinkBefore(TXmlEngNode aNode); |
773 void LinkBefore(TXmlEngNode aNode); |
796 |
774 |
797 protected: |
775 protected: |
798 /** Node pointer */ |
776 /** Node pointer */ |
799 void* iInternal; |
777 void* iInternal; |
800 |
778 |
801 }; |
779 }; |
802 |
780 |
803 #include "xmlengnode.inl" |
781 #include <xml/dom/xmlengnode.inl> |
804 |
782 |
805 #endif /* XMLENGINE_NODE_H_INCLUDED */ |
783 #endif /* XMLENGNODE_H */ |
|
784 |