<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3schools.com" xmlns="http://www.w3schools.com" elementFormDefault="qualified">
<xs:element name="nokkis">
<xs:complexType>
<xs:sequence>
<xs:element name="event" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" minOccurs="0" />
<xs:element name="description" type="xs:string" minOccurs="0" />
<xs:element name="startdate" type="xs:integer" minOccurs="0" />
<xs:element name="enddate" type="xs:integer" minOccurs="0" />
<xs:element name="num_tickets" type="xs:integer" minOccurs="0" />
<xs:element name="max_tickets" type="xs:integer" minOccurs="0" />
<xs:element name="barcode" type="xs:integer" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="apikey" minOccurs="0" maxOccurs="unbounded" >
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9_]{1,30}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:integer" />
</xs:complexType>
</xs:element>
<xs:element name="barcode" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="event" type="xs:string" minOccurs="0" />
<xs:element name="user" type="xs:string" minOccurs="0" />
<xs:element name="status" type="xs:integer" minOccurs="0" />
<xs:element name="valid" type="xs:integer" minOccurs="0" />
</xs:sequence>
<xs:attribute name="key" type="xs:integer" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="apikey" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9_]{1,30}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="event" type="xs:string" />
</xs:sequence>
<xs:attribute name="id" type="xs:integer" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="action" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="event" type="xs:string" minOccurs="0" />
<xs:element name="barcode" type="xs:integer" minOccurs="0" />
<xs:element name="apikey" minOccurs="0" >
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9_]{1,30}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ip" type="xs:string" />
<xs:element name="action_time" type="xs:integer" />
<xs:element name="action_data">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="event_created" />
<xs:enumeration value="event_modified" />
<xs:enumeration value="barcode_created" />
<xs:enumeration value="barcode_used" />
<xs:enumeration value="barcode_failed" />
<xs:enumeration value="barcode_deleted" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:integer" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="error">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:integer" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>