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

S

sharan

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.
 
J

Joe Kesselman

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

(Homework assignment, right?)
 
S

sharan

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.
 
P

Pavel Lepin

sharan said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top