Using Variables in XML

Everytime I use xml internally in actionscript I always forget how to make use of variables and constants.

Take the follwoing code:

 <player name="Brenton" number="7" position="RW">
        <round number="1" goals="7" assists="4" foulsFor="1" foulsAgainst="2" saves="0" goalsConceded="0" bonus="3" />
</player>

Now as there begins to be multiple players the round number will be generic between players so we might as well make it a constant.
This is achieved by adding curly braces {} around the constant name. {ROUND_1}

 <player name="Brenton" number="7" position="RW">
        <round number={ROUND_1} goals="7" assists="4" foulsFor="1" foulsAgainst="2" saves="0" goalsConceded="0" bonus="3" />
</player>

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Related posts

Comments

June 3. 2009 14:26

This code is quite simple and I think everyone will understand it!

Clara

Comments are closed