Re: [xml] Raw parsing an XML file or via xmlReader?



Hi Ricky,

The scenario:
- I need to read, parse, and then write an XML file that contains my
tool configuration settings.
XMLReader is useful when you want configuration settings read from a config.xml file to your own structures. Creating XML from your structures towards a libxml tree can be done using the tree API (or the writer)


- The file contains sections that may be re-used when the tool wants to
export/import partial settings.
Partial settings can be dumped by selecting the right node (start point for your partial data) and write that part to a file. (or memory)
- The file may reach a size of 200KBytes..
Should not be too much of an issue (except when you are doing things on very low memory based hardware)

Questions:
- Should I use raw parsing (as in the examples on the tutorial) or use
xmlReader?
I would suggest the xmlReader if you need these config settings used in your software. You can keep the configuration by using xmlTextReaderCurrentDoc() to manipulate and store it at a later time by using the raw tree API.

- When creating the file, should I use xmlWritter?
See: http://xmlsoft.org/examples/testWriter.c
I did not do anything with writer (yet) but it seems a nice and easy way to create the configuration XML from scratch. As soon as you have an existing configuration XML, the tree API might be more useful.

Kind Regards,

Olger




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