Hello, Here is how it can be done with SAX parser. (Faster and less memory consuming than DOM).
Data structures: 1. A list/map of data "student" objects. 2. A "student" object will keep a record of one name and ID. Algorithm - handling events: 1. Start document - build empty list of objects. 2. Start element <student> - created new "student" object to keep student's name and ID. 3. End element <name> - store name value in created "student" object. 4. End element <ID> - store ID value in created "student" object. 5. End element <student> - add the created "student" object to list of objects. 6. End document - search the list of objects for particular student and perform actions. For building SAX parser I would recommend source code generator tool from System Integrated Automaton package - http://www.geocities.com/siaparser/. Thank you, Robert --- Jordan C N Chong <[EMAIL PROTECTED]> wrote: > Dear all, > > I am a newbie at this. I have a tree structure, say > like this: > > O School > / \ > O O Class > / \ | > O O O Student > ...... > > Now, here is the XML document > <School> > <Class no="1"> > <Student> > <Name>Michael</Name> > <ID>0110</ID> > </Student> > </Class> > <Class no="2"> > <Student> > <Name>William</Name> > <ID>0111</ID> > </Student> > <Student> > <Name>Freddy</Name> > <ID>0113</ID> > </Student> > </Class> > </School> > > My question is, how could I traverse this tree, to > locate the Student by > Name "William" (e.g to get his ID number)? In other > words, I wish to find > William in this XML. Please give me a hint and some > help. Thousand thanks > for all your supports. Wish you all the best. > > > Regards, > Jordan > > Best regards, > -------------------------------------------- > Jordan Cheun Ngen, Chong > INF-4067 Universiteit Twente > Postbus 217 > 7500 AE Enschede > The Netherlands > > Distributed and Embedded Systems (DIES) > -------------------------------------------- > Office Phone: +31 53 4894655 > Web site: http://www.cs.utwente.nl/~chong > Email Add.: [EMAIL PROTECTED] > ============================================ > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __________________________________________________ Do You Yahoo!? Find the one for you at Yahoo! Personals http://personals.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
