Schönen guten Tag,
wie kann ich eine 1:1 Relation in einer XML Schema Definition darstellen? Ich hab leider nur wenige Beispiele gefunden die aber nicht so ganz verstanden...
Daher habe ich mal selbst ein Beispiel genommen, wäre voll nett wenn es jemand ergänzen könnte.
Ich hoffe es ist selbsterklärend bzw gut dokumentiert
tia;(
[XML]<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsd:documentation>
(c) Marcel Flaig - codemagic.net
This ement is a complexType which consist of a short abreviation and a long name for each unit.
longname starts with a capital letter, shortname doesn't.
</xsd:documentation>
<!-- complexType Unit -->
<xs:element name="Unit">
<xs:complexType>
<xs:sequence>
<xs:element name = "Unit_shortname" type = "unit_shortname" />
<xs:element name = "Unit_longname" type = "unit_longname" />
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- unit shortname -->
<xs:simpleType name="unit_shortname">
<xs:restriction base="xs:string">
<xs:enumeration value="ml"/>
<xs:enumeration value="l"/>
<xs:enumeration value="pcs"/>
<xs:enumeration value="g"/>
<xs:enumeration value="kg"/>
</xs:restriction>
</xs:simpleType>
<!-- unit longname -->
<xs:simpleType name="unit_shortname">
<xs:restriction base="xs:string">
<xs:enumeration value="MilliLiter"/>
<xs:enumeration value="Liter"/>
<xs:enumeration value="Pieces"/>
<xs:enumeration value="Gramm"/>
<xs:enumeration value="Kilo-Gramm"/>
</xs:restriction>
</xs:simpleType>
[/XML]
Also das hier z.B. hatte ich gelesen: XML - Managing Data Exchange/The one-to-one relationship - Wikibooks, open books for an open world
Was mir halt absolut nicht klar ist wo die Schlüssel sind... also primary key und foreign key
wie kann ich eine 1:1 Relation in einer XML Schema Definition darstellen? Ich hab leider nur wenige Beispiele gefunden die aber nicht so ganz verstanden...
Daher habe ich mal selbst ein Beispiel genommen, wäre voll nett wenn es jemand ergänzen könnte.
Ich hoffe es ist selbsterklärend bzw gut dokumentiert
tia;(
[XML]<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsd:documentation>
(c) Marcel Flaig - codemagic.net
This ement is a complexType which consist of a short abreviation and a long name for each unit.
longname starts with a capital letter, shortname doesn't.
</xsd:documentation>
<!-- complexType Unit -->
<xs:element name="Unit">
<xs:complexType>
<xs:sequence>
<xs:element name = "Unit_shortname" type = "unit_shortname" />
<xs:element name = "Unit_longname" type = "unit_longname" />
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- unit shortname -->
<xs:simpleType name="unit_shortname">
<xs:restriction base="xs:string">
<xs:enumeration value="ml"/>
<xs:enumeration value="l"/>
<xs:enumeration value="pcs"/>
<xs:enumeration value="g"/>
<xs:enumeration value="kg"/>
</xs:restriction>
</xs:simpleType>
<!-- unit longname -->
<xs:simpleType name="unit_shortname">
<xs:restriction base="xs:string">
<xs:enumeration value="MilliLiter"/>
<xs:enumeration value="Liter"/>
<xs:enumeration value="Pieces"/>
<xs:enumeration value="Gramm"/>
<xs:enumeration value="Kilo-Gramm"/>
</xs:restriction>
</xs:simpleType>
[/XML]
Also das hier z.B. hatte ich gelesen: XML - Managing Data Exchange/The one-to-one relationship - Wikibooks, open books for an open world
Was mir halt absolut nicht klar ist wo die Schlüssel sind... also primary key und foreign key
Zuletzt bearbeitet: