Skip to main content
gamedev.net
🔒 Locked

XML parser

Started by Omikron 14 replies 2.5k views
Original Post
Omikron
Omikron
What''s a good C/C++ XML parser?
Ninebit
Ninebit
I use something called tiny xml. some simple classes that parses xml for you... it cannot handle all the fancy extra stuff that xml is about, but it is a minimal lib for parsing the tree structure with the data. enough for games i''d say.
"I could be off endlessly perfecting my 3d engine, but instead I am cursed with the task of actually finishing something, it sucks."
Ishan
Ishan
Oh come on, be a real man / woman and write your own. I hammered one out in an afternoon, and it only took 150 lines.
davidkosenina
davidkosenina
Helo

I am yust starting to use TinyXML and I must say that is
easy to use, fast, averything you want from a xml parser!

Bye!
ChaosEngine
ChaosEngine
can someone post a link? I googled for it but only found java versions and the home page was down
if you think programming is like sex, you probably haven't done much of either.-------------- - capn_midnight
steg
steg
MSXML seems good and is well tested, supports both SAX and DOM.

As for writing your own, well, I disagree, I don''t think Microsoft wrote MSXML in an afternoon!

If it isn't working, take a bath, have a think and try again...
drslush
drslush
Sure, reinventing the wheel might not be too hard, but using one already invented will probably be rounder and roll faster ;-D
scalp
scalp
expat (http://www.jclark.com/xml/expat.html) is good and fast, specially if you want to parse big files. LibXML is very good too.
Both are in C, so you might want to use one of the C++ wrapper available.

Nico
cgoat
cgoat
I use Xerces C++.

[edited by - cgoat on April 29, 2003 1:39:04 PM]
Ishan
Ishan
quote:
Original post by Kylotan
DOM or SAX? What access functionality does it allow? What's performance like?

Want to post code?





Now, I've kept this thing really simple, because it's just for crunching data for my game engine. Basically it consumes xml like:

?xml version="1.0" ?
folder name="console"
string name="promptbeg" ( /string
string name="promptend" )# /string
float name="max_lines" 200 /float
float name="max_remember" 20 /float
vec4 name="color" {0,0.2,0,1} /vec4
folder name="font"
string name="face" Arial /string
/folder
/folder

which can be accessed as follows:


xml xmlfile("file.xml");
string promptbeg = xmlfile.get("/console/promptbeg");
float max_lines = xmlfile.get("/console/max_lines");


Really simple, I'd admit, but it's fast as hell and it makes a very easy interface for storing preferences.

PS Anyone know how to post XML without having the damn bulletin board software strip your tags off?

[edited by - Ishan on April 29, 2003 2:21:08 PM]

[edited by - Ishan on April 29, 2003 2:23:13 PM]

[edited by - Ishan on April 29, 2003 2:48:28 PM]
Kyo
Kyo
quote:
Original post by Anonymous Poster
what utility have a the web xml language in game programming?


A fancy .cfg I think.

Shannon Barber
Shannon Barber
If you wanted to go nuckingfutz, you could store your level data in zip-wad packed xml (kinda like Dungeon Seige).
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.