Jump to content
  • Advertisement
Sign in to follow this  
Replicon

XML question

This topic is 4450 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have almost zero experience with XML, and was wondering if there's a good place to find good design guidelines for it. I'm playing with TinyXML, and am thinking of storing my config files in XML format in my current project, so as to avoid having to write yet another parser. I'm just interested in random design guidelines, like when is it good to do this:
<Difficulty val="easy" />
as opposed to this:
<Difficulty>easy</Difficulty>
and so on and so forth. cheers!

Share this post


Link to post
Share on other sites
Advertisement
I prefer not to use attributes, but that's just me. You can read more at w3schools.com, just click XML to the left.

Share this post


Link to post
Share on other sites
Attributes have to be uniquely named per node so

<game difficulty="high"/>

would be preferable as

<game difficulty="low" difficulty="high"/>

would not be well-formed.

whereas
<game>
<difficulty>high</difficulty>
<difficulty>low</difficulty>
</game>

isn't obviously wrong.

Share this post


Link to post
Share on other sites
Ah, the W3Schools had quick and useful information on the matter. They seem to prefer nested elements to attributes. I think that will make my stuff easier to write too. I'll save attributes for more complex things, or things that can be globally applicable.

cheers!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!