Witam
Mam problem ze schematem XSD. Jestem laikiem w tym temacie a potrzebuje stworzyć schemat do już istniejącego XML. Uproszczony kod poniżej:
<?xml version="1.0" encoding="Windows-1250"?>
<ZoznamDanovychSubjektovRegistrovanychPreSpotrebneDane>
<CIS_SPDS>
<ITEM>
<REGISTRACNECISLO>SK51000900001</REGISTRACNECISLO>
<NAZOVSUBJEKTU>IMPREX, s.r.o.</NAZOVSUBJEKTU>
</ITEM>
<ITEM>
<REGISTRACNECISLO>SK51000900001</REGISTRACNECISLO>
<NAZOVSUBJEKTU>IMPREX, s.r.o.</NAZOVSUBJEKTU>
</ITEM>
</CIS_SPDS>
</ZoznamDanovychSubjektovRegistrovanychPreSpotrebneDane>
Próbuje tym sposobem i nic nie zwraca, nie wywala też błędu:
<?xml version="1.0" encoding="windows-1250" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="ZoznamDanovychSubjektovRegistrovanychPreSpotrebneDane">
<xs:complexType>
<xs:sequence>
<xs:element name="CIS_SPDS">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="ITEM">
<xs:complexType>
<xs:sequence>
<xs:element name="REGISTRACNECISLO" type="xs:string"/>
<xs:element name="NAZOVSUBJEKTU" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Wcześniej robiłem taki schemat, który widać poniżej dla podobnego pliku i tam działało elegancko. Nie rozumiem dlaczego w powyższym schemacie nie znajduje mi żadnych danych. Byłbym wdzięczny za jakąś podpowiedz.
XML
<baza data="01.06.2017 12:18:34" data_unix="1496312314"><rekord id="51876941">
<pole1 nazwa="Nazwa przedsiębiorstwa">DS SERVICE Sp. z o.o.</pole1><pole2 nazwa="DKN">24866</pole2></rekord></baza>
XSD działający
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="baza">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="rekord">
<xs:complexType>
<xs:sequence>
<xs:element name="pole1" type="xs:string"/>
<xs:element name="pole2" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>