×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    113

    How to Read text with html tag & save it in Tbuf8...

    Dear Sir,

    I have a response message like -

    MessageClass:Response;Value:3;IMSI:89014103211118510720;MobileNumber:9988763979;MessageID:1234;NetworkCode:02;CountryCode:404;Request:MessageClass:Action;OpName:Airtel;UniqueCode:UwwQmWZ3;Response:CIAPlanDataXML;ResponseStatus:Success;Category:Silver;PlanData:<PlanData><Service Name="MO">
    <PlanName Name="MO98Silver">
    <Activation>
    <SentTo>18</SentTo>
    <Msg>Msg18</Msg>
    </Activation>
    <Deactivation>
    <SentTo>118</SentTo>
    <Msg>Msg118</Msg>
    </Deactivation>
    <ReplyDetail>
    <ReplyFrom>121</ReplyFrom>
    <ReplyText>Silver</ReplyText>
    </ReplyDetail>
    </PlanName>
    <PlanName Name="MO599Silver">
    <Activation>
    <SentTo>21</SentTo>
    <Msg>Msg21</Msg>
    </Activation>
    <Deactivation>
    <SentTo>121</SentTo>
    <Msg>Msg121</Msg>
    </Deactivation>
    <ReplyDetail>
    <ReplyFrom>121</ReplyFrom>
    <ReplyText>five99</ReplyText>
    </ReplyDetail>
    </PlanName>
    <PlanName Name="MO249Silver">
    <Activation>
    <SentTo>19</SentTo>
    <Msg>Msg19</Msg>
    </Activation>
    <Deactivation>
    <SentTo>119</SentTo>
    <Msg>Msg119</Msg>
    </Deactivation>
    <ReplyDetail>
    <ReplyFrom>121</ReplyFrom>
    <ReplyText>249</ReplyText>
    </ReplyDetail>
    </PlanName>
    <PlanName Name="MO0Silver">
    <Activation>
    <SentTo>20</SentTo>
    <Msg>Msg20</Msg>
    </Activation>
    <Deactivation>
    <SentTo>120</SentTo>
    <Msg>Msg120</Msg>
    </Deactivation>
    <ReplyDetail>
    <ReplyFrom>121</ReplyFrom>
    <ReplyText>zero</ReplyText>
    </ReplyDetail>
    </PlanName>
    <PlanName Name="3GVideoTakiesSilver">
    <Activation>
    <SentTo>15</SentTo>
    <Msg>Msg15</Msg>
    </Activation>
    <Deactivation>
    <SentTo>115</SentTo>
    <Msg>Msg115</Msg>
    </Deactivation>
    <ReplyDetail>
    <ReplyFrom>121</ReplyFrom>
    <ReplyText>3g</ReplyText>
    </ReplyDetail>
    </PlanName>
    <PlanName Name="3GSilver">
    <Activation>
    <SentTo>14</SentTo>
    <Msg>Msg14</Msg>
    </Activation>
    <Deactivation>
    <SentTo>114</SentTo>
    <Msg>Msg114</Msg>
    </Deactivation>
    <ReplyDetail>
    <ReplyFrom>121</ReplyFrom>
    <ReplyText>3g</ReplyText>
    </ReplyDetail>
    </PlanName>
    <PlanName Name="3GmobileTvSilver">
    <Activation>
    <SentTo>16</SentTo>
    <Msg>Msg16</Msg>
    </Activation>
    <Deactivation>
    <SentTo>116</SentTo>
    <Msg>Msg116</Msg>
    </Deactivation>
    <ReplyDetail>
    <ReplyFrom>121</ReplyFrom>
    <ReplyText>Mbl</ReplyText>
    </ReplyDetail>
    </PlanName>
    <PlanName Name="3GhandsetCompatibilitySilver">
    <Activation>
    <SentTo>17</SentTo>
    <Msg>Msg17</Msg>
    </Activation>
    <Deactivation>
    <SentTo>117</SentTo>
    <Msg>Msg117</Msg>
    </Deactivation>
    <ReplyDetail>
    <ReplyFrom>121</ReplyFrom>
    <ReplyText>Compatibility</ReplyText>
    </ReplyDetail>
    </PlanName>
    </Service>
    </PlanData>;Count:8;

    I want to read this message & save its in log file using file system.
    I have a function by which we read this message as a output result. please see below code-
    Code:
    __ns2__Execute(&request,&response);//response is type of class _ns1__ExecuteResponse which have char* variable
    
    	_ns1__ExecuteResponse result;
    	char *res;
    	result=response;
    	res=result.ExecuteResult;  //char *ExecuteResult;
    	TBuf<2048> out;
    	TText* output=(TText16*)res;  
    	out.Copy(output);
                    log(out);
    
    // log file contains response only (MessageClass:Response;OpName:Airtel;UniqueCode:UwwQmWZ3;Value:3;MobileNumber:9988763979;CountryCode:404;MessageID:1234;IMSI:89014103211118510720;NetworkCode:02;Response:CIAPlanDataXML;ResponseStatus:Success;Category:Silver;PlanData:<PlanData>\r\n  <Service N)
    
    rest of string not save in log file.
    Please suggest how to read text message which contain html tag and how to convert it in to tbuf8?

    thanx in advance!!!

    Regards,
    Satish

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,545

    Re: How to Read text with html tag & save it in Tbuf8...

    That's not HTML. The closest way to describe it is somewhat invalid XML. Look for XML parser examples, for starters.

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: How to Read text with html tag & save it in Tbuf8...

    HTML, XML does not really matter until you just want to print/save the data. Your TBuf contains the complete data, it is just the displayed text what is truncated, Printf and similar methods can not print very long text.

  4. #4
    Registered User
    Join Date
    Oct 2010
    Posts
    113

    Re: How to Read text with html tag & save it in Tbuf8...

    Dear Sir,
    Thnax for reply.

    below message is the out put of the xml to string conversion by asp.net.(web service gives xml form message & its converted to string format by .net framwork).

    i want to save the response message in file & read when ever we have requirement. Please suggest how to save complete message in a text file & how to read that file?

    I am also reading for xml parser in symbian sax & dom parser available but with sax only small data can parsed with reference to below exampl-http://www.developer.nokia.com/Community/Wiki/How_to_parse_XML_file_using_CParser_class . in this example only some data is parse.

    please suggest for DOM parser if possible.

    Regards,
    Satish

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: How to Read text with html tag & save it in Tbuf8...

    I have no experience with the DOM parsers, the built-in API what you could check are CSenDomFragment+CSenXmlReader
    If you have data in a 8-bit descriptor, it is rather easy to save it, RFile::Write and Read both work with 8-bit descriptors, so you can save/load exactly the data type you already have. Prior to that RFile::Create/Replace can create you a file, and Open opens an existing one. At the end, use RFile::Close.
    You can find some CParser example with explanation, and a file handling example without explanation on http://avalon.aut.bme.hu/~wizard

  6. #6
    Registered User
    Join Date
    Oct 2010
    Posts
    113

    Re: How to Read text with html tag & save it in Tbuf8...

    Dear Sir,
    Thanx a lot for response..!
    Now I am able to save all response message in text file. My next road map is to split that message with key/value pair with special symbol( : & ; ). After splitting we want to parse the value of key Plan data which is in xml format.
    Please suggest how to split & save string in key value pair.


    Regards,
    Satish

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: How to Read text with html tag & save it in Tbuf8...

    Descriptors have fancy Locate and Mid methods. There is also Find, just Locate is optimized for working with single characters, like the separators you mention.

Similar Threads

  1. Replies: 2
    Last Post: 2010-06-16, 11:01
  2. save html text of a vew in wrt widget
    By kuddy_abc in forum Symbian
    Replies: 1
    Last Post: 2010-05-29, 17:09
  3. how can read from TBuf8?
    By silver_man82 in forum Symbian
    Replies: 1
    Last Post: 2005-05-03, 10:30
  4. Use 6610 to read a HTML page
    By kceric in forum Browsing and Mark-ups
    Replies: 2
    Last Post: 2003-11-07, 07:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •