Skip to content

Instantly share code, notes, and snippets.

@conrad-vanl
Forked from Taylor4484/Schema.xml
Last active December 14, 2015 14:29
Show Gist options
  • Save conrad-vanl/5100879 to your computer and use it in GitHub Desktop.
Save conrad-vanl/5100879 to your computer and use it in GitHub Desktop.
*.py[cod]
# C extensions
*.so
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
nosetests.xml
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject

cs327e-wcdb

<?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="Unbounded">
</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="Unbounded">
</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="Unbounded">
</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>
<WCDB>
<CRISES>
<crisis name="Swine Flu (H1N1)" crisisID="H1N1" start="2009-06-03T12:30:00z">
<categories>
<category id="Health-Crisis">
<category id="viral-outbreak">
<category id="pandemic"/>
</category>
</category>
</categories>
<locations>
<location lat="19:26:05N" lon="096:22:59W" radius="500" description="Veracruz, Mexico"/>
</locations>
<human-impact>
<injured count="0"/>
<affected count="0"/>
<infected count="1,632,258"/>
<killed count="19,633"/>
<missing count="0"/>
<survived count="0"/>
</human-impact>
<economic-impact amount="200000000" unit="USD" estimated="true"/>
<resources-needed>vaccines, antivirals</resources-needed>
<ways-to-help>prevention, awareness</ways-to-help>
<external-resources>
<ref type="image" href="http://upload.wikimedia.org/wikipedia/commons/f/f0/H1N1_influenza_virus.jpg">Influenza Virus</ref>
<ref type="video" href= "http://www.youtube.com/watch?v=lFl3FRNpU4E">Video</ref>
<ref type="info" href= "http://www.youtube.com/watch?v=lFl3FRNpU4E">Data by country</ref>
<ref type="info" href= " http://en.wikipedia.org/wiki/2009_flu_pandemic">Wiki page</ref>
<ref type="social-media" href="http://www.facebook.com/h1n1Influenza">Facebook Feed</ref>
</external-resources>
<citations>
<ref type="citation" isbn="123151525124">Some Book</ref>
</citations>
<persons>
<person personID="Obama"/>
<person personID="Chan"/>
</persons>
<organizations>
<organization organiztionID="WHO"/>
<organization organiztionID="US"/>
<organization organiztionID="Mexico"/>
</organizations>
</crisis>
<crisis name="Severe acute respiratory syndrome" crisisID="SARS" start="2009-06-03T12:30:00z">
<categories>
<category id="Health-Crisis">
<category id="viral-outbreak">
<category id="epidemic"/>
</category>
</category>
</categories>
<locations>
<location lat="22:16:42N" lon="114:09:32W" radius="500" description="Hong Kong"/>
</locations>
<human-impact>
<injured count="0"/>
<affected count="0"/>
<infected count="8,273"/>
<killed count="775"/>
<missing count="0"/>
<survived count="0"/>
</human-impact>
<economic-impact amount="1650000" unit="USD" estimated="true"/>
<resources-needed>vaccines, antipyretics, supplemental oxygen and ventilation support</resources-needed>
<ways-to-help>prevention, awareness</ways-to-help>
<external-resources>
<ref type="image" href="http://upload.wikimedia.org/wikipedia/commons/6/6c/Sars-corona.png">Influenza Virus</ref>
<ref type="video" href= "http://www.aljazeera.com/news/asia-pacific/2013/02/2013210153855381447.html">Video</ref>
<ref type="info" href= "http://en.wikipedia.org/wiki/Severe_acute_respiratory_syndrome">Disease Description</ref>
<ref type="info" href= "http://en.wikipedia.org/wiki/SARS_coronavirus">Viral Description</ref>
<ref type="info" href= "http://en.wikipedia.org/wiki/Progress_of_the_SARS_outbreak">Outbreak progress</ref>
<ref type="social-media" href="http://www.facebook.com/pages/SARS-outbreak/132956950074605#">Facebook Feed</ref>
</external-resources>
<citations>
<ref type="citation" isbn="123151525124">Some Book</ref>
</citations>
<persons>
<person personID="Chan"/>
</persons>
<organizations>
<organization organiztionID="WHO"/>
<organization organiztionID="CDC"/>
</organizations>
</crisis>
</crisis>
<crisis name="Bastrop Wildfires" crisisID="BFire" start="2011-09-03T12:30:00z">
<categories>
<category id="environmental-disaster">
<category id="land">
<category id="wildfire"/>
</category>
</category>
</categories>
<locations>
<location lat="30:06:43N" lon="097:19:01W" radius="500" description="Bastrop, Texas"/>
</locations>
<human-impact>
<injured count="0"/>
<affected count="1,696"/>
<infected count="0"/>
<killed count="2"/>
<missing count="0"/>
<survived count="0"/>
</human-impact>
<economic-impact amount="350000000" unit="USD" estimated="true"/>
<resources-needed>human labor, construction equipment, funds, firemen</resources-needed>
<ways-to-help>donations</ways-to-help>
<external-resources>
<ref type="image" href="http://upload.wikimedia.org/wikipedia/commons/8/84/Texas_National_Guard_extinguishing_flames_from_Ch-47_helicopter.jpg">Fire</ref>
<ref type="video" href= "http://www.kxan.com/dpp/news/local/bird's-eye-view-of-bastrop-fires">Video</ref>
<ref type="info" href= "http://en.wikipedia.org/wiki/Bastrop_County_Complex_fire">Wiki page</ref>
<ref type="social-media" href="http://www.facebook.com/pages/Bastrop-Fire-Information-and-Help/284897838194470">Facebook Feed</ref>
</external-resources>
<citations>
<ref type="citation" isbn="123151525124">Some Book</ref>
</citations>
<persons>
<person personID="Perry"/>
<person personID="Obama"/>
</persons>
<organizations>
<organization organiztionID="Texas"/>
<organization organiztionID="US"/>
</organizations>
</CRISES>
<ORGANIZATIONS>
<organization name="World Health Organization" organizationID="WHO">
<categories>
<category id="health-org"/>
</categories>
<history>
The World Health Organization (WHO) is a specialized agency of the <ref href="http://en.wikipedia.org/wiki/United_Nations">United Nations (UN)</ref> that is concerned with international public health. It was established on 7 April 1948, with headquarters in Geneva, Switzerland, and is a member of the <ref href="http://en.wikipedia.org/wiki/United_Nations_Development_Group">United Nations Development Group</ref>. Its predecessor, the Health Organization, was an agency of the League of Nations.
</history>
<contact-info>
<tel label="front desk">41 22 791 21 11</tel>
<email label="public relations">publications@who.int</email>
<address label="mailing address">
<street>Avenue Appia 20</street>
<city>1211 Geneva 27</city>
<country>Switzerland</country>
</address>
</contact-info>
<external-resources>
<ref type="corporate-website" href="http://www.who.int">Main website</ref>
<ref type="image" href="http://upload.wikimedia.org/wikipedia/commons/8/89/Flag_of_WHO.svg">Logo</ref>
<ref type="video" href= "http://www.youtube.com/user/who">Video</ref>
<ref type="social-media" href="http://www.facebook.com/WorldHealthOrganization?fref=ts">Facebok Feed</ref>
</external-resources>
<persons>
<person personID="Chan"/>
</persons>
<crises>
<crisis crisisID="SARS"/>
<crisis crisisID="H1N1"/>
</crises>
</organization>
</ORGANIZATIONS>
<PERSONS>
<person personID="Chan">
<name>
<first>Margaret</first>
<last>Chan</last>
</name>
<occupation id="medical-doctor">Director</occupation>
<external-resources>
<ref type="bio-website" href="http://en.wikipedia.org/wiki/Margaret_chan">Wiki Page</ref>
<ref type="image" href="http://upload.wikimedia.org/wikipedia/commons/3/3c/Margaret_Chan_-_World_Economic_Forum_Annual_Meeting_2011_crop.jpg">Picture</ref>
<ref type="video" href= "http://www.youtube.com/watch?v=Aah9e4FA--k">Video</ref>
<ref type="social-media" href="http://www.facebook.com/pages/Dr-Margaret-Chan/88513510368">Facebok Feed</ref>
</external-resources>
<bio>
Margaret Chan Fung Fu-chun, OBE, JP (born 1947 in Hong Kong) is the Director-General of the <ref href="http://en.wikipedia.org/wiki/World_Health_Organization">World Health Organization (WHO)</ref>. Chan was elected by the Executive Board of WHO on 8 November 2006, and was endorsed in a special meeting of the World Health Assembly on the following day. Chan has previously served as Director of Health in the Hong Kong Government (1994-2003), representative of the WHO Director-General for Pandemic Influenza and WHO Assistant Director-General for Communicable Diseases (2003-2006).
</bio>
<crises>
<crisis crisisID="SARS"/>
<crisis crisisID="H1N1"/>
</crises>
<organizations>
<organization organizationID="WHO"/>
</organizations>
</person>
<person personID="Perry">
<name>
<first>James</first>
<last>Richard</last>
<last>Perry</last>
</name>
<occupation id="political">Governor</occupation>
<external-resources>
<ref type="bio-website" href="http://en.wikipedia.org/wiki/Rick_Perry">Wiki Page</ref>
<ref type="image" href="http://upload.wikimedia.org/wikipedia/commons/c/ce/Rick_Perry_by_Gage_Skidmore_8.jpg">Picture</ref>
<ref type="video" href= "http://www.youtube.com/user/govperry">Video</ref>
<ref type="social-media" href="http://www.facebook.com/GovernorPerry">Facebok Feed</ref>
</external-resources>
<bio>
James Richard "Rick" Perry (born March 4, 1950) is the 47th and current Governor of Texas. Perry, a Republican, was elected Lieutenant Governor of Texas in 1998 and assumed the governorship in December 2000 when then-governor George W. Bush resigned to become President of the United States. Perry was elected to full gubernatorial terms in 2002, 2006 and 2010 and is the fourth Texas governor since Allan Shivers, Price Daniel, and John Connally to serve three terms. With a tenure in office to date of 12 years, 74 days, Perry is the second longest serving current U.S. governor—after Terry Branstad of Iowa. Perry served as Chairman of the Republican Governors Association in 2008 (succeeding Sonny Perdue of Georgia) and again in 2011.[2] Perry is the longest serving governor in Texas state history. As a result, he is the only governor in modern Texas history to have appointed at least one person to every eligible state office, board, or commission position (as well as to several elected offices to which the governor can appoint someone to fill an unexpired term, such as six of the nine current members of the Texas Supreme Court).
</bio>
<crises>
<crisis crisisID="BFire"/>
</crises>
<organizations>
<organization organizationID="Texas"/>
</organizations>
</person>
</PERSONS>
</WCDB>
import xml.etree.ElementTree as ET
class WCDB1:
class XML:
def __init__(self, etree):
self.tree = etree
@staticmethod
def from_file(filename):
return WCDB1.XML( ET.parse( open(filename) ) )
@staticmethod
def from_string(string):
return WCDB1.XML( ET.fromstring(string) )
def __str__(self):
return ET.tostring( self.tree.getroot() )
def export(self, filename):
f = open(filename, 'w')
f.write(self.__str__())
<CrisesDB>
<crisis name="Horrible Event 1" crisisID="HE1" start="2012-02-03T12:30:00z">
<categories>
<category id="natural-disaster">
<category id="hurricane">
<category id="huricane-cat1"/>
</category>
</category>
</categories>
<locations>
<location lat="40:26:46N" lon="079:56:55W" radius="500" description="somewhere"/>
</locations>
<human-impact>
<injured count="100"/>
<affected count="52"/>
<infected count="100"/>
<killed count="200"/>
<missing count="150"/>
<survived count="23"/>
</human-impact>
<economic-impact amount="1000" unit="USD" estimated="true"/>
<resources-needed>firefighters, military intervention, giraffes</resources-needed>
<ways-to-help>education, magic</ways-to-help>
<external-resources>
<ref type="aid-relief" href="http://aids.notthedisease.com">Google Missing People Search</ref>
<ref type="research" isbn="123453523253235">Some book</ref>
<ref type="news" author="Smith, John" title="Blah Balh title" publication="Austin Chronicle" edition="4-6">Some Article</ref>
<ref type="social-media" href="http://facebook.com/HorridEvent">Facebook Feed</ref>
</external-resources>
<citations>
<ref type="citation" isbn="123151525124">Some Book</ref>
</citations>
<persons>
<person personID="anotherdoe-2000-6-23"/>
</persons>
<organizations>
<organization organiztionID="comrad's"/>
</organizations>
</crisis>
<organization name="Conrad's Relief Aid" organizationID="comrad's">
<categories>
<category id="relief-org"/>
</categories>
<history>
Started in 1991 during the <ref href="http://ref.com">BLAH conflict</ref>
</history>
<contact-info>
<tel label="front desk">09809809</tel>
<email label="public relations">afee@adsf.com</email>
<email label="human resources">hr@adsf.com</email>
<address label="mailing address">
<street>905 1st St</street>
<street>Unit 402</street>
<city>Austin</city>
<state>Texas</state>
<zip>78705</zip>
</address>
</contact-info>
<external-resources>
<ref type="corporate-website" href="http://adsf.com">Blah</ref>
<ref type="social-media" href="twitter.com/adsf">Twitter Feed</ref>
</external-resources>
<persons>
<person personID="anotherdoe-2000-6-23"/>
</persons>
</organization>
<person personID="anotherdoe-2000-6-23">
<name>
<first>Another</first>
<middle>John</middle>
<last>Doe</last>
</name>
<occupation id="medical-doctor">Surgeon General</occupation>
<external-resources>
<ref/>
</external-resources>
<bio>
asdfasdfasfefef
<ref/>
</bio>
</person>
</CrisesDB>
<?xml version="1.0"?>
<xsd:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsd:element name="CrisesDB">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Crisis"
type="CrisisType"
minOccurs="0"
maxOccurs="unbounded"/>
</xsd:element>
<xsd:element name="Person"
type="PersonType"
minOccurs="0"
maxOccurs="unbounded"/>
</xsd:element>
<xsd:element name="Organization"
type="OrganizationType"
minOccurs="0"
maxOccurs="unbounded"/>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:key name="CrisisKey">
<xsd:selector xpath="Crisis"/>
<xsd:field xpath="@crisisID"/>
</xsd:key>
<xsd:key name="PersonKey">
<xsd:selector xpath="Person"/>
<xsd:field xpath="@personID"/>
</xsd:key>
<xsd:key name="OrganizationKey">
<xsd:selector xpath="Organization"/>
<xsd:field xpath="@organizationID"/>
</xsd:key>
<xsd:keyRef name="PersonKeyCrisis" refer="PersonKey">
<xsd:selector xpath="Crisis/Person"/>
<xsd:field xpath="@personID"/>
</xsd:keyRef>
<xsd:keyRef name="PersonKeyOrganization" refer="PersonKey">
<xsd:selector xpath="Organization/Person"/>
<xsd:field xpath="@personID"/>
</xsd:keyRef>
<xsd:keyRef name="OrganizationKeyCrisis" refer="OrganizationKey">
<xsd:selector xpath="Crisis/Organization"/>
<xsd:field xpath="@organizationID"/>
</xsd:keyRef>
</xsd:element>
<xsd:complexType name="CrisisType">
<xsd:attribute name="start" type="xsd:dateTime" use="required"/>
<xsd:attribute name="crisisID" type="CrisisKey" use="required"/>
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:sequence>
<xsd:element name="categories">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="category" maxOccurs="unbounded">
<xsd:complexType>
<xsd:attribute name="type" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="locations">
<xsd:complexType>
<xsd:element name="location" maxOccurs="unbounded">
<xsd:complexType>
<xsd:attribute name="lat" type="xsd:integer" use="required" />
<xsd:attribute name="lon" type="xsd:integer" use="required" />
<xsd:attribute name="radius" type="xsd:integer" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:complexType>
</xsd:element>
<xsd:element name="human-impact">
<xsd:complexType>
<xsd:element maxOccurs="unbounded"> <!-- allow any name maybe? -->
<xsd:complexType>
<xsd:attribute name="count" type="xsd:integer" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:complexType>
</xsd>
<xsd:element name="economic-impact">
<xsd:complexType>
<xsd:attribute name="amount" type="xsd:integer" use="requied" />
<xsd:attribute name="unit" type="xsd:string" use="required" />
<xsd:attribute name="estimated" type="xsd:boolean" />
</xsd:complexType>
</xsd:element>
<xsd:element name="citations">
<xsd:complexType>
<xsd:element name="ref" type="ref" maxOccurs="unbounded"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="external-resources">
<xsd:complexType>
<xsd:element name="ref" type="ref" maxOccurs="unbounded"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="organizations">
<xsd:complexType>
<xsd:element name="organization" maxOccurs="unbounded">
<xsd:attribute name="organizationID" type="OrganizationRef"/>
</xsd:element>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType> <!-- /end CrisisType -->
<xsd:complexType name="PersonType">
<xsd:attribute name="">
</xsd:complexType> <!-- /end PersonType -->
<xsd:complexType name="OrganizationType">
<xsd:sequence>
<xsd:element name="categories">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="category" maxOccurs="unbounded">
<xsd:complexType>
<xsd:attribute name="type" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="history" type="xsd:string" />
<xsd:element name="contact-info">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="tel" type="xsd:integer" maxOccurs="unbounded">
<xsd:complexType>
<xsd:attribute name="label" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
<xsd:element name="email" type="xsd:string" maxOccurs="unbounded">
<xsd:complexType>
<xsd:attribute name="label" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
<xsd:element name="address" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="street" type="xsd:string" />
<xsd:element name="city" type="xsd:string" />
<xsd:element name="state" type="xsd:string" />
<xsd:element name="zip" type="xsd:integer" />
</xsd:sequence>
<xsd:attribute name="label" type="xsd:string" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="external-resources">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ref" type="xsd:string">
<xsd:complexType>
<xsd:attribute name="type" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="People">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Person" maxOccurs="unbounded">
<xsd:complexType>
<xsd:attribute name="personID" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType>
<xsd:attribute name="name" type="xsd:string" use="required" />
<xsd:attribute name="organizationID" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment