XML Schema & rel to a attribute

webmasterbeta

New Member
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.voutat-family.com"
xmlns:tns="http://www.voutat-family.com"
elementFormDefault="qualified">
<xs:element name="family">
<xs:complexType>
<xs:sequence>
<xs:element name="relative" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="birth" type="xs:string"/>
<xs:element name="death" type="xs:string"/>
<xs:element name="mail" type="xs:string" minOccurs="0"/>
<xs:element name="wife" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="birth" type="xs:string"/>
<xs:element name="death" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="father" minOccurs="0">
<xs:complexType>
<xs:attribute name="person" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="child" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="person" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


I would like to relate the attribute person of the elements father & child to the attribute id of the element relative. How can I do that, please? Was looking at W3schools but it only shows how to do it for simple elements.

Thanks:o
 
Back
Top