[Expat-discuss] help for a program
Muhammad Rizwan Khan
rizwan at advcomm.net
Sat Feb 26 12:15:55 CET 2005
Thanks of all for helping me.
I have almost solved all of the isses related to xml parsing, but there
is little problem. I am still unable to find function which can return
me contents embeded in element. e.g <test>contents of element</test>. I
can't access the "contents of element" string. Although i read
documentation but still facing this problem. Another thing is that
explite documentation is little complex for newbie.
If any body know how i can solve this problem, please let me know about.
Thanks
On Fri, 2005-02-25 at 21:26, William Park wrote:
> On Fri, Feb 25, 2005 at 12:51:25PM +0500, Muhammad Rizwan Khan wrote:
> >
> > Hello
> >
> > 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
>
> If you want to do this in C, then you actually have to read the doc and
> examples. (www.libexpat.org).
>
> If you want to do this in shell, then use my patch to Bash
> (http://freshmeat.net/projects/bashdiff/). Play around with
>
> start () { # Usage: start tag att=value ...
> echo
> echo -n "$1"
> }
> data () { # Usage: data data
> echo -n " $*"
> }
> xml -s start -d data '<test>...</test>'
>
> If you're interested in data for <inner> tags only, then
>
> data () {
> case ${XML_ELEMENT_STACK[1]} in
> inner) echo -n " $*" ;;
> esac
> }
>
More information about the Expat-discuss
mailing list