Я должен написать схемы на основе моего кода XML с заданной структурой.Например:
- Исполнитель или группа: строковые значения;обязательно
- Члены группы: строковое значение, это может происходить один раз, более одного раза или вообще не быть
- Жанр: строковое значение, должно встречаться хотя бы один раз для каждого исполнителя или группы;требуется
Я пытался написать схему, но чувствую себя потерянным ...
Код для XML-файла:
<Albums>
<artist personorgroup="person" groupmembernames="N/A" artistorgroupcountry="United States"
careerBegin="2015" careerend="N/A" artistName="Cardi B" genre="Rap">
<album albumCategory="Grammy Nominee" albumName="Invasion of Privacy" sku="K315SPR19A"
type="album">
<Comment> Absolute trash, it's a travesty this won a Grammy </Comment>
<Rating> 13/13 </Rating>
<albumArt> Cardi B.jpg <!-- Found from albumartexchange.com -->
</albumArt>
<releases>
<release release="Invasion of Privacy (clean lyrics)" releasedate="2018-04-05"
recordlabel="Atlantic (Warner Music imprint), KSR Group"
recordlabelcatalognumber="N/A" barcodenumber="075679873675" country="US"
format="Digital Media"> </release>
<release release="Invasion of Privacy (explicit)"
releasedate="2018-04-05 / 2018-04-06 / 2018-04-06"
recordlabel="Atlantic (Warner Music imprint), KSR Group"
recordlabelcatalognumber="N/A" barcodenumber="075679873682"
country="XW
CA
US"
format="Digital Media"> </release>
</releases>
<Songs>
<song songposition="1" songlength="3:51"
songcomposersandwriters="Sean Allen / Belcalis Almanzar / Maurice Jordan / Jermaine Preyan / James SwanQo / Anthony Tucker / Robert Williams"
songName="Get Up 10" sku="K315SPR19A001" albumref="K315SPR19A" type="song"> </song>
<song songposition="2" songlength="4:23"
songcomposersandwriters="Belcalis Almanzar / Kirsnick Ball / Kiari Cephus / Joshua Cross / Quavious Marshall"
songName="Drip (feat. Migos)" sku="K315SPR19A002" albumref="K315SPR19A"
type="song"> </song>
<song songposition="3" songlength="3:01"
songcomposersandwriters="Belcalis Almanzar / James Foye III / Philip Coleman, Jr. / Austin Owens / Jordan Thorpe"
songName="Bickenhead" sku="K315SPR19A003" albumref="K315SPR19A" type="song"> </song>
<song songposition="4" songlength="3:43"
songcomposersandwriters="Belcalis Almanzar / Laquan Green / J. White Did It / Dieuson Octave / Klenord Raphael / Jordan Thorpe / Jermaine White"
songName="Bodak Yellow" sku="K315SPR19A004" albumref="K315SPR19A" type="song"> </song>
<song songposition="5" songlength="3:30"
songcomposersandwriters="Belcalis Almanzar / Alan Bergman / Marilyn Bergman / Dennis Coles / Robert Diggs / Adam Feeney / Gary Grice / Marvin Hamlisch / Lamont Hawkins / Anderson Hernandez / Lauryn Hill / Jason Hunter / Russell Jones / Matthew Samuels / Clifford Smith / Jordan Thorpe / U-God / Corey Woods"
songName="Be Careful" sku="K315SPR19A005" albumref="K315SPR19A" type="song"> </song>
<song songposition="6" songlength="4:44"
songcomposersandwriters="Belcalis Almanzar / Chancelor Bennett / Allen Ritter / Matthew Samuels"
songName="Best Life" sku="K315SPR19A006" albumref="K315SPR19A" type="song"> </song>
<song songposition="7" songlength="4:13"
songcomposersandwriters="Belcalis Almanzar / José Álvaro Osorio Balvin / Benito Antonio Martinez Ocasio / Tony Pabon / Manny Rodriguez"
songName="I Like It" sku="K315SPR19A007" albumref="K315SPR19A" type="song"> </song>
<song songposition="8" songlength="2:57"
songcomposersandwriters="Belcalis Almanzar / Khari Cain / Nija Charles / Kehlani Parrish / Mike Riley"
songName="Ring" sku="K315SPR19A008" albumref="K315SPR19A" type="song"> </song>
<song songposition="9" songlength="3:49"
songcomposersandwriters="Belcalis Almanzar / Jordan Thorpe / Jermaine White"
songName="Money Bag" sku="K315SPR19A009" albumref="K315SPR19A" type="song"> </song>
<song songposition="10" songlength="3:44"
songcomposersandwriters="Shayaa Bin Abraham-Joseph / Belcalis Almanzar / Samuel Gloade / Darryl McCorkell"
songName="Bartier Cardi (feat. 21 Savage)" sku="K315SPR19A010"
albumref="K315SPR19A" type="song"> </song>
<song songposition="11" songlength="3:50"
songcomposersandwriters="Belcalis Almanzar / Keenon Jackson / Leslie Andre Wakefield Jr. / Dijon McFarlane"
songName="She Bad" sku="K315SPR19A011" albumref="K315SPR19A" type="song"> </song>
<song songposition="12" songlength="3:08"
songcomposersandwriters="Belcalis Almanzar / Benjamin Levin / Alexandra Tamposi / Justin Tranter / Andrew Wotman"
songName="Thru Your Phone" sku="K315SPR19A012" albumref="K315SPR19A" type="song"> </song>
<song songposition="13" songlength="3:20"
songcomposersandwriters="Belcalis Almanzar / Nija Charles / Kevin Gomringer / Tim Gomringer / Shane Lindstrom / Solana Rowe"
songName="I Do" sku="K315SPR19A013" albumref="K315SPR19A" type="song"> </song>
</Songs>
<producersMixersSongwritersEngineers>
<engineersMixers> Leslie Brathwaite & Evan LaRay </engineersMixers>
<songwriters> Belcalis Almanzar & Jorden Thorpe </songwriters>
<masteringEngineer> Colin Leonard </masteringEngineer>
</producersMixersSongwritersEngineers>
</album>
</artist>
<artist personorgroup="person" groupmembernames="N/A" artistorgroupcountry="United States"
careerBegin="2004" careerend="N/A" artistName="Brandi Carlile" genre="Pop/Rock">
<album albumCategory="Grammy_Nominee" albumName="By The Way, I Forgive You" sku="K315SPR19B"
type="album">
<Comment> Haven't listened, not my taste </Comment>
<Rating> 11/13 </Rating>
<albumArt> Brandi Carlile.jpg <!-- Found from albumartexchange.com -->
</albumArt>
<releases>
<release release="By the Way, I Forgive You" releasedate="2018-02-16"
recordlabel="Elektra (1950–1989, revived 2009–06-01; read annotations before use), Low Country Sound"
recordlabelcatalognumber="565226-2" barcodenumber="075678659188" country="US"
format="CD"> </release>
<release release="By the Way, I Forgive You (mastered for iTunes)"
releasedate="2018-02-16"
recordlabel="Elektra (1950–1989, revived 2009–06-01; read annotations before use)"
recordlabelcatalognumber="N/A" barcodenumber="075679885449" country="US"
format="Digital Media"> </release>
</releases>
<Songs>
<song songposition="1" songlength="4:01"
songcomposersandwriters="Brandi Carlile / Phil Hanseroth / Tim Hanseroth"
songName="Everytime I Hear That Song" sku="K315SPR19B001" albumref="K315SPR19B"
type="song"> </song>
<song songposition="2" songlength="4:39"
songcomposersandwriters="Brandi Carlile / Dave Cobb / Phil Hanseroth / Tim Hanseroth"
songName="The Joke" sku="K315SPR19B002" albumref="K315SPR19B" type="song"> </song>
<song songposition="3" songlength="4:22"
songcomposersandwriters="Brandi Carlile / Phil Hanseroth / Tim Hanseroth"
songName="Hold Out Your Hand" sku="K315SPR19B003" albumref="K315SPR19B"
type="song"> </song>
<song songposition="4" songlength="3:16"
songcomposersandwriters="Brandi Carlile / Phil Hanseroth / Tim Hanseroth"
songName="The Mother" sku="K315SPR19B004" albumref="K315SPR19B" type="song"> </song>
<song songposition="5" songlength="4:07"
songcomposersandwriters="Brandi Carlile / Phil Hanseroth / Tim Hanseroth"
songName="Whatever You Do" sku="K315SPR19B005" albumref="K315SPR19B" type="song"> </song>
<song songposition="6" songlength="4:43"
songcomposersandwriters="Brandi Carlile / Phil Hanseroth / Tim Hanseroth"
songName="Fulton County Jane Doe" sku="K315SPR19B006" albumref="K315SPR19B"
type="song"> </song>
<song songposition="7" songlength="4:28"
songcomposersandwriters="Brandi Carlile / Phil Hanseroth / Tim Hanseroth"
songName="Sugartooth" sku="K315SPR19B007" albumref="K315SPR19B" type="song"> </song>
<song songposition="8" songlength="3:51"
songcomposersandwriters="Brandi Carlile / Phil Hanseroth / Tim Hanseroth"
songName="Most of All" sku="K315SPR19B008" albumref="K315SPR19B" type="song"> </song>
<song songposition="9" songlength="4:06"
songcomposersandwriters="Brandi Carlile / Phil Hanseroth / Tim Hanseroth"
songName="Harder to Forgive" sku="K315SPR19B009" albumref="K315SPR19B"
type="song"> </song>
<song songposition="10" songlength="5:47"
songcomposersandwriters="Brandi Carlile / Phil Hanseroth / Tim Hanseroth"
songName="Party of One" sku="K315SPR19B10" albumref="K315SPR19B" type="song"
> </song>
</Songs>
<producersMixersSongwritersEngineers>
<producers> Dave Cobb & Shooter Jennings </producers>
<engineersMixers> Dave Cobb & Eddie Spear
</engineersMixers>
<songwriters> Brandi Carlile, Phil Hanseroth & Tim
Hanseroth </songwriters>
<masteringEngineer> Pete Lyman </masteringEngineer>
</producersMixersSongwritersEngineers>
</album>
</artist>
Код схемы:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="personorgroup" type="xs:string"> </xs:element>
<xs:element name="groupmembernames" type="xs:string"> </xs:element>
<xs:element name="artistorgroupcountry" type="xs:string">
</xs:element>
<xs:element name="careerBegin" type="xs:string"> </xs:element>
<xs:element name="careerend" type="xs:string"> </xs:element>
<xs:element name="artistName" type="xs:string"> </xs:element>
<xs:element name="genre" type="xs:string"> </xs:element>
<xs:element name="artist">
<xs:complexType>
<xs:sequence>
<xs:element ref="artist">
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>