• Advertisement
Sign in to follow this  

best xml layour

This topic is 4726 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

<game>
     <newobject name="John" ... />
     <killobject name="Tree" ... />
</game>
or
<game>
      <object>
           <new name="John" ... />
           <kill name="Tree" ... />
      </object>
</game>
provided theres going to be lots of other elements in the <game> namespace, do you think the latter or the previous one looks better?

Share this post


Link to post
Share on other sites
Advertisement
I'd prefer the first, it looks neater. But there's not really much difference. I suppose the first way will use less memory and be faster to parse, but that's just a side effect. Don't base your choice solely on that.

Share this post


Link to post
Share on other sites
Agreed. Also it seems illogical to me to group commands by that upon which they are acting.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
i would go for something more along the lines of the second version.. trying to give the xml document's data more meaning. obviously in the first version both and are entities that must have something incommon. i'd say it depends on what exactly you're using the and items for... i suspect that these describe actions in your game now .. you 'new' an object.. and you 'kill' another. or maybe these describe properties of objects...
i would then go ahead and take this notion of actions (or properties - again, i don't know what you're doing with these xml elements exactly) and transform them directly into xml.








that's how i'd approach this decision.. do not try to throw everything into the element. try to layer things. whenever there's a block of data that has a special meaning to your game.. i'd create a new layer describing that meaning.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster








Share this post


Link to post
Share on other sites
its more like setting up a scene. you can do things like add a character, destroy a character, add sounds, events .etc

Share this post


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

  • Advertisement