XML or file parser?

T

Travis

I'm about 2 years out of school. The C++ development I have been doing
has not required reading in from a config file. I haven't done file
parsing since college.

So I'm curious, hasn't there been some developments in this area in
the last few years? I feel like XML would be useful for this. Ideally
I want to characterize some strings that would otherwise be in a
struct into its own, esily editable file. Does XML (or something else
for that matter) provide an easy C++ class, etc. mechanism for
extracting the data?

I guess basically I'm asking for the full gammit of intro knowledge or
should I use a space delimited .txt file and bust out my old ifstream
knowledge. :)

Thanks for all your help, this group is invaluable.
 
O

owebeeone

I'm about 2 years out of school. The C++ development I have been doing
has not required reading in from a config file. I haven't done file
parsing since college.
....

The Austria C++ "alpha" contains a config system that includes
different types of data sources. The data source default is an XML
file.
From the test case:
.... this creates a "preference manager"
Ptr< PreferenceManager<> * > l_pm = new PreferenceManager<>();

.... this defines a "preference".
Preference< bool > l_pref1( "pref1", false, "/FooProgram", l_pm );

.... there is a notion of hierarchy ... e.g. "/FooProgram" is the area
of a preference. You can set a preference in a config file that will
set all the preferences of a particular name or set one specifically
for an area. For example, the preference system is used to manage the
logging levels for the Austria logging system and so you can turn on
logging for all the subsystems or just one by using different path
names.
 
M

mczard

I'm about 2 years out of school. The C++ development I have been doing
has not required reading in from a config file. I haven't done file
parsing since college.

So I'm curious, hasn't there been some developments in this area in
the last few years? I feel likeXMLwould be useful for this. Ideally
I want to characterize some strings that would otherwise be in a
struct into its own, esily editable file. DoesXML(or something else
for that matter) provide an easy C++ class, etc. mechanism for
extracting the data?

I guess basically I'm asking for the full gammit of intro knowledge or
should I use a space delimited .txt file and bust out my old ifstream
knowledge. :)

Hi!
You have a problem that affects many programmers - there is much
talk about XML, but it is not easily editable nor is it compatible
with C++ data types.
I recommend you trying data languages, that were designed especially
to solve that problem, for example:
http://www.yaml.org
http://harpoon.sourceforge.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top