Code:
1 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 2 3 <xsd:complexType name="banken_t"> 4 <xsd:sequence maxOccurs="1"> 5 <xsd:element name="bank" type="bank_t" maxOccurs="unbounded"/> 6 <xsd:element name="CEO" type="xsd:string"/> 7 </xsd:sequence> 8 <xsd:attribute name="holding" type="xsd:string" use="required"/> 9 </xsd:complexType> 10 11 <xsd:complexType name="bank_t"> 12 <xsd:sequence> 13 <xsd:element name="chef" type="chef_t"/> 14 <xsd:element name="gründungsjahr" type="xsd:gYear"/> 15 <xsd:element name="kunden" type="kunden_t"/> 16 <xsd:element name="wertpapierkennung" type="wpk_t" minOccurs="0"/> 17 </xsd:sequence> 18 <xsd:attribute name="name" type="xsd:string" use="required"/> 19 <xsd:attribute name="ort" type="xsd:string" use="required"/> 20 <xsd:attribute name="land" type="xsd:string" use="optional"/> 21 </xsd:complexType> 22 23 <xsd:simpleType name="chef_t"> 24 <xsd:restriction base="xsd:string"> 25 <xsd:maxLength value="10"/> 26 </xsd:restriction> 27 </xsd:simpleType> 28 29 <xsd:complexType name="kunden_t"> 30 <xsd:attribute name="firmen" type="xsd:nonNegativeInteger" use="required"/> 31 <xsd:attribute name="privat" type="xsd:nonNegativeInteger" use="required"/> 32 </xsd:complexType> 33 34 <xsd:simpleType name="wpk_t"> 35 <xsd:restriction base="xsd:string"> 36 <xsd:length value="12"/> 37 </xsd:restriction> 38 </xsd:simpleType> 39 40 <xsd:element name="banken" type="banken_t"> 41 <xsd:unique name="xxx"> 42 <xsd:selector xpath="bank"/> 43 <xsd:field xpath="chef"/> 44 </xsd:unique> 45 </xsd:element> 46 47</xsd:schema>
Meine Vorschläge wären:
Zeile 25 maxlength
Zeile 30 und 31 nonNegativeInteger
Zeile 36 length
Zeile 42 und 43 xpath
das sind mMn nicht in DTD realisierbar
a) stimmt das?
b) was sonst noch?
Es ist eine Prüfungsvorbereitung, daher würde ich mich freuen, wenn ihr mir da helfen könntet!
EDIT: zusätzliche Frage zu SEQUENCE:
wenn sequence mit minOccurs = 2 steht, element-reihenfolge A, B, C (elemente ohne min oder maxoccurs)
wäre meine einschätzung des XML-Files folgende:
<a/>
<b/>
<c/>
<a/>
<b/>
<c/>
..
..
andere reihenfolge ist nicht möglich, nur weitere a,b,c 's
ist das richtig?
und wenn ja, was ist dann, wenn z.B. B auch minOccurs hat, allerdings = 0
ist dann
<a/>
<b/>
<c/>
<a/>
<c/>
möglich?
Vielen Dank!