Symbian3/SDK/Source/GUID-61056CE2-97BF-5D32-8AC5-E625FBC7D0EC.dita
changeset 8 ae94777fff8f
parent 7 51a74ef9ed63
child 13 48780e181b38
--- a/Symbian3/SDK/Source/GUID-61056CE2-97BF-5D32-8AC5-E625FBC7D0EC.dita	Wed Mar 31 11:11:55 2010 +0100
+++ b/Symbian3/SDK/Source/GUID-61056CE2-97BF-5D32-8AC5-E625FBC7D0EC.dita	Fri Jun 11 12:39:03 2010 +0100
@@ -1,80 +1,80 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
-<!-- This component and the accompanying materials are made available under the terms of the License 
-"Eclipse Public License v1.0" which accompanies this distribution, 
-and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
-<!-- Initial Contributors:
-    Nokia Corporation - initial contribution.
-Contributors: 
--->
-<!DOCTYPE task
-  PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
-<task id="GUID-61056CE2-97BF-5D32-8AC5-E625FBC7D0EC" xml:lang="en"><title>Modifying
-DOM Tree</title><shortdesc>This topic explains how to create or modify a DOM tree by adding
-nodes and changing their contents. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
-<prereq><p>Before you start, you must: </p> <ul>
-<li id="GUID-AB0E481B-349C-5C60-ACB7-06EBA299E149"><p>understand the concept
-of <xref href="http://www.w3.org/DOM/" scope="external">Document Object Model
-(DOM)</xref>  </p> </li>
-<li id="GUID-79A66EA2-4F81-57E9-A4DB-E64B5405B578"><p>understand the structure
-and classes of the <xref href="GUID-5ACFA8E4-3C4B-5851-A43E-9FA72D0B8403.dita">XML
-DOM Engine </xref> component </p> </li>
-</ul> </prereq>
-<context><p> </p> <p>The following diagram shows a sequence of calls that
-create a DOM tree from an empty document. There are many functions in the
-DOM Engine API that add nodes to a tree: refer to the reference documentation
-of the <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>TXmlEngElement</apiname></xref> class for a comprehensive
-list. </p> <fig id="GUID-31E4FB65-7C28-513B-B8C0-5B057DC64A50">
-<title>              Creating a DOM tree            </title>
-<image href="GUID-3E0E2E54-CD8A-5BAF-A87B-BF51FD8890D6_d0e431518_href.png" placement="inline"/>
-</fig> </context>
-<steps id="GUID-DEA52036-E11C-5913-984B-663DD68D02DB">
-<step id="GUID-E65A2FF6-2918-540B-97DB-C07500A6CB08"><cmd/>
-<info>Create an instance of <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>RXmlEngDocument</apiname></xref>. </info>
-<stepxmp><codeblock id="GUID-B36F5C00-6974-54EC-939A-34BF05F5C04A" xml:space="preserve">RXmlEngDocument myDoc;</codeblock> </stepxmp>
-</step>
-<step id="GUID-858AD52F-0526-5DCC-B424-666D88F19E8E"><cmd/>
-<info>Set the root node with the <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>RXmlEngDocument::CreateDocumentElementL()</apiname></xref> function. </info>
-<stepxmp><codeblock id="GUID-E890E160-294C-5218-B8A8-41EB7E7FE8A7" xml:space="preserve">_LIT8( KRootName, "playlist" );
-TXmlEngElement root = myDoc-&gt;CreateDocumentElementL( KRootName );</codeblock> </stepxmp>
-</step>
-<step id="GUID-25D56F38-012F-5169-9925-07A6A7BBAC31"><cmd/>
-<info>Add child nodes and attributes by calling the <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>TXmlEngElement::AddNewElementL()</apiname></xref> and <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>TXmlEngElement::AddNewAttributeL()</apiname></xref> functions. </info>
-<stepxmp><codeblock id="GUID-5CCB071C-7042-5F07-A5DE-29C2D5CD01D6" xml:space="preserve">_LIT8( KChildName, "song" );
-_LIT8( KAttrName, "filename" );
-
-for( TInt i=1;i&lt;6;i++ ) 
-    {
-          TXmlEngElement tempElement = root.AddNewElementL( KChildName );
-          TBuf8&lt;12&gt; value( _L8( "music0" ) );
-          value.AppendNum( i );
-          value.Append( _L8( ".mp3" ) );
-          tempElement.AddNewAttributeL( KAttrName, value );
-    }</codeblock> </stepxmp>
-</step>
-<step id="GUID-559B34A9-4A69-57E3-AF2A-D3E7F81728B0"><cmd/>
-<info>Swap the first two song elements by calling the <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>TXmlEngElement::MoveAfterSibling()</apiname></xref> function. </info>
-<stepxmp><codeblock id="GUID-6B4EDCE6-A688-5A0E-B4D9-9CF2ABD8DE5F" xml:space="preserve">TXmlEngNode swap = root.FirstChild();
-swap.MoveAfterSibling( swap.NextSibling() );</codeblock> </stepxmp>
-</step>
-<step id="GUID-D648ADF3-10A5-5FDC-BF2C-D08B095E5FE6"><cmd/>
-<info>If you want to save the DOM tree into a file, call the <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>XmlEnginePushL()</apiname></xref> method
-first. </info>
-<info>You must call the <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>XmlEnginePushL()</apiname></xref> method
-before parsing or saving an XML file, and the <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>XmlEnginePopAndClose()</apiname></xref> method
-after these operations. </info>
-</step>
-</steps>
-<result><p>The result is a DOM tree corresponding to the following XML structure: </p> <codeblock id="GUID-E90DD401-DDA6-5A3F-9A26-8C5CBE6BE64E" xml:space="preserve">
- &lt;playlist&gt;
-     &lt;song filename = "music02.mp3"/&gt;
-     &lt;song filename = "music01.mp3"/&gt;
-     &lt;song filename = "music03.mp3"/&gt;
-     &lt;song filename = "music04.mp3"/&gt;
-     &lt;song filename = "music05.mp3"/&gt;
- &lt;/playlist&gt;
-</codeblock> </result>
-</taskbody><related-links>
-<link href="GUID-C5C30218-311C-58D9-A990-3F95642F7517.dita"><linktext>Parsing XML
-DOM</linktext></link>
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
+<!-- This component and the accompanying materials are made available under the terms of the License 
+"Eclipse Public License v1.0" which accompanies this distribution, 
+and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
+<!-- Initial Contributors:
+    Nokia Corporation - initial contribution.
+Contributors: 
+-->
+<!DOCTYPE task
+  PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
+<task id="GUID-61056CE2-97BF-5D32-8AC5-E625FBC7D0EC" xml:lang="en"><title>Modifying
+DOM Tree</title><shortdesc>This topic explains how to create or modify a DOM tree by adding
+nodes and changing their contents. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
+<prereq><p>Before you start, you must: </p> <ul>
+<li id="GUID-AB0E481B-349C-5C60-ACB7-06EBA299E149"><p>understand the concept
+of <xref href="http://www.w3.org/DOM/" scope="external">Document Object Model
+(DOM)</xref>  </p> </li>
+<li id="GUID-79A66EA2-4F81-57E9-A4DB-E64B5405B578"><p>understand the structure
+and classes of the <xref href="GUID-5ACFA8E4-3C4B-5851-A43E-9FA72D0B8403.dita">XML
+DOM Engine </xref> component </p> </li>
+</ul> </prereq>
+<context><p> </p> <p>The following diagram shows a sequence of calls that
+create a DOM tree from an empty document. There are many functions in the
+DOM Engine API that add nodes to a tree: refer to the reference documentation
+of the <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>TXmlEngElement</apiname></xref> class for a comprehensive
+list. </p> <fig id="GUID-31E4FB65-7C28-513B-B8C0-5B057DC64A50">
+<title>              Creating a DOM tree            </title>
+<image href="GUID-3E0E2E54-CD8A-5BAF-A87B-BF51FD8890D6_d0e431356_href.png" placement="inline"/>
+</fig> </context>
+<steps id="GUID-DEA52036-E11C-5913-984B-663DD68D02DB">
+<step id="GUID-E65A2FF6-2918-540B-97DB-C07500A6CB08"><cmd/>
+<info>Create an instance of <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>RXmlEngDocument</apiname></xref>. </info>
+<stepxmp><codeblock id="GUID-B36F5C00-6974-54EC-939A-34BF05F5C04A" xml:space="preserve">RXmlEngDocument myDoc;</codeblock> </stepxmp>
+</step>
+<step id="GUID-858AD52F-0526-5DCC-B424-666D88F19E8E"><cmd/>
+<info>Set the root node with the <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>RXmlEngDocument::CreateDocumentElementL()</apiname></xref> function. </info>
+<stepxmp><codeblock id="GUID-E890E160-294C-5218-B8A8-41EB7E7FE8A7" xml:space="preserve">_LIT8( KRootName, "playlist" );
+TXmlEngElement root = myDoc-&gt;CreateDocumentElementL( KRootName );</codeblock> </stepxmp>
+</step>
+<step id="GUID-25D56F38-012F-5169-9925-07A6A7BBAC31"><cmd/>
+<info>Add child nodes and attributes by calling the <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>TXmlEngElement::AddNewElementL()</apiname></xref> and <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>TXmlEngElement::AddNewAttributeL()</apiname></xref> functions. </info>
+<stepxmp><codeblock id="GUID-5CCB071C-7042-5F07-A5DE-29C2D5CD01D6" xml:space="preserve">_LIT8( KChildName, "song" );
+_LIT8( KAttrName, "filename" );
+
+for( TInt i=1;i&lt;6;i++ ) 
+    {
+          TXmlEngElement tempElement = root.AddNewElementL( KChildName );
+          TBuf8&lt;12&gt; value( _L8( "music0" ) );
+          value.AppendNum( i );
+          value.Append( _L8( ".mp3" ) );
+          tempElement.AddNewAttributeL( KAttrName, value );
+    }</codeblock> </stepxmp>
+</step>
+<step id="GUID-559B34A9-4A69-57E3-AF2A-D3E7F81728B0"><cmd/>
+<info>Swap the first two song elements by calling the <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>TXmlEngElement::MoveAfterSibling()</apiname></xref> function. </info>
+<stepxmp><codeblock id="GUID-6B4EDCE6-A688-5A0E-B4D9-9CF2ABD8DE5F" xml:space="preserve">TXmlEngNode swap = root.FirstChild();
+swap.MoveAfterSibling( swap.NextSibling() );</codeblock> </stepxmp>
+</step>
+<step id="GUID-D648ADF3-10A5-5FDC-BF2C-D08B095E5FE6"><cmd/>
+<info>If you want to save the DOM tree into a file, call the <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>XmlEnginePushL()</apiname></xref> method
+first. </info>
+<info>You must call the <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>XmlEnginePushL()</apiname></xref> method
+before parsing or saving an XML file, and the <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>XmlEnginePopAndClose()</apiname></xref> method
+after these operations. </info>
+</step>
+</steps>
+<result><p>The result is a DOM tree corresponding to the following XML structure: </p> <codeblock id="GUID-E90DD401-DDA6-5A3F-9A26-8C5CBE6BE64E" xml:space="preserve">
+ &lt;playlist&gt;
+     &lt;song filename = "music02.mp3"/&gt;
+     &lt;song filename = "music01.mp3"/&gt;
+     &lt;song filename = "music03.mp3"/&gt;
+     &lt;song filename = "music04.mp3"/&gt;
+     &lt;song filename = "music05.mp3"/&gt;
+ &lt;/playlist&gt;
+</codeblock> </result>
+</taskbody><related-links>
+<link href="GUID-C5C30218-311C-58D9-A990-3F95642F7517.dita"><linktext>Parsing XML
+DOM</linktext></link>
 </related-links></task>
\ No newline at end of file