Wie werden die folgenden Daten im XML-Format dargestellt?Wie werden die folgenden Daten in XML dargestellt?
commandA (a | b | c)
position = pos [(m | n | o)]
[space = space] [(m|n|o)]
[option1]
[option2 = "Hello"]
[option3]
Hinweis: [] -> bezeichnet optional,
() -> bezeichnet Pflicht
| -> bezeichnet jemand des Wertes
ZB:
commandA a position = 1.0<m> space = 2.0<n> option1 option2="Hello"
Wie effektiv diese Daten in XML darstellen?
Ich habe versucht, so etwas wie dieses,
<command name="commandA" position = "position" >
<option name="option1"/>
<option name="option2" value = "Hello"/>
<option name="option3"/>
</command>
Aber wie den Befehlswert d.h a|b|c
und Position zu handhaben d.h m|n|o
?
EDIT: Befehl: Syntax:
Commanda (a | b | c) pos = 0 [w | x | y | z] [spa = 0,0 [w | x | y | z]] [ str = "Hallo"]
Commanda a pos = 0W spa = 0.0z str = "Hallo"
ich so etwas wie dies versucht,
<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>
Irgendwelche Vorschläge zu diesem Thema?
Schauen Sie in das Erstellen einer XML-DTD oder eines Schemas, um bestimmte Attribute auf bestimmte Werte zu beschränken. DTDs sind einfacher zu schreiben, Schemata sind flexibler. –
Danke. Ich suche nach einer einfachen XML-Darstellung aufgrund von Implementierungsbeschränkungen. –
DTDs sind wohlgeformte XML. Die DTD kann sogar direkt in der XML-Datei platziert werden. –