<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by Paul (thx) -->
<!-- edited with XML Spy v4.1 U (http://www.xmlspy.com) by Peter Reichstädter (CIO) -->
<!--Generisches Schema zum Speichern und Austauschen von Personendaten
    (c) 2001-2002 Chief Information Office Austria, Stabsstelle IKT-Strategie des Bundes, BM֖LS
    Kontakt: Peter Reichstädter (peter.reichstaedter@cio.gv.at), Arno Hollosi (arno.hollosi@cio.gv.at)
    Die freie Verwendung dieses Schemas in Applikationen (behördenintern, kommerziell, privat) ist erlaubt und erwünscht.
-->  
<!-- 
	Adaptierung URV URSuche v3.0 für Ersb Schnittstelle
	===================================================
	2012-10-08 sml  Stiege und Türnummer in ERsB Request
	2012-09-20 sml  NichtNatuerlichePerson um ErsbAttributes erweitert
	2012-09-11 sml  IdentificationType um Beginn und Ende erweitert
	2012-09-03 sml  IdentificationType um ErsbAttributes erweitert
	2012-08-07 sml	kein mixed Content bei den Zusatzdaten mehr möglich
	2012-07-05 sml	Any-Attribute und Any-Elemente nach AGII-Empfehlung durch die konkreten ersetzt.
	2012-06-14 sml	Affix wieder auf unbounded (vgl. URSucheService UDB)
 -->
<?xml-stylesheet type="text/xsl" href="getelementnames.xslt"?>

<xs:schema targetNamespace="http://statistik.at/namespace/ersb/persondata/1#" 
	xmlns="http://statistik.at/namespace/ersb/persondata/1#" 
	xmlns:xs="http://www.w3.org/2001/XMLSchema" 
	xmlns:uri="http://statistik.at/namespace/ersb/1#"
	xmlns:urs="http://statistik.at/namespace/ur/stammdaten/2#"
	xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0.0">
	
	<!-- Import der ERSB-suche -->

	<xs:import namespace="http://statistik.at/namespace/ersb/1#"
		schemaLocation="ersb-types.xsd" />
	 
	 
	<!-- Import UR Suche -->
	<xs:import namespace="http://statistik.at/namespace/ur/stammdaten/2#"
		schemaLocation="ur-basicTypes.xsd" />
	
	
	<xs:annotation>
		<xs:documentation>This version of person deploys only global elements. All types derived from abstract types have been replaced by substitution groups</xs:documentation>
	</xs:annotation>
	<!-- ### signed structure of a person  ### -->
	<xs:element name="AbstractPersonData" type="AbstractPersonType">
		<xs:annotation>
			<xs:documentation>Abstraktes PersonenDaten Element, nur auf englisch verfügbar, nicht direkt benützen sondern PersonenDaten benutzen</xs:documentation>
		</xs:annotation>
	</xs:element>
	
	<xs:element name="PersonenDaten" type="PersonenDatenTyp" substitutionGroup="AbstractPersonData">
		<xs:annotation>
			<xs:documentation>Signierte Personendatenstruktur</xs:documentation>
		</xs:annotation>
	</xs:element>

	<!-- ### base type for person data ### -->
	<xs:element name="Person" type="AbstractPersonType">
		<xs:annotation>
			<xs:documentation>Abstraktes Personen Element, nur auf englisch verfügbar, nicht direkt benützen sondern NatuerlichePerson o. NichtNatuerlichePerson benutzen</xs:documentation>
		</xs:annotation>
	</xs:element>
	<!-- ### physical person and corporate body ### -->
	<xs:element name="NatuerlichePerson" type="NatuerlichePersonTyp" substitutionGroup="Person">
		<xs:annotation>
			<xs:documentation>Natuerliche Person entspricht PhysicalPerson, ist eine Ableitung von Person (abstract)</xs:documentation>
		</xs:annotation>
	</xs:element>

	<xs:element name="NichtNatuerlichePerson" type="NichtNatuerlichePersonTyp" substitutionGroup="Person">
		<xs:annotation>
			<xs:documentation>NichtNatuerlichePerson entspricht CorporatzeBody, ist Ableitung von Person (abstract)</xs:documentation>
		</xs:annotation>
	</xs:element>

	<!--### complex child elements of person, also available as standalone ###-->
	<xs:element name="PersonenName" type="PersonenNameTyp">
		<xs:annotation>
			<xs:documentation>Container für diverse Namensbestandteile, entspricht Name in der englischen Version</xs:documentation>
		</xs:annotation>
	</xs:element>


	
	<!-- ### adress data for various types of communications ### -->
	<xs:element name="Address" type="AbstractAddressType">
		<xs:annotation>
			<xs:documentation>Abstraktes Address Element, nur auf Englisch verfügbar, nicht direkt benützen sondern PostAdresse, InternetAdresse, etc benutzen</xs:documentation>
		</xs:annotation>
	</xs:element>
	<xs:element name="PostAdresse" type="PostAdresseTyp" substitutionGroup="Address">
		<xs:annotation>
			<xs:documentation>Post oder ZMR Adresse, entspricht PostalAddress, ist Ableitung von Address (abstract)</xs:documentation>
		</xs:annotation>
	</xs:element>

	<xs:element name="TypisiertePostAdresse" type="TypisiertePostAdresseTyp" substitutionGroup="Address">
		<xs:annotation>
			<xs:documentation>Typisierte Post oder ZMRAdresse, entspricht TypedPostalAddress, ist Ableitung von Address (abstract) </xs:documentation>
		</xs:annotation>
	</xs:element>
	
  <!--### elements of simple type ####-->
	<xs:element name="Geburtsdatum" type="GeburtsdatumTyp">
		<xs:annotation>
			<xs:documentation>Geburtsdatum, entspricht DateOfBirth</xs:documentation>
		</xs:annotation>
	</xs:element>
		

	<!--### Complex types ###-->

	
	<!-- UR Spezialisierung des PersonenDatenTyp -->
	<xs:complexType name="PersonenDatenTyp">
		<xs:annotation>
			<xs:documentation>Container um eine Person und ihre Adressen zu speichern</xs:documentation>
		</xs:annotation>
		<xs:complexContent>
			<xs:extension base="AbstractPersonType">
				<xs:sequence>
					<!-- UR-Spezialisierung -->
					<xs:element ref="NichtNatuerlichePerson"/>
					
					<!-- UR-Spezialisierung -->
					<xs:element ref="TypisiertePostAdresse" minOccurs="0" maxOccurs="unbounded" />
					
					<xs:element name="Zusatzdaten" minOccurs="0">
						<xs:complexType mixed="false">
							<xs:sequence minOccurs="0">
								<!-- Erweiterung UR -->
								<xs:element ref="uri:Bestandszeitraum" minOccurs="0" maxOccurs="unbounded" />
								<xs:element ref="uri:Bestandsnachweis" minOccurs="0" maxOccurs="unbounded" />
								<xs:element ref="uri:Vertretung" 	   minOccurs="0" maxOccurs="unbounded" />
								<xs:element ref="uri:Rechtstatsachen"  minOccurs="0" maxOccurs="unbounded" />
								<xs:element name="PersonenDaten" 	  type="PersonenDatenZusatzdatenTyp" minOccurs="0" maxOccurs="unbounded" />
							</xs:sequence>
						</xs:complexType>
					</xs:element>	
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	
	<!-- UR Spezialisierung für natürliche und nichtnatürliche Personen in den Zusatzdaten-->
	<xs:complexType name="PersonenDatenZusatzdatenTyp">
		<xs:annotation>
			<xs:documentation>Container um eine Person und ihre Adressen zu speichern</xs:documentation>
		</xs:annotation>
		<xs:complexContent>
			<xs:extension base="AbstractPersonType">
				<xs:sequence>
					<!-- UR-Spezialisierung -->
					<xs:choice minOccurs="0">
						<xs:element ref="NichtNatuerlichePerson"/>	
						<xs:element ref="NatuerlichePerson"/>				
					</xs:choice>
					<!-- UR-Spezialisierung -->
					<xs:element ref="TypisiertePostAdresse" minOccurs="0" maxOccurs="unbounded" />
					
					<xs:element name="Zusatzdaten" minOccurs="0">
						<xs:complexType mixed="false">
							
							<xs:sequence minOccurs="0">
								<!-- Erweiterung UR -->
								<xs:element ref="urs:EvbStatus"  	minOccurs="0" maxOccurs="1" />
								<xs:element ref="uri:Funktion"  	minOccurs="0" maxOccurs="unbounded" />
								<xs:element ref="uri:Rechtstatsachen"  minOccurs="0" maxOccurs="unbounded" />
							</xs:sequence>
						</xs:complexType>
					</xs:element>	
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>	
	
	
<xs:complexType name="IdentificationType">
		<xs:annotation>
			<xs:documentation>Container für beliebige Identifikationsmerkmale, besteht aus Type und Value Unterelementen, aus technischen Gründen nur auf Englisch verfügbar</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="Value">
				<xs:annotation>
					<xs:documentation>actual value of the identifier.</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="Id" type="xs:ID" use="optional"/>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="Type" type="xs:anyURI">
				<xs:annotation>
					<xs:documentation>type of value (eg 'ZMR', 'SV-Nummer', 'Martrikelnummer', database identification, ...)</xs:documentation>
				</xs:annotation>
			</xs:element>
			<!-- Erweiterung Ersb -->
			<xs:element ref="uri:Beginn" minOccurs="0" maxOccurs="1" />
			<xs:element ref="uri:Ende"   minOccurs="0" maxOccurs="1" />
					
		</xs:sequence>
		<xs:attribute name="Id" type="xs:ID" use="optional"/>
		<!-- Erweiterung Ersb -->
		<xs:attributeGroup ref="uri:ErsbAttributes" />	
			
	</xs:complexType>
	
	
			
	<xs:complexType name="AbstractPersonType">
		<xs:annotation>
			<xs:documentation>main structure of person data</xs:documentation>
		</xs:annotation>
		<xs:choice minOccurs="0">
			<xs:element name="Identification" type="IdentificationType" minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>unique identification entities</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:choice>
		<xs:attribute name="Id" type="xs:ID" use="optional"/>
	</xs:complexType>
		
	
	<xs:complexType name="NatuerlichePersonTyp">
		<xs:annotation>
			<xs:documentation>entspricht PhysicalPersonType</xs:documentation>
		</xs:annotation>
		<xs:complexContent>
			<xs:extension base="AbstractPersonType">
				<xs:sequence minOccurs="0">
					<xs:element ref="PersonenName" minOccurs="0"/>
					<xs:element ref="Geburtsdatum" minOccurs="0"/>
				</xs:sequence>
				<!-- Erweiterung UR -->
				<xs:attributeGroup ref="uri:ErsbAttributes" />	
			</xs:extension>
				
		</xs:complexContent>
	</xs:complexType>
	
		
	
	
	<xs:complexType name="NichtNatuerlichePersonTyp">
		<xs:annotation>
			<xs:documentation>entspricht CorporateBodyType</xs:documentation>
		</xs:annotation>
		<xs:complexContent>
			<xs:extension base="AbstractPersonType">
				<xs:sequence minOccurs="0">
					<xs:element name="VollerName" type="xs:token" minOccurs="0">
						<xs:annotation>
							<xs:documentation>name of corporate body (whole name)</xs:documentation>
						</xs:annotation>
					</xs:element>
					
					<xs:element name="Rechtsform" type="xs:anyURI" minOccurs="0">
						<xs:annotation>
							<xs:documentation>type of company (eg AG, OHG, ...)</xs:documentation>
						</xs:annotation>
					</xs:element>
					
					<!-- Erweiterung UR -->
					<xs:element ref="uri:UntName" minOccurs="0" maxOccurs="unbounded" />
					<xs:element ref="uri:Rechtsform" minOccurs="0" maxOccurs="unbounded" />
					
				</xs:sequence>
				<!-- Erweiterung Ersb -->
				<xs:attributeGroup ref="uri:ErsbAttributes" />	
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
		
		

	<xs:complexType name="PersonenNameTyp">
		<xs:annotation>
			<xs:documentation>entspricht NameType</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="Vorname" type="xs:string" minOccurs="1" maxOccurs="1"/>
			<xs:element name="Familienname" minOccurs="1" maxOccurs="1">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="primaer" default="undefiniert">
								<xs:simpleType>
									<xs:restriction base="xs:string">
										<xs:enumeration value="wahr"/>
										<xs:enumeration value="falsch"/>
										<xs:enumeration value="undefiniert"/>
									</xs:restriction>
								</xs:simpleType>
							</xs:attribute>
							<xs:attribute name="prefix" type="xs:string"/>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="Affix" minOccurs="0" maxOccurs="unbounded">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="typ" use="optional">
								<xs:simpleType>
									<xs:restriction base="xs:string">
										<xs:enumeration value="akademischerGrad"/>
										<xs:enumeration value="Adelstitel"/>
										<xs:enumeration value="FamiliennamenAffix"/>
										<xs:enumeration value="Anrede"/>
										<xs:enumeration value="Generation"/>
										<xs:enumeration value="Qualifikation"/>
									</xs:restriction>
								</xs:simpleType>
							</xs:attribute>
							<xs:attribute name="position" use="optional">
								<xs:simpleType>
									<xs:restriction base="xs:string">
										<xs:enumeration value="prefix"/>
										<xs:enumeration value="suffix"/>
									</xs:restriction>
								</xs:simpleType>
							</xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
		

	
	<xs:complexType name="AbstractAddressType">
		<xs:annotation>
			<xs:documentation>Struktur des Abstrakten Address Elements</xs:documentation>
		</xs:annotation>

		<xs:attribute name="Id" type="xs:ID" use="optional"/>
	</xs:complexType>
	
	
	
	<xs:complexType name="TypisiertePostAdresseTyp">
		<xs:annotation>
			<xs:documentation>entspricht TypedPostalAddressType</xs:documentation>
		</xs:annotation>
		<xs:complexContent>
			<xs:extension base="AbstractAddressType">
				<xs:sequence minOccurs="0">
					<xs:element ref="PostAdresse"/>				
					<!-- Erweiterung UR -->
					<xs:element ref="urs:Typ" minOccurs="1" maxOccurs="1" />			
				</xs:sequence>
				<!-- Erweiterung UR -->
				<xs:attributeGroup ref="uri:ErsbAttributes" />	
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	
		
	<xs:complexType name="PostAdresseTyp">
		<xs:annotation>
			<xs:documentation>entspricht PostalAddressType</xs:documentation>
		</xs:annotation>
		<xs:complexContent>
			<xs:extension base="AbstractAddressType">
				<xs:sequence>
					<xs:element name="Staatscode" minOccurs="0">
						<xs:annotation>
							<xs:documentation>Staatencode, ISO Code oder internationaler Post code, entspricht CountryCode</xs:documentation>
						</xs:annotation>
						<xs:simpleType>
							<xs:restriction base="xs:string">
								<xs:pattern value="[A-Z]{3}"/>
							</xs:restriction>
						</xs:simpleType>
					</xs:element>
					<xs:element name="Postleitzahl" type="xs:token" minOccurs="0">
						<xs:annotation>
							<xs:documentation>entspricht PostalCode</xs:documentation>
						</xs:annotation>
					</xs:element>

					<xs:element name="Gemeinde" type="xs:string" minOccurs="0">
						<xs:annotation>
							<xs:documentation>entspricht Municipality</xs:documentation>
						</xs:annotation>
					</xs:element>
					<xs:element name="Gemeindekennziffer" minOccurs="0"/>
					<xs:element name="Ortschaft" type="xs:token" minOccurs="0"/>
					<xs:element name="Zustelladresse" minOccurs="0">
						<xs:annotation>
							<xs:documentation>Zustelladresse oder ZMRAdresse, entspricht DeliveryAddress</xs:documentation>
						</xs:annotation>
						<xs:complexType>
							<xs:sequence>
								<xs:element name="Strassenname" type="xs:string" minOccurs="0">
									<xs:annotation>
										<xs:documentation>Bei Ortschaften ohne Straßenname steht hier Ortschaftsname, entspricht StreetName</xs:documentation>
									</xs:annotation>
								</xs:element>
								<xs:element name="Orientierungsnummer" type="xs:string" minOccurs="0">
									<xs:annotation>
										<xs:documentation>Hausnummer oder Konskriptionsnummer, z.B. 10, 124a, 78-80. Entpricht BuildingNumber</xs:documentation>
									</xs:annotation>
								</xs:element>
								<xs:element name="Gebaeude" type="xs:token" minOccurs="0">
									<xs:annotation>
										<xs:documentation>Gebäudeteil oder eigneens Gbäude, z.B. Stiege, Werkstatt, ..... Entspricht Unit</xs:documentation>
									</xs:annotation>
								</xs:element>
								<xs:element name="Nutzungseinheit" type="xs:token" minOccurs="0">
									<xs:annotation>
										<xs:documentation>Tuernummer oder andere  naehere Beschreibung der Adresse (z.B. 4. Stock rechts). Entspricht DoorNumber</xs:documentation>
									</xs:annotation>
								</xs:element>
							</xs:sequence>
						</xs:complexType>
					</xs:element>
				</xs:sequence>	
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	


	<!-- ### auxiliary types ### -->
	<xs:simpleType name="GeburtsdatumTyp">
		<xs:annotation>
			<xs:documentation>einfacher Datentyp für Daten (union): Tag und/oder Monta können ausgelassen werden, entspricht DayOfBirthType</xs:documentation>
		</xs:annotation>
		<xs:union memberTypes="xs:date xs:gYearMonth xs:gYear"/>
	</xs:simpleType>	

</xs:schema>