1. feladat

Készítsünk XML dokumentumot, ami illeszkedik az alábbi DTD-re!

(a) <!DOCTYPE NEWSPAPER [

<!ELEMENT NEWSPAPER (ARTICLE+)>
<!ELEMENT ARTICLE (HEADLINE,BYLINE,LEAD,BODY,NOTES)>
<!ELEMENT HEADLINE (#PCDATA)>
<!ELEMENT BYLINE (#PCDATA)>
<!ELEMENT LEAD (#PCDATA)>
<!ELEMENT BODY (#PCDATA)>
<!ELEMENT NOTES (#PCDATA)> 

<!ATTLIST ARTICLE AUTHOR CDATA #REQUIRED>
<!ATTLIST ARTICLE EDITOR CDATA #IMPLIED>
<!ATTLIST ARTICLE DATE CDATA #IMPLIED>
<!ATTLIST ARTICLE EDITION CDATA #IMPLIED>

]>

2. feladat

Készítsetek XML dokumentumot, ami illeszkedik az alábbi XML sémára!

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:simpleType name="stringtype">
  <xs:restriction base="xs:string"/>
</xs:simpleType>

<xs:simpleType name="inttype">
  <xs:restriction base="xs:positiveInteger"/>
</xs:simpleType>

<xs:simpleType name="dectype">
  <xs:restriction base="xs:decimal"/>
</xs:simpleType>

<xs:simpleType name="orderidtype">
  <xs:restriction base="xs:string">
    <xs:pattern value="[0-9]{6}"/>
  </xs:restriction>
</xs:simpleType>

<xs:complexType name="shiptotype">
  <xs:sequence>
    <xs:element name="name" type="stringtype"/>
    <xs:element name="address" type="stringtype"/>
    <xs:element name="city" type="stringtype"/>
    <xs:element name="country" type="stringtype"/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="itemtype">
  <xs:sequence>
    <xs:element name="title" type="stringtype"/>
    <xs:element name="note" type="stringtype" minOccurs="0"/>
    <xs:element name="quantity" type="inttype"/>
    <xs:element name="price" type="dectype"/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="shipordertype">
  <xs:sequence>
    <xs:element name="orderperson" type="stringtype"/>
    <xs:element name="shipto" type="shiptotype"/>
    <xs:element name="item" maxOccurs="unbounded" type="itemtype"/>
  </xs:sequence>
  <xs:attribute name="orderid" type="orderidtype" use="required"/>
</xs:complexType>

<xs:element name="shiporder" type="shipordertype"/>

</xs:schema>

3. feladat

Az alábbi XML dokumentumhoz készítsétek el a megfelelő DTD-t és XML sémát!

<Order xmlns="http://www.example.com/myschema.xml">
	<Customer>
		<Name>Bill Buckram</Name>
		<Cardnum>234 234 234 234</Cardnum>
	</Customer>
	<Manifest>
		<Item>
			<ID>209</ID>
			<Title>Duke: A Biography of the Java Evangelist</Title>
			<Quantity>1</Quantity>
			<UnitPrice>$10.75</UnitPrice>
		</Item>
		<Item>
			<ID>208</ID>
			<Title>
				100% Pure: Making Cross Platform Deployment a Reality
			</Title>
			<Quantity>1</Quantity>
			<UnitPrice>$10.75</UnitPrice>
		</Item>
		<Item>
			<ID>204</ID>
			<Title>
				Making the Transition from C++ to the Java(tm) Language
			</Title>
			<Quantity>1</Quantity>
			<UnitPrice>$10.75</UnitPrice>
		</Item>
		<Item>
			<ID>202</ID>
			<Title>Web Servers for Fun and Profit</Title>
			<Quantity>1</Quantity>
			<UnitPrice>$10.75</UnitPrice>
		</Item>
		<Item>
			<ID>210</ID>
			<Title>
				I Think Not: Dukes Likeness to the Federation Insignia
			</Title>
			<Quantity>1</Quantity>
			<UnitPrice>$10.75</UnitPrice>
		</Item>
	</Manifest>
	<Receipt>
		<Subtotal>$53.75</Subtotal>
		<Tax>$4.43</Tax>
		<Total>$58.18</Total>
	</Receipt>
</Order>