Symbian3/SDK/Source/GUID-5012D63B-4353-5616-BBFB-DB04DAF71679.dita
changeset 0 89d6a7a84779
child 13 48780e181b38
equal deleted inserted replaced
-1:000000000000 0:89d6a7a84779
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-5012D63B-4353-5616-BBFB-DB04DAF71679" xml:lang="en"><title>XmlExample:
       
    13 Using the XML framework to parse an XML file</title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <section id="GUID-7860D226-83AD-501E-9431-6A61A9AC2996"><title>Download</title> <p>Click
       
    15 on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-3eef58b5-bcd4-4f1e-a864-71273651c3bb.zip" scope="external">XmlExample.zip</xref></p><p>Click:<xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-3eef58b5-bcd4-4f1e-a864-71273651c3bb.html" scope="peer">browse</xref> to view the example code. </p> </section>
       
    16 <section><title>Introduction</title> <p>This example application demonstrates
       
    17 the usage of the <xref href="GUID-5748D958-9480-3358-A399-6B92293B86D9.dita"><apiname>XML</apiname></xref> framework API to parse XML and WBXML
       
    18 files. </p> <p>The overview contains the following sections: </p> <ul>
       
    19 <li id="GUID-01C9B600-A55E-55D8-AA35-057464345A45"><p> <xref href="GUID-5012D63B-4353-5616-BBFB-DB04DAF71679.dita#GUID-5012D63B-4353-5616-BBFB-DB04DAF71679/GUID-3A5027A1-BEE9-5EB4-8670-7E729CF9260F">Description</xref>  </p> </li>
       
    20 <li id="GUID-656E68A4-BAF3-505B-AC9A-96C6A9107E1B"><p> <xref href="GUID-5012D63B-4353-5616-BBFB-DB04DAF71679.dita#GUID-5012D63B-4353-5616-BBFB-DB04DAF71679/GUID-5dfd0234-44cf-4252-a980-5b73aaa61e35">Class summary</xref>  </p> </li>
       
    21 <li id="GUID-F8CEA6F8-D4AB-5E32-9EC1-9FACED6F34B5"><p> <xref href="GUID-5012D63B-4353-5616-BBFB-DB04DAF71679.dita#GUID-5012D63B-4353-5616-BBFB-DB04DAF71679/GUID-E9F975CA-A59F-5484-83FD-7F17F0A03807">Build</xref>  </p> </li>
       
    22 </ul> </section>
       
    23 <section id="GUID-3A5027A1-BEE9-5EB4-8670-7E729CF9260F"><title>Description</title> <p>The
       
    24 example application demonstrates, how to use the <xref href="GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473.dita"><apiname>Xml</apiname></xref> framework
       
    25 to parse XML and WBXML files. It takes a valid XML file with a DTD (Document
       
    26 Type Declaration) definining its structure, and a WBXML (WAP Binary XML format)
       
    27 file as input. You can generate a WBXML file from an XML file using any freeware
       
    28 converters. The application's <filepath>bld.inf</filepath> file specifies
       
    29 the target path to which all the three files (XML, DTD, WBXML) need to be
       
    30 exported. </p> <p>The application implements all the pure virtual functions
       
    31 of the <xref href="GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473.dita#GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473/GUID-25E466A4-0578-3BED-A56D-4E0906313788"><apiname>Xml::MContentHandler</apiname></xref> class, which is a client interface
       
    32 to the <xref href="GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473.dita"><apiname>Xml</apiname></xref> framework. These functions inform the client
       
    33 application about the XML element being parsed, its content, parser errors
       
    34 if any and so on. </p> <p>The XML and WBXML files are parsed using an object
       
    35 of the <xref href="GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473.dita#GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473/GUID-EE37CB28-DAB4-30A9-B46E-8AE4664B28DE"><apiname>Xml::CParser</apiname></xref> class. The parser object is configured
       
    36 to report namespace mappings to the client application, using the function <xref href="GUID-EE37CB28-DAB4-30A9-B46E-8AE4664B28DE.dita#GUID-EE37CB28-DAB4-30A9-B46E-8AE4664B28DE/GUID-5F2688CC-16B3-3F0D-B6CA-CE59FE7939BD"><apiname>Xml::CParser::EnableFeature()</apiname></xref>. </p> <p>The
       
    37 application first opens a file session using <xref href="GUID-E263C747-946F-35AA-9F1D-41833BD350FC.dita"><apiname>RFs</apiname></xref> to read
       
    38 the XML and WBXML files. Then, the <xref href="GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473.dita#GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473/GUID-CC810749-2F0D-3CC0-911D-EE12BB934867"><apiname>Xml::ParseL()</apiname></xref> function
       
    39 is called to start parsing the files. The application parses the XML file
       
    40 followed by the WBXML file. While these files are being parsed, status messages
       
    41 are printed to the console by the callback functions as and when they are
       
    42 invoked. </p> <p>For demonstration purposes, the XML file is parsed twice,
       
    43 once by the <xref href="GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473.dita#GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473/GUID-EE37CB28-DAB4-30A9-B46E-8AE4664B28DE"><apiname>Xml::CParser</apiname></xref> object created using the MIME
       
    44 type and again by the <codeph>CParser</codeph> object created using match
       
    45 data criteria. The match data criteria are specified using an object of the <xref href="GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473.dita#GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473/GUID-AEFF2DB4-FBC2-36EE-A4CE-7EBBD4AF004E"><apiname>Xml::CMatchData</apiname></xref> class,
       
    46 which is passed to the <xref href="GUID-EE37CB28-DAB4-30A9-B46E-8AE4664B28DE.dita#GUID-EE37CB28-DAB4-30A9-B46E-8AE4664B28DE/GUID-9E9D8DBA-A396-3F62-8B59-C4556FD5A80E"><apiname>Xml::CParser::NewLC()</apiname></xref> function while
       
    47 creating the parser object. This will return a <codeph>CParser</codeph> object
       
    48 that matches the specified MIME type, variant and so on. </p> </section>
       
    49 <section id="GUID-5DFD0234-44CF-4252-A980-5B73AAA61E35"><title>Class summary</title><p> <xref href="GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473.dita#GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473/GUID-25E466A4-0578-3BED-A56D-4E0906313788"><apiname>Xml::MContentHandler </apiname></xref><xref href="GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473.dita#GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473/GUID-88087934-B84B-39DD-907F-71328D684035"><apiname>Xml::RDocumentParameters </apiname></xref><xref href="GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473.dita#GUID-54A442BD-FCF1-31D3-BEF7-598C1820F473/GUID-A8A238B9-48A5-3729-9BAE-0287EE6295FA"><apiname>Xml::RAttributeArray </apiname></xref><xref href="GUID-DEFFFAAD-662A-34E9-8955-759F37BDC9AB.dita#GUID-DEFFFAAD-662A-34E9-8955-759F37BDC9AB/GUID-9A8E865C-FDAC-3923-83A9-5A8680AEE1EE"><apiname>Xml::CParserXml::CMatchData </apiname></xref> </p></section>
       
    50 <section id="GUID-E9F975CA-A59F-5484-83FD-7F17F0A03807"><title>Build</title> <p>The <xref href="GUID-3100800B-B2F7-50EF-BD4C-3C345ECCB2A5.dita">Symbian platform build process</xref> describes
       
    51 how to build an application. </p> <p>The <codeph>XmlExample</codeph> builds
       
    52 an executable called <filepath>xmlexample.exe</filepath> in the standard location
       
    53 (<filepath>\epoc32\release\winscw\&lt;build_variant&gt;</filepath> for CodeWarrior).
       
    54 After launching the executable, depending on the emulator you are using, you
       
    55 may need to task away from the application launcher/shell screen to view the
       
    56 console. </p> </section>
       
    57 </conbody></concept>