Hallo!
Ich habe ein Problem beim Erzeugen eines XML Schemas. Also: Ich habe folgende XML Datei:
<?xml version="1.0" encoding="UTF-8"?>
<File xmlns="http://tempuri.org/Person.xsd">
<Contact>
<action>delete</action>
<city>Stadt</city>
<compname>Nike.com</compname>
<country>Austria</country>
<email>email@aon.at</email>
<fax>+43 5692664874</fax>
<firstname>Hans</firstname>
<folders></folders>
<function></function>
<handy>+43699/1056145</handy>
<identifier>123456</identifier>
<lastname>Huber</lastname>
<plz>7232</plz>
<street>Strasse 12</street>
<tel>+43 286/564144</tel>
</Contact>
<Contact>
<action>delete</action>
<city></city>
<compname>Firma 1015</compname>
<country>Österreich</country>
<email></email>
<fax>13</fax>
<firstname></firstname>
<folders>Spedition</folders>
<function></function>
<handy></handy>
<identifier>1015||1||1</identifier>
<lastname>Firma 1015</lastname>
<plz>3970</plz>
<street>Strasse 1015</street>
<tel>+43 (2856) 5551015-0</tel>
</Contact>
</File>
Ich habe ein XML Schema für diese Date erzeugt, mein PROBLEM ist dass das Schema nur ein Element <Contact> validieren kann, sobald ich einen zweiten Kontakt im XML-File habe bekomme ich die Meldung dass sich ein ungültiges Element in meinem File befindet(eben das 2. <Contact> Element.
Der aufbau meines Schemas sieht so aus:
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="XMLSchema1" targetNamespace="http://tempuri.org/Person.xsd" elementFormDefault="qualified"
xmlns="http://tempuri.org/Person.xsd" xmlns:mstns="http://tempuri.org/Person.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="File">
<xs:complexType>
<xs:sequence>
<xs:element name="Contact">
<xs:complexType>
<xs:sequence>
<xs:element name="action" type="xs:string" minOccurs="0" />
<xs:element name="city" type="xs:string" minOccurs="0" />
<xs:element name="compname" type="xs:string" minOccurs="0" />
<xs:element name="country" type="xs:string" minOccurs="0" />
<xs:element name="email" type="xs:string" minOccurs="0" />
<xs:element name="fax" type="xs:string" minOccurs="0" />
<xs:element name="firstname" type="xs:string" minOccurs="0" />
<xs:element name="folders" type="xs:string" minOccurs="0" />
<xs:element name="function" type="xs:string" minOccurs="0" />
<xs:element name="handy" type="xs:string" minOccurs="0" />
<xs:element name="identifier" type="xs:string" minOccurs="0" />
<xs:element name="lastname" type="xs:string" minOccurs="0" />
<xs:element name="plz" type="xs:string" minOccurs="0" />
<xs:element name="street" type="xs:string" minOccurs="0" />
<xs:element name="tel" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="complexType1">
<xs:sequence />
</xs:complexType>
</xs:schema>
Was kann ich beim Schema ändern damit ich mehr als einen Kontakt im XML File haben kann und diese auch von dem Schema validiert werden?
Danke für eure rasche Hilfe.
Mfg
Gerald