[Expat-discuss] help for a program

Nick MacDonald nickmacd at gmail.com
Fri Feb 25 15:13:28 CET 2005


Hmmm...  Been following the list now for a while, and am noticing a
trend... is there no Expat FAQ to point these people to?

Anyway... in answer to your question...  Start with the example
program, and play with it to understand it.  Then expand it to do what
you want.  It is a pretty easy exercise.

Expat makes calls back into your code each time it recognizes an
"event", such as the start of an XML tag, the contents between two
tags, and the end of a tag.  Because it works this way, you quite
probably need to build a stack (the data structure) to push and pop
tags onto so you know the "context" of the file you are in.

Good luck...


On Fri, 25 Feb 2005 12:51:25 +0500, Muhammad Rizwan Khan
<rizwan at advcomm.net> wrote:
> I am new to this library and XML. I want to write a program which 'll be
> given a xml packet (file) it 'll parse the packet and 'll return the
> values.
> Input to the program is as follows:
> <test>
>       <one>
>              <inner>stuff</inner>
>         <inner>stuff1</inner>           .               .               .        </one>
> </test>
> output should be as:
> test
> one
> inner stuff
> inner stuff1
> ....
> 
> Can you please guide me how i can do that, speically:
> inner stuff inner stuff1 ... stuff


More information about the Expat-discuss mailing list