Archived

This topic is now archived and is closed to further replies.

skeitaridaudans

XML parser

Recommended Posts

Hi I really feel like it might be a good idea to use xml to describe the attributes of certain elements and objects I''m using in a game. I am familliar with XML, have used DOM in java and once I wrote a parser that could parse exactly one (small) type of XML file I used in a C++ project. So my question is not about XML in general but about whether any of you have been using it in C++, what parsers you have used and what experience you have with them. Also if they were free to use in any way or not. As a bonus it would also be fun to know how you feel about using XML in games and if you have tried it already. thanks in advance, Kári.

Share this post


Link to post
Share on other sites
Well you did ask more questions than just "what''s a good parser", I just thought it was amusing that it had the same title and I clicked on it thinking it was the thread from yesterday.

Share this post


Link to post
Share on other sites
Yeah, well. I thought it would be nice to get a little community conversation on this topic (and still do) so I just skimmed the first page for anything similar but didn''t expect the first post on page 2 to be practicly the same.
Anyway, I read the other post and checked out the links but it still didn''t answer the "have you used it and how do you like it" question. So if anyone still has anything to add that would be greeeeeaaaat! If not this post will just quietly roll down to the infamous "page 2".

Share this post


Link to post
Share on other sites

Ahhh XML, all the penalties of a uncompressed, text-based file with none of the benefits.


well, not *no* benefits... it does have the advantage of being human-readable (though many c-style scripting languages are also).

It''s touted for its extensibility, when really that''s not a very unique property. Of course, few commercial text-parsers out there give you the ability to add your own keywords but that''s not really much of an advantage when you have to deal with proprietary code and file sizes that are 25-35% larger compared to scripts that serve the same purpose.

I guess the only benefit that I actually think redeemable is that a lot of companies are implementing it. Compliance with a standard messaging format is a much-anticipated thing, but it still doesn''t really make that large of an impact in the games industry where companies rarely share the data for their games with each other.

I''m currently on a research project where the messaging amongst the servers and to the client is all done in an XML format, so I''m cornered into using it. I sometimes wish it didn''t take so many bytes to send a simple message but it does help with debugging occasionally. I''m working on a way to send XML code blocks that surround a custom scripting language -- then you could extend the different types of scripts, and even specify the module(s) that are the intended recipients of scripting events entirely based on what type of script-format it is. (Modules would register to listen to a script type, specified by an XML tag)... of course, all that would require writing my own XML parser, whose rules may change at the next iteration of the commercial standard -- but like I said, the messaging protocol probably wouldn''t be shared anyway.

What I would like to see is a messaging format where the debug mode has human-readable text, but at compilation time the tags are converted using something like an ELF-Hash to a messaging format that is much more compact. It is entirely feasible... I just don''t know how many companies would buy into it. Maybe if the debug-mode version was entirely compatible with XML formatted tags...

Share this post


Link to post
Share on other sites
Proprietary code? XML is not a MS nor Sun thing.
Calling XML ''human readable'' is a little bit of a stretch though
It''s .ini files on steroids, and I''m all for it, because I *hate* the Windows registry.

Free XML parsers:
Tiny XML
Xerces XML


And if the compression thing really bothers you:
zlib


- Magmai Kai Holmlor

"No, his mind is not for rent to any god nor government" - Rush, Tom Sawyer

[Look for information | GDNet Start Here | GDNet Search Tool | GDNet FAQ | MSDN RTF[L] | SGI STL Docs | STFW | Asking Smart Questions ]

[Free C++ Libraries | Boost | ACE | Loki | MTL | Blitz++ | wxWindows| Spirit(xBNF)]
[Free C Libraries | zlib ]

Share this post


Link to post
Share on other sites
Didn't the Quickdown Lowdown on XML go over all of this?

_______________________________

"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses


ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | LANL | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.


[edited by - bishop_pass on April 30, 2003 11:19:40 AM]

Share this post


Link to post
Share on other sites