×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Regular Contributor
    Join Date
    Nov 2006
    Posts
    73

    how can i get data from xml with syexpat

    i am newbie to syexpat,i download todd's software syexpat,i can run its example, in the Elements example, the emulator display the result ln: test
    and so on,
    for example
    <head>
    <test1>mydata1</test1>
    <test2>mydata2</test2>
    <test3>mydata3</test3>
    </head>

    how can i get mydata1? if i only want to get mydata2, what shuold i do,
    i can't grasp the functions of syexpat now. can someone give me some code?

  2. #2
    Super Contributor
    Join Date
    May 2005
    Location
    Hyderabad,India
    Posts
    704

    Re: how can i get data from xml with syexpat

    Hi,

    In your XMLHelper.cpp, you can find StartElement() and CharacterData() functions, In StartElement() function you can get the element name, and attributes and values and in CharacterData() you can get the element value.

    regards,
    eswar

  3. #3
    Registered User
    Join Date
    Dec 2006
    Posts
    23

    Question Re: how can i get data from xml with syexpat

    Hey...

    I tried running GoogleIt and SyExpat on s60 3rd edition fp1 9.2v
    but it does not compile.
    Why? And how can I use XML parser for the version of sdk that I am using?

  4. #4
    Registered User
    Join Date
    Dec 2006
    Posts
    23

    Question Re: how can i get data from xml with syexpat

    Hey...
    I just read that GoogleItFinal is meant for v2 and I need to update the package file to use it for other versions. I need it for the third version. How do I go about it?

  5. #5
    Regular Contributor
    Join Date
    Nov 2006
    Posts
    73

    Re: how can i get data from xml with syexpat

    hi deepika_mangla,
    i use the 2rd winscw, about 3rd, i can tell you nothing.sorry.

    you can search "syexpat" in this forum,or in the newlc forum,you can find articles about how to install the program. one article tell me add two statement in .h file , sorry, i forget the file name.

  6. #6
    Regular Contributor
    Join Date
    Nov 2006
    Posts
    73

    Re: how can i get data from xml with syexpat

    hi, eswar_illuri, thanx for your help.

    but how to deal with the parameter of the StartElement function?
    how to link the data with struct TQualified and RArray<TAttribute>?
    could you give me a simple example?
    thanx

  7. #7
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: how can i get data from xml with syexpat

    There are 3 Example included in Symbian/Exmaple folder in SyExpat. those may help you.

  8. #8
    Regular Contributor
    Join Date
    Nov 2006
    Posts
    73

    Re: how can i get data from xml with syexpat

    Quote Originally Posted by skumar_rao
    There are 3 Example included in Symbian/Exmaple folder in SyExpat. those may help you.
    elements example?

    TSyExpatStatus status = reader->Parse(doc, ETrue);
    it doesnot display the content.
    can you give me a example?

  9. #9
    Registered User
    Join Date
    Feb 2007
    Posts
    33

    Re: how can i get data from xml with syexpat

    Quote Originally Posted by zasdfaaa
    elements example?

    TSyExpatStatus status = reader->Parse(doc, ETrue);
    it doesnot display the content.
    can you give me a example?

    Hi zasdfaaa,

    if you are using the 3rd edition then parsing the xml file is very simple

    you need to use three classes basically

    CSenXmlReader* iReader;
    CSenDomFragment* iDom;
    CSenBaseElement* iRoot;


    //make sure u include the library also
    //You need to initialise the reader and dom class firstly


    iReader = CSenXmlReader::NewL( EConvertTagsToLowerCase | ELastFeature );
    iDom = CSenDomFragment::NewL();


    //need to paas the handles of reader and dom to each other

    iDom->SetReader(*iReader);
    iReader->SetContentHandler(*iDom);


    //this is the last one which does all the parsing thru the file


    iReader->ParseL(iSession,aFileName);


    // get root of tree
    iRoot = (CSenBaseElement*)iDom->ExtractElement();
    once u get the root of the tree its the simple parsing of the tree that is required
    hope this helps

  10. #10
    Regular Contributor
    Join Date
    Nov 2006
    Posts
    73

    Unhappy Re: how can i get data from xml with syexpat

    Sohil, thank you very much!
    when i use the 3rd platform, i will deal xml follow your code.
    but ......
    i must do it in the 2rd platform...............

    thank again!

  11. #11
    Regular Contributor
    Join Date
    Nov 2006
    Posts
    73

    Re: how can i get data from xml with syexpat

    can anyone help me?please.

  12. #12
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: how can i get data from xml with syexpat

    What is the Problem with 2nd Edition. it must be straight forward there.

  13. #13
    Regular Contributor
    Join Date
    Nov 2006
    Posts
    73

    Re: how can i get data from xml with syexpat

    hi, Sohil

    i do follow your step, but,
    iRoot = (CSenBaseElement*)iDom->ExtractElement();
    the iRoot can get nothing! why?
    plz help me.
    my code:
    _LIT8(xmlcontent, " <?xml version = \"1.0\"> "
    " <testhead>1111111 "
    " <test1>22222</test1> "
    " <test2>333333</test2> "
    " <test3>444444</test3> "
    " </testhead> " );
    //TBuf8<256>xmlbuf(xmlcontent);
    //TPtrC8 xmlptrc(xmlcontent);
    //xml process

    CSenXmlReader* iReader;
    CSenDomFragment* iDom;
    CSenBaseElement* iRoot;
    iReader = CSenXmlReader::NewL( EConvertTagsToLowerCase | ELastFeature );
    iDom = CSenDomFragment::NewL();

    ////////////////////////get each other/////////////////////////////
    iDom->SetReader(*iReader);
    iReader->SetContentHandler(*iDom);
    ////////////////////////parse/////////////////////////////////
    iReader->ParseL(xmlptrc);
    ////////////////////get element////////////////////////////////
    iRoot = (CSenBaseElement*)iDom->ExtractElement(); iRoot->Child(2);// i want to read text of test1
    TPtrC8 texttptrc = iRoot->Content();//i want to write text to tprc

    can these codes get text(22222) that i want?

Similar Threads

  1. GoogleIt
    By deepika.mangla in forum Symbian
    Replies: 5
    Last Post: 2011-05-28, 11:04
  2. suckho, i have encontered the same problems. Could you tell me how you resolved it?
    By dicson_hu in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2005-12-09, 10:56
  3. GPRS connection problems on 6600..
    By suckho in forum Symbian Networking & Messaging (Closed)
    Replies: 10
    Last Post: 2005-12-02, 14:00
  4. Nokia 6600 Socket Server send delay Problem
    By dicson_hu in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-10-31, 07:37

Posting Permissions

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