Re: [libxml++] sax parser

Tim wrote:

Hi everyone

I am using the sax parser example together with this xml file (see below). The xml file is from a ISP and just reports your usage and any meassges, your plan etc,the format for this file doesn't change only the data obviouslly. My problem is the order in which things get printed to the screen, for eg... in the <MESSAGE the "TITLE" comes after "TEXT", when using that sax_example how can i change the order in which it is printed because i would like to be able to print the "title" and than "test" in that order. Also i need to be able to add up the "DOWNLOADS" in <DATA to give a total. Any help would be great

Nothing in the SaxParser itself will do that for you : informations are given to the callbacks as soon as they are parsed. If you need to reorder the informations, keep them in memory and do what you need when you got everything you need. However for this task I suggest you use DomParser : your file is small, and you will not have to code data manipulations. Unless of course you want to practice.

If you just want to transform your file into formatted text or html, you can have a look to XSLT.


You're welcome


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]