using expat parser how to build a tree shaped data structure of a xml document and read the value fr

Discussion in 'XML' started by sharan, Nov 3, 2007.

  1. sharan

    sharan Guest

    using expat parser how to build a tree shaped data structure of a xml
    document and read the value from it in c language so that whenever we
    gave a key as a input it give the vale of that key.
    i have to do this without using DOM and Schema, just make a general
    tree from xml document which contains the tag value and attribute
    value on each node.
    means root node have user, its child node user1, user2, user3, and
    each child node have name, age, department and each node have this
    key along its value(either text or attributes value)
    my xml file is:
    <?xml version="1.0"?>
    <users>
    <user id="1" text="hello">
    <name> Hari Oum </name>
    <age> 24 </age>
    <department> Product Development </department>
    </user>

    <user id="2">
    <name> Sandeep </name>
    <age> 23 </age>
    <department> VoiceXML Applications </department>
    </user>

    <user id="3">
    <name> Jeganathan </name>
    <age> 24 </age>
    <department> Java Applications </department>
    </user>

    </users>
    if i give the key for user2 --name than it print Sandeep if give for
    user 3 key --age then it will print 24, so please help me without use
    DOM and schema. i have little bit idea about expat parser.
    sharan, Nov 3, 2007
    #1
    1. Advertising

  2. Re: using expat parser how to build a tree shaped data structureof a xml document and read the value from it in c language

    Read up on the SAX APIs, then read Expat's documentation. Then write code.

    (Homework assignment, right?)

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Joe Kesselman, Nov 3, 2007
    #2
    1. Advertising

  3. sharan

    sharan Guest

    On Nov 3, 7:56 pm, Joe Kesselman <> wrote:
    > Read up on the SAX APIs, then read Expat's documentation. Then write code.
    >
    > (Homework assignment, right?)
    >
    > --
    > () ASCII Ribbon Campaign | Joe Kesselman
    > /\ Stamp out HTML e-mail! | System architexture and kinetic poetry


    i know about expat parser i want only a idea about that how to
    implement data structure (tree ) to read xml document.
    sharan, Nov 4, 2007
    #3
  4. Re: using expat parser how to build a tree shaped data structureof a xml document and read the value from it in c language

    sharan schrieb:

    > i know about expat parser i want only a idea about that how to
    > implement data structure (tree ) to read xml document.


    Have a look at this wrapper:

    http://www.nongnu.org/scew/

    Other wrappers can be found here:

    http://expat.sourceforge.net/#wrappers
    =?ISO-8859-1?Q?J=FCrgen_Kahrs?=, Nov 4, 2007
    #4
  5. sharan

    Pavel Lepin Guest

    sharan <> wrote in
    <>:
    > On Nov 3, 7:56 pm, Joe Kesselman
    > <> wrote:
    >> Read up on the SAX APIs, then read Expat's documentation.
    >> Then write code.
    >>
    >> (Homework assignment, right?)

    >
    > i know about expat parser i want only a idea about that
    > how to implement data structure (tree ) to read xml
    > document.


    Refer to the notes you've been jotting down in your Data
    Structures and/or C classes. If you haven't been taking
    notes, practice asking "Would you want fries with that?" in
    front of a mirror.

    --
    "I can't help but wonder if you... don't know a hell of a
    lot more about practically every subject than Solomon ever
    did."
    Pavel Lepin, Nov 5, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sharan
    Replies:
    5
    Views:
    2,306
    sidsverma
    Aug 26, 2011
  2. sharan
    Replies:
    1
    Views:
    718
    Pavel Lepin
    Oct 26, 2007
  3. Replies:
    2
    Views:
    941
    Joseph Kesselman
    Nov 5, 2007
  4. sharan
    Replies:
    2
    Views:
    305
    Stefan Behnel
    Nov 16, 2007
  5. Dwight Army of Champions

    How do you install expat and XML::Parser on Mac OS x?

    Dwight Army of Champions, Nov 12, 2011, in forum: XML
    Replies:
    0
    Views:
    2,343
    Dwight Army of Champions
    Nov 12, 2011
Loading...

Share This Page