How to present the following data in XML format?
commandA ( a | b | c )
position = pos [(m | n | o )]
[space = space] [(m|n|o)]
[option1]
[option2 = "Hello"]
[option3]
Note: [] → indicates optional parameter
() → indicates mandatory
| → stands for any value
For instance:
commandA a position = 1.0<m> space = 2.0<n> option1 option2="Hello"
How to efficiently represent this data in xml?
I tried something like this,
<command name="commandA" position = "position" >
<option name="option1"/>
<option name="option2" value = "Hello"/>
<option name="option3"/>
</command>
But how to handle the value of the ie command a|b|cand the position of ie m|n|o?
EDIT: Command: Syntax:
commandA (a | b | c) pos = 0 [w | x | y | z] [spa = 0.0 [w | x | y | z]] [str = "Hello"]
commandA a pos = 0w spa = 0.0z str = "Hello"
I tried something like this,
<command name="commandA">
<direction>
<direction name="a"/>
<direction name="b">
<direction name="c"/>
</direction>
<parameter>
<position value="pos=0" />
<spacing value="spa=0.0" />
<options>
<option name="w"/>
<option name="x"/>
<option name="y"/>
<option name="z"/>
</options>
</parameter>
<string value="str=" />
</command>
Any suggestions on this?
source
share