×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    118

    Doubt Regarding parsing

    Hi All

    I want to do parsing from three different files...Suppose i have three files say 1.xml, 2.xml, 3.xml.....I am now able to do for only one file i.e 1.xml....I am not getting how to do for three files...Can any one suggest me how to impliment for three files so that when i cal 2.xml data the parser has to do 2.xml data..and same for remaining....

    Thanks in advance

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,672

    Re: Doubt Regarding parsing

    If you have a hardcoded filename, you may want to change it to an argument. Then you could invoke the same method 3 times, with the different filenames.
    If the problem is about a failed attempt to re-use the CParser object, where you get EXmlJunkAfterDocElement (-991) when starting to parse the second file, note that parsing a single file has to be surrounded with ParseBeginL-ParseEndL.

  3. #3
    Registered User
    Join Date
    Sep 2011
    Posts
    118

    Re: Doubt Regarding parsing

    Yes I have hardcoded filenames as market_2.xml, product.xml, liogin.xml....Can u tell me how to change them to arguments...

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    India
    Posts
    1,173

    Re: Doubt Regarding parsing

    wizard_hu_ might want to say that the function which you are calling for parsing should have an argument which can accept file names. When you want to parse file1's contents then pass this file name in that argument and so on (according to the file which you wan to parse). Hence only the mentioned file's contents would be parsed.

    You can make a funciton like
    StartParsing(const TDes& aFileName)
    Code:
    {
    }
    then call
    Code:
    StartParsing(_L("fileName1"):
    StartParsing(_L("fileName2"):
    etc.

  5. #5
    Registered User
    Join Date
    Sep 2011
    Posts
    118

    Re: Doubt Regarding parsing

    Ok...My parsing code is like this..
    //Parse xml file after received from server
    CXEDomEx* domEx = CXEDomEx::NewLC();
    domEx->StartParseL((static_cast<CMSSSAppUi *> (AppUi()))->iParseData);
    (static_cast<CMSSSAppUi *> (AppUi()))->StoreLoginDetails(domEx);
    CleanupStack::PopAndDestroy(domEx);


    void CXEDomEx::StartParseL(HBufC8* aParseData)
    {
    TRAPD(err, ParseExampleL(aParseData));
    }


    Now tell me your valuable suggestion...Please have a glance at my code...

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    India
    Posts
    1,173

    Re: Doubt Regarding parsing

    You are passing data for parsing in
    Code:
    domEx->StartParseL((static_cast<CMSSSAppUi *> (AppUi()))->iParseData); // via AppUi()))->iParseData
    So, you need to read the required file's data into the buffer "iParseData". Like if you want file1's contents to be parsed, then iParseData should contan file1's contents only. For file2 to be parsed, "iParseData" should have file2's content and so on.

  7. #7
    Registered User
    Join Date
    Sep 2011
    Posts
    118

    Re: Doubt Regarding parsing

    Yes first i sending first file data into iparse data like this
    delete (static_cast<CMSSSAppUi *> (AppUi()))->iParseData;
    (static_cast<CMSSSAppUi *> (AppUi()))->iParseData = NULL;
    (static_cast<CMSSSAppUi *> (AppUi()))->iParseData = HBufC8::NewL(0);

    For second file if i want to send into iparse data....From how can i modify above code...please give some idea..In my code for second file also iparse data is like this
    delete (static_cast<CMSSSAppUi *> (AppUi()))->iParseData;
    (static_cast<CMSSSAppUi *> (AppUi()))->iParseData = NULL;
    (static_cast<CMSSSAppUi *> (AppUi()))->iParseData = HBufC8::NewL(0);

  8. #8
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    India
    Posts
    1,173

    Re: Doubt Regarding parsing

    By the following line, you are just making a new HBufC type variable to hold data.
    Code:
    (static_cast<CMSSSAppUi *> (AppUi()))->iParseData = HBufC8::NewL(0);
    But you did not showed the way you are reading file's contents into this HBufC type variable. So, the way you are reading file1's contents into "iParseData", should also be used for reading other files contents. Like if you are doing:

    Code:
    HBufC* iParseData = HBufC::NewL(1000);
    iParseData->ReadFromFile(); // your way of reading file1's contents
    iParseData->StartParsing();
    // now you might be saving that parsed data here. You can now do
    iParseData = NULL;
    iParseData->ReadFromFile(); // do it for file2's contents as well
    iParseData->StartParsing();

Similar Threads

  1. Doubt in MMF
    By gobi_est in forum Symbian
    Replies: 3
    Last Post: 2010-05-25, 14:27
  2. Doubt in s
    By kiransvnit in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2009-12-03, 15:08
  3. A doubt!
    By Madz.R in forum Symbian
    Replies: 7
    Last Post: 2008-10-18, 07:47
  4. doubt
    By chirpylife in forum Symbian
    Replies: 1
    Last Post: 2008-10-10, 04:37
  5. Doubt
    By jigneshshah in forum Bluetooth Technology
    Replies: 1
    Last Post: 2005-02-16, 22:39

Posting Permissions

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