smatter
smatter

Reputation: 29178

Reading Configuration xml files in C++

How can the following configuration file be read in C++. Is there any support in STL. I can't afford to use other 3rd party libraries.

<?xml version="1.0" encoding="utf-8"?> 
<appSettings>
    <add key="FileType" value="doc"/>  
    <add key="FileLength" value="102234"/>   
</appSettings>

I am not using managed C++.

Upvotes: 4

Views: 13027

Answers (3)

seanb511
seanb511

Reputation: 3

This is a link from a similar topic on StackOverflow
Using Boost to read and write XML files Which also recommends Tiny like Frerich Raabe recommended.

Upvotes: 0

Frerich Raabe
Frerich Raabe

Reputation: 94349

I suggest to use TinyXML in this case. It's a very very small XML reader, sufficiently sophisticated to parse your quoted XML document correctly. It's just two or three C++ source files which you can directly compile into your application. It has no external dependencies except the standard library and the STL.

Upvotes: 8

Joe Doliner
Joe Doliner

Reputation: 2230

STL has no support for parsing xml. If you're determined not to use a third party library then your only other option is to write a parser by hand, this seems like a pretty bad idea. Why exactly can't you afford to use third party libraries?

Upvotes: 6

Related Questions