|
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 task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <task id="GUID-42F0F282-58D6-4878-B53D-EAEEF86A3D7D" xml:lang="en"><title>Parsing |
|
13 Delimited Data</title><shortdesc>This tutorial describes the steps to parse delimited data. The |
|
14 data in the URI that is delimited into segments can be parsed using the <codeph>TDelimitedXxxxParser8</codeph> classes. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
15 <prereq> <p>Parse the delimited data using the following functionalities |
|
16 of <codeph>TDelimitedXxxxParser8</codeph>: <ul> |
|
17 <li><p>Set the delimiter (before parsing the data) to a specific character |
|
18 using <codeph>SetDelimiter()</codeph>. For example:</p><codeblock xml:space="preserve">//set the delimiter character to '/' |
|
19 SetDelimiter(TChar('/'));</codeblock></li> |
|
20 <li><p>Parse the data into segments from left to right using<codeph> Parse()</codeph>. </p></li> |
|
21 <li><p>Parse the data into segments from right to left using <codeph>ParseReverse()</codeph>.</p><note> Parse |
|
22 the data into segments before calling any of the functions described in the |
|
23 following steps.</note></li> |
|
24 <li><p>Parse to the next segment using <codeph>Inc()</codeph>. </p></li> |
|
25 <li><p>Get the descriptor reference with the data using <codeph>Des()</codeph>. </p></li> |
|
26 <li><p>Get the current segment and parse the data to the next segment using <codeph>GetNext()</codeph>. </p></li> |
|
27 <li><p>Get the current segment using <codeph>Peek()</codeph>. </p></li> |
|
28 <li><p>Get the remaining data from (and including) the current segment using <codeph>Remainder()</codeph>. </p></li> |
|
29 </ul></p> </prereq> |
|
30 <context> <p><codeph>TDelimitedXxxxParser8</codeph> classes provide |
|
31 functionalities to parse delimited data, extract the current segment and parse |
|
32 the string for the next segment. </p><p>Use the class derived from <xref href="GUID-B647B6DA-5FF1-3C11-9ACD-E4A5E70F3596.dita"><apiname>TDelimitedParserBase8</apiname></xref> for |
|
33 implementing the function provided by <codeph>TDelimitedXxxxParser8</codeph>. </p><p>The |
|
34 following three classes are used to parse the respective URI components: </p> |
|
35 </context> |
|
36 <steps-unordered> |
|
37 <step id="GUID-7DE23814-1B2C-4B07-84EB-53D80D3EBBFE"><cmd/> |
|
38 <info><p><xref href="GUID-CD78AD53-FD6C-397A-9930-12E8EDCF6040.dita"><apiname>TDelimitedPathParser8</apiname></xref> for parsing path into directories |
|
39 separated by '/'. For example: <filepath>/doc_source/guide/N10047/index.html</filepath>.</p></info> |
|
40 </step> |
|
41 <step id="GUID-7DDA81B9-31D4-4DFA-A08D-5E42F10F4145"><cmd/> |
|
42 <info><p><xref href="GUID-F55AF53B-662F-3682-9B6D-A3D14AED0D58.dita"><apiname>TDelimitedPathSegmentParser8</apiname></xref> for parsing parameters |
|
43 that are separated by ';' For example: <codeph>postd=pp22;isub=1411@foo.com;user=phone</codeph>. </p></info> |
|
44 </step> |
|
45 <step id="GUID-84D83684-E711-4728-99A9-ED1EDD826F80"><cmd/> |
|
46 <info><p><xref href="GUID-F76F2546-D3AC-341B-BED8-D3C88EA2C018.dita"><apiname>TDelimitedQueryParser8</apiname></xref> for parsing the query string |
|
47 (after a '?') into name/value pairs that is separated by '&'. For example: <codeph>sortcol=4&table=1&up=0&view=details</codeph></p></info> |
|
48 <info><p>The following table shows the delimiter to be used to separate each |
|
49 of the URI components:</p><table id="GUID-9A8DAC25-B8B8-42D1-94E8-39DAEFA16DBF"> |
|
50 <tgroup cols="2"><colspec colname="col1"/><colspec colname="col2"/> |
|
51 <tbody> |
|
52 <row> |
|
53 <entry><p><b>URI Component</b></p></entry> |
|
54 <entry><p><b>Delimiter</b></p></entry> |
|
55 </row> |
|
56 <row> |
|
57 <entry><p>Path </p></entry> |
|
58 <entry><p>/</p></entry> |
|
59 </row> |
|
60 <row> |
|
61 <entry><p>Path segment </p></entry> |
|
62 <entry><p>;</p></entry> |
|
63 </row> |
|
64 <row> |
|
65 <entry><p>Query </p></entry> |
|
66 <entry><p>&</p></entry> |
|
67 </row> |
|
68 </tbody> |
|
69 </tgroup> |
|
70 </table></info> |
|
71 </step> |
|
72 </steps-unordered> |
|
73 </taskbody><related-links> |
|
74 <link href="GUID-795B41AF-FBEA-56CE-AE20-EF17BE754723.dita"><linktext>HTTP Utilities |
|
75 Library Overview</linktext></link> |
|
76 </related-links></task> |