xml dtd problem

0

Zaprojektuj model danych, które mogą być przechowywane przez bibliotekę. Biblioteka posiada kilka magazynów. Każdy magazyn posiada półki z książkami i czasopismami z danej dziedziny, np. “Technika”, “biologia”, “filozofia”.
W poniższych zadaniach przygotuj plik XML z wewnętrznym schematem DTD. Do walidacji możesz użyć np. usługi dostępnej pod adresem:
Zadeklaruj, że głównym elementem pliku powinien być węzeł “library”.
Spraw, by węzeł “library” miał jeden lub więcej węzłów “storage”.
Spraw, by węzeł “storage” posiadał jeden lub więcej węzłów “shelf”.
Spraw, by każdy węzeł “shelf” posiadał obowiązkowo atrybut “domain”.
Zaprojektuj elementy “book” i “magazine” z odpowiednimi węzłami wewnętrznymi (np. tytuł, autor, itp.)

Zadania domowe

Zaprojektuj model danych, które mogą być przechowywane przez sklep. Sklep posiada kilka działów. Każdy dział posiada półki z towarami innego typu, np. “spożywcze”, “papiernicze”, “odzież”.
Zaprojektuj model danych analogicznie, jak w przypadku biblioteki. (3 pkt)
Zaprojektuj co najmniej trzy typy produktów. (1 pkt)

Wyskakuje mi taki błąd

This page contains the following errors:

error on line 1 at column 7: Malformed declaration expecting version
Below is a rendering of the page up to the first error.

Oto mój kod

<?xml encoding="UTF-8"?>

<!ELEMENT collection (storage)>
<!ATTLIST collection
  xmlns CDATA #FIXED ''>

<!ELEMENT storage (genre)+>
<!ATTLIST storage
  xmlns CDATA #FIXED ''>

<!ELEMENT genre (series)+>
<!ATTLIST genre
  xmlns CDATA #FIXED ''
  domain CDATA #REQUIRED>

<!ELEMENT series (title,author,number,country)>
<!ATTLIST series
  xmlns CDATA #FIXED ''>

<!ELEMENT title (#PCDATA)>
<!ATTLIST title
  xmlns CDATA #FIXED ''>

<!ELEMENT author (#PCDATA)>
<!ATTLIST author
  xmlns CDATA #FIXED ''>

<!ELEMENT number (#PCDATA)>
<!ATTLIST number
  xmlns CDATA #FIXED ''>

<!ELEMENT country (#PCDATA)>
<!ATTLIST country
  xmlns CDATA #FIXED ''>
<collection>
	<storage>
		<genre domain="horror">
			<series>
				<title>The Walking Dead</title>
				<author>Frank Darabont</author>
				<number>1</number>
				<country>USA</country>
			</series>
			<series>
				<title>The Strain</title>
				<author>Guillermo del Toro</author>
				<number>11</number>
				<country>Canada</country>
			</series>
			<series>
				<title>Tales from the Crypt</title>
				<author>Bill Gaines</author>
				<number>12</number>
				<country>USA</country>
			</series>
		</genre>
		<genre domain="science fiction">
			<series>
				<title>Stranger Things</title>
				<author>Duffer brothers</author>
				<number>4</number>
				<country>USA</country>
			</series>
			<series>
				<title>The 100</title>
				<author>Jason Rothenberg</author>
				<number>2</number>
				<country>USA</country>
			</series>
			<series>
				<title>The 4400</title>
				<author>Rene Echevarria</author>
				<number>3</number>
				<country>Canada</country>
			</series>
			<series>
				<title>The Twilight Zone</title>
				<author>Rod Serling</author>
				<number>5</number>
				<country>USA</country>
			</series>
		</genre>
		<genre domain="comedy">
			<series>
				<title>Two and a Half Men</title>
				<author>Chuck Lorre</author>				
				<number>6</number>
				<country>USA</country>
			</series>
			<series>
				<title>Anger Management</title>
				<author>Bruce Helford</author>
				<number>7</number>
				<country>USA</country>
			</series>
			<series>
				<title>Family Guy</title>
				<author>Seth MacFarlane</author>
				<number>8</number>
				<country>USA</country>
			</series>
			<series>
				<title>The Simpsons</title>
				<author>Matt Groening</author>				
				<number>9</number>
				<country>USA</country>
			</series>
		</genre>
		<genre domain="drama">
			<series>
				<title>House of Cards</title>
				<author>Beau Willimon</author>
				<number>13</number>
				<country>USA</country>
			</series>
			<series>
				<title>Riverdale</title>
				<author>Roberto Aguirre-Sacasa</author>
				<number>14</number>
				<country>Canada</country>
			</series>
			<series>
				<title>Supernatural</title>
				<author>Eric Kripke</author>
				<number>15</number>
				<country>USA</country>
			</series>
		</genre>
	</storage>
</collection>







0

Znalazłem już 2 błędy. Zapomniałem o doctype w którym powinienem był umieścić dtd oraz o wersji xmla. Chyba teraz działa, jak powinno bo wyświetla strukture dokumentu

0

uwielbiam, jak problem sam się rozwiązuje!
czy mogę coś jeszcze napisać? Cz-czy to jest rozwiązane? Chyba tak! Piszę "chyba", bo tak to jest w tym poście zaznaczone! "Chyba teraz działa"!!!
Mam nadzieję, że tak!
btw: ogarnianie xml, no jakby to powiedzieć: wycierałeś się tym, a teraz ugryzło :P
postuj coś takiego na wykopie, tak, oni też to ogarniają

1 użytkowników online, w tym zalogowanych: 0, gości: 1