Schreibersparnis in XSD bzw. unbenannte Elemente

TheStormy

Grünschnabel
Ich möchte in XSD folgendes ausdrücken:

Code:
<term>
	<plus>
		<zahl>4</zahl>
		<zahl>5</zahl>
	</plus>
</term>

Momentan sieht das wie folgt aus:

Code:
<xsd:complexType name="term">
	<xsd:choice>
		<xsd:element name="plus" type="plus">
		<xsd:element name="zahl" type="zahl">
	</xsd:choice>
</xsd:complexType>

<xsd:complexType name="plus">
	<xsd:sequence>
		<xsd:element name="plus" type="plus">
		<xsd:element name="zahl" type="zahl">
	</xsd:sequence>
</xsd:complexType>

Das ist allerdings ziemlich umständlich, wenn ich neue Operatoren wie Minus, Multiplikation, Division etc. hinzufügen möchte.

Ich hatte mir sowas vorgestellt wie:

Code:
<xsd:complexType name="plus">
	<xsd:sequence>
		<xsd:element type="term">
		<xsd:element type="term">
	</xsd:sequence>
</xsd:complexType>

Also Plus erwartet einfach nur zwei Elemente vom Typ "term" und der Name ist dabei egal. Ist sowas in der Art in XSD möglich? Ich möchte einfach die Dopplung im Text minimieren.

vielen Dank im voraus,
TheStormy
 
Ich habe Dein Problem noch nicht ganz durchschaut, aber ich glaube xs:group könnte helfen! Ansonsten poste doch mal ein tiefer verschachteltes XML-File.
 
Zurück