I am writing a program which gets various info from xml files. One of the sections of the xml file is a list of commands which will be executed by the program in order. Each command will have children to provide the data needed for the command so the nodes used will vary depending on the command.
What I'm wondering is whether it is better practice to use this:
or this:
Further info (in case it makes a difference)...
The files will be used in a java/jsp application for editing and python scripts for executing the commands, probably using xml.dom.minidom for the python (ie no xpath processing).
Eventually I will be needing to put the xml files through some kind of verification to make sure the commands have been constructed correctly - ideally this would be through a schema.
What I'm wondering is whether it is better practice to use this:
Code:
<command enabled='true'>
<action>MOVE</action>
<direction>FW</direction>
<distance>10</distance>
<speed>3</speed>
</command>
<command enabled='true'>
<action>ROTATE</action>
<degrees>-10</degrees>
</command>
Code:
<command enabled='true'>
<MOVE>
<direction>FW</direction>
<distance>10</distance>
<speed>3</speed>
</MOVE>
</command>
<command enabled='true'>
<ROTATE>
<degrees>-10</degrees>
</ROTATE>
</command>
Further info (in case it makes a difference)...
The files will be used in a java/jsp application for editing and python scripts for executing the commands, probably using xml.dom.minidom for the python (ie no xpath processing).
Eventually I will be needing to put the xml files through some kind of verification to make sure the commands have been constructed correctly - ideally this would be through a schema.