Skip to content

Instantly share code, notes, and snippets.

@Taylor4484
Created March 6, 2013 09:54
Show Gist options
  • Save Taylor4484/5098185 to your computer and use it in GitHub Desktop.
Save Taylor4484/5098185 to your computer and use it in GitHub Desktop.
Current Working Schema
<?xml version="1.0" ?>
<!-- XSD for WCBD1.xml -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- Root Element -->
<xsd:element name="WorldCrisesDatabase">
<!-- Unlimited number of sub-elements sequenced Crisis, Org, Person-->
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Crisis" type="cType"
minOccurs="0" maxOccurs="unbounded">
</xsd:element>
<xsd:element name="Organization" type="oType"
minOccurs="0" maxOccurs="unbounded">
</xsd:element>
<xsd:element name="Person" type="pType"
minOccurs="0" maxOccurs="unbounded">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<!-- Crisis Key -->
<xsd:key name="cKey">
<xsd:selector xpath="Crisis" />
<xsd:field xpath="@cID" />
</xsd:key>
<xsd:keyref name="cKeyRef" refer="cKey">
<xsd:selector xpath="Organzation/Crises/Crisis" />
<xsd:field xpath="cID" />
</xsd:keyref>
<xsd:keyref name="cKeyRef2" refer="cKey">
<xsd:selector xpath="Person/Crises/Crisis" />
<xsd:field xpath="cID" />
</xsd:keyref>
<!-- Organization Key -->
<xsd:key name="oKey">
<xsd:selector xpath="Organization" />
<xsd:field xpath="@oID" />
</xsd:key>
<xsd:keyref name="oKeyRef" refer="oKey">
<xsd:selector xpath="Crisis/Organizations/Organization" />
<xsd:field xpath="oID" />
</xsd:keyref>
<xsd:keyref name="oKeyRef2" refer="oKey">
<xsd:selector xpath="Person/Organizations/Organization" />
<xsd:field xpath="oID" />
</xsd:keyref>
<!-- People Key -->
<xsd:key name="pKey">
<xsd:selector xpath="Person" />
<xsd:field xpath="@pID" />
</xsd:key>
<xsd:keyref name="pKeyRef" refer="pKey">
<xsd:selector xpath="Crisis/People/Person" />
<xsd:field xpath="pID" />
</xsd:keyref>
<xsd:keyref name="pKeyRef2" refer="pKey">
<xsd:selector xpath="Organization/People/Person" />
<xsd:field xpath="pID" />
</xsd:keyref>
</xsd:element>
<!--Sub-Element Types (restricts element to 10 relations of other two types of elements-->
<xsd:complexType name="orgsType">
<xsd:sequence>
<xsd:element name="Organization" type="oIDType"
minOccurs="0" maxOccurs="10">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="oIDType">
<xsd:attribute name="oID" type="xsd:string" use="required" />
</xsd:complexType>
<xsd:complexType name="crisesType">
<xsd:sequence>
<xsd:element name="Crisis" type="cIDType"
minOccurs="0" maxOccurs="10">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="cIDType">
<xsd:attribute name="cID" type="xsd:string" use="required" />
</xsd:complexType>
<xsd:complexType name="peopleType">
<xsd:sequence>
<xsd:element name="Person" type="pIDType"
minOccurs="0" maxOccurs="10">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="pIDType">
<xsd:attribute name="pID" type="xsd:string" use="required" />
</xsd:complexType>
<!-- Common Types be repeated-->
<!-- Basic Info -->
<xsd:complexType name="infoType">
<xsd:sequence>
<xsd:element name="Name" type="xsd:string"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="Kind" type="xsd:string"
minOccurs="0" maxOccurs="unbounded">
</xsd:element>
<xsd:element name="Description" type="xsd:string"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="Location" type="locationType"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="Date" type="dateType"
minOccurs="1" maxOccurs="1">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<!-- External Stuff Type (Images,Videos,Maps, Social Links, Citations) -->
<xsd:complexType name="externalType">
<xsd:sequence>
<xsd:element name="Images" type="urlType"
minOccurs="0" maxOccurs="unbounded">
</xsd:element>
<xsd:element name="Videos" type="urlType"
minOccurs="0" maxOccurs="unbounded">
</xsd:element>
<xsd:element name="Maps" type="urlType"
minOccurs="0" maxOccurs="unbounded">
</xsd:element>
<xsd:element name="Social" type="socialType"
minOccurs="0" maxOccurs="unbounded">
</xsd:element>
<xsd:element name="Links" type="urlType"
minOccurs="0" maxOccurs="unbounded">
</xsd:element>
<xsd:element name="Citations" type="xsd:string"
minOccurs="0" maxOccurs="unbounded">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<!-- URL Type (url with title attribute) -->
<xsd:complexType name="urlType">
<xsd:attribute name="title" type="xsd:string"/>
<xsd:restriction base="xsd:anyURI"/>
</xsd:complexType>
<!-- Social Type (urls for FB, G+, TW, Other)-->
<xsd:complexType name="socialType">
<xsd:attribute name="network" type="restrictionType"/>
<xsd:restriction base="xsd:anyURI"/>
</xsd:complexType>
<xsd:simpleType name="restrictionType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Facebook"/>
<xsd:enumeration value="Google+"/>
<xsd:enumeration value="Twitter"/>
<xsd:enumeration value="Other"/>
</xsd:restriction>
</xsd:simpleType>
<!-- Location Type (allows optional complete addresses, requires country) -->
<xsd:complexType name="locationType">
<xsd:sequence>
<xsd:element name="AddressLine" type="xsd:string"
minOccurs="0" maxOccurs="3">
</xsd:element>
<xsd:element name="City" type="xsd:string"
minOccurs="0" maxOccurs="1">
</xsd:element>
<xsd:element name="State" type="xsd:string"
minOccurs="0" maxOccurs="1">
</xsd:element>
<xsd:element name="Country" type="xsd:string"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="Postal" type="xsd:string"
minOccurs="0" maxOccurs="1">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<!-- Date Type-->
<!--
The date is specified in the following form "YYYY-MM-DD" where:
YYYY indicates the year
MM indicates the month
DD indicates the day
Note: All components are required!
The time is specified in the following form "hh:mm:ss" where:
hh indicates the hour
mm indicates the minute
ss indicates the second
Note: All components are required!
-->
<xsd:complexType name="dateType">
<xsd:sequence>
<xsd:element name="StartDate" type="xsd:date"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="StartTime" type="xsd:time"
minOccurs="0" maxOccurs="1">
</xsd:element>
<xsd:element name="EndDate" type="xsd:date"
minOccurs="0" maxOccurs="1">
</xsd:element>
<xsd:element name="EndTime" type="xsd:time"
minOccurs="0" maxOccurs="1">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<!-- Contact Information Type-->
<xsd:complexType name="contactType">
<xsd:sequence>
<xsd:element name="Website" type="xsd:anyURI"
minOccurs="0" maxOccurs="1">
</xsd:element>
<xsd:element name="Telephone" type="xsd:string"
minOccurs="0" maxOccurs="1">
</xsd:element>
<xsd:element name="Fax" type="xsd:string"
minOccurs="0" maxOccurs="1">
</xsd:element>
<xsd:element name="Email" type="xsd:string"
minOccurs="0" maxOccurs="1">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<!-- Crisis Type -->
<xsd:complexType name="cType">
<xsd:attribute name="cID" type="xsd:string" use="required" value="[A-Z][A-Z][0-9][0-9][0-9][0-9]"/>
<xsd:sequence>
<xsd:element name="info" type="infoType"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="HumanImpact" type="xsd:string"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="EconomicImpact" type="xsd:string"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="ResourcesNeeded" type="xsd:string"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="WaysToHelp" type="xsd:string"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="External" type="externalType"
minOccurs="1" maxOccurs="1">
</xsd:element>
<!-- ID references -->
<xsd:element name="Organizations" type="orgsType"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="People" type="peopleType"
minOccurs="1" maxOccurs="1">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<!-- Organization Type-->
<xsd:complexType name="oType">
<xsd:attribute name="oID" type="xsd:string" use="required" value="[A-Z][A-Z][0-9][0-9][0-9][0-9]"/>
<xsd:sequence>
<xsd:element name="info" type="infoType"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="History" type="xsd:string"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="ContactInfo" type="contactType"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="External" type="externalType"
minOccurs="1" maxOccurs="1">
</xsd:element>
<!-- ID references -->
<xsd:element name="Crises" type="crisesType"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="People" type="peopleType"
minOccurs="1" maxOccurs="1">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<!-- Person Type-->
<xsd:complexType name="pType">
<xsd:attribute name="pID" type="xsd:string" use="required" value="[A-Z][A-Z][0-9][0-9][0-9][0-9]"/>
<xsd:sequence>
<xsd:element name="info" type="infoType"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="History" type="xsd:string"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="ContactInfo" type="contactType"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="External" type="externalType"
minOccurs="1" maxOccurs="1">
</xsd:element>
<!-- ID references -->
<xsd:element name="Organizations" type="orgsType"
minOccurs="1" maxOccurs="1">
</xsd:element>
<xsd:element name="Crises" type="crisesType"
minOccurs="1" maxOccurs="1">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
@hjh558
Copy link

hjh558 commented Mar 6, 2013

I feel like a lot of the element/ID names have been changed. It might be a good idea to get an example instance up somewhere.

I'm trying to modify mine right now, but I'm not sure that I'll get all of the names correct...

@Wilson-D-Bui
Copy link

Do we have a validated XML instance yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment