Skip to content

Instantly share code, notes, and snippets.

@hexorx
Created July 21, 2009 21:06
Show Gist options
  • Save hexorx/151581 to your computer and use it in GitHub Desktop.
Save hexorx/151581 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Root -->
<xs:element name="Response">
<xs:complexType>
<xs:sequence>
<xs:group ref="Verbs" maxOccurs="unbounded"/>
<xs:choice>
<xs:element ref="Rule"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Groups -->
<xs:group name="Verbs">
<xs:choice>
<xs:element ref="Say"/>
<xs:element ref="Play"/>
<xs:element ref="Gather"/>
<xs:element ref="Record"/>
<xs:element ref="Dial"/>
<xs:element ref="Tag"/>
<xs:element ref="Redirect"/>
<xs:element ref="Pause"/>
<xs:element ref="Hangup"/>
</xs:choice>
</xs:group>
<xs:group name="Operators">
<xs:choice>
<xs:element ref="Tags"/>
<xs:element ref="Schedule"/>
</xs:choice>
</xs:group>
<!-- Verbs -->
<xs:element name="Say">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="voice" type="voiceType" default="man"/>
<xs:attribute name="language" type="languageType" default="en"/>
<xs:attribute name="loop" type="xs:nonNegativeInteger" default="1"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Play">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:anyURI">
<xs:attribute name="loop" type="xs:nonNegativeInteger" default="1"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Gather">
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="Say"/>
<xs:element ref="Play"/>
<xs:element ref="Pause"/>
</xs:choice>
</xs:sequence>
<xs:attribute name="action" type="xs:anyURI" default="self"/>
<xs:attribute name="method" type="methodType" default="POST"/>
<xs:attribute name="timeout" type="xs:positiveInteger" default="5"/>
<xs:attribute name="finishOnKey" type="singleKeyType" default="#"/>
<xs:attribute name="numDigits" type="xs:nonNegativeInteger" default="0"/>
</xs:complexType>
</xs:element>
<xs:element name="Record">
<xs:complexType>
<xs:attribute name="action" type="xs:anyURI" default="/"/>
<xs:attribute name="method" type="methodType" default="POST"/>
<xs:attribute name="timeout" type="xs:positiveInteger" default="5"/>
<xs:attribute name="finishOnKey" type="anyKeyType" default="#"/>
<xs:attribute name="maxLength" type="xs:positiveInteger" default="3600"/>
<xs:attribute name="transcribe" type="xs:boolean" default="false"/>
<xs:attribute name="transcribeCallback" type="xs:anyURI" default="self"/>
</xs:complexType>
</xs:element>
<xs:element name="Dial">
<xs:complexType>
<xs:sequence minOccurs="0">
<xs:element ref="Number"/>
</xs:sequence>
<xs:sequence minOccurs="0">
<xs:element ref="Sip"/>
</xs:sequence>
<xs:sequence minOccurs="0" maxOccurs="1">
<xs:element ref="Conference"/>
</xs:sequence>
<xs:attribute name="action" type="xs:anyURI" default="/"/>
<xs:attribute name="method" type="methodType" default="POST"/>
<xs:attribute name="timeout" type="xs:positiveInteger" default="30"/>
<xs:attribute name="hangupOnStar" type="xs:boolean" default="false"/>
<xs:attribute name="timeLimit" type="xs:positiveInteger" default="14400"/>
<xs:attribute name="callerId" type="numberType" default="13035551212"/>
</xs:complexType>
</xs:element>
<xs:element name="Redirect">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:anyURI">
<xs:attribute name="method" type="methodType" default="POST"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Pause">
<xs:complexType>
<xs:attribute name="length" type="xs:nonNegativeInteger" default="1"/>
</xs:complexType>
</xs:element>
<xs:element name="Hangup">
<xs:complexType/>
</xs:element>
<xs:element name="Tag">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<!-- Nouns -->
<xs:element name="Number">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="numberType">
<xs:attribute name="sendDigits" type="digitType" default=""/>
<xs:attribute name="url" type="xs:anyURI" default=""/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Sip">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="emailType">
<xs:attribute name="sendDigits" type="digitType" default=""/>
<xs:attribute name="url" type="xs:anyURI" default=""/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Conference">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<!-- Rule -->
<xs:element name="Rule">
<xs:complexType>
<xs:sequence>
<xs:element ref="Conditions"/>
<xs:element ref="Match"/>
<xs:element ref="NoMatch" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" default=""/>
<xs:attribute name="mode" type="matchModeType" default="all"/>
</xs:complexType>
</xs:element>
<xs:element name="Conditions">
<xs:complexType>
<xs:sequence>
<xs:group ref="Operators" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Match">
<xs:complexType>
<xs:sequence>
<xs:group ref="Verbs" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="NoMatch">
<xs:complexType>
<xs:sequence>
<xs:group ref="Verbs" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Operators -->
<xs:element name="Tags">
<xs:complexType>
<xs:attribute name="mode" type="matchModeType" default="all"/>
<xs:attribute name="include" type="xs:string" default=""/>
<xs:attribute name="exclude" type="xs:string" default=""/>
</xs:complexType>
</xs:element>
<xs:element name="Schedule">
<xs:complexType>
<xs:attribute name="mode" type="matchModeType" default="all"/>
<xs:attribute name="tz_offset" type="timeZoneOffsetType" default="-7"/>
<xs:attribute name="time" type="timeListType" default="08:00-17:00"/>
<xs:attribute name="year" type="yearListType" default="2009"/>
<xs:attribute name="month" type="monthListType" default="jan-dec"/>
<xs:attribute name="day_of_week" type="weekDayListType" default="mon-fri"/>
<xs:attribute name="day_of_month" type="monthDayListType" default="01-31"/>
</xs:complexType>
</xs:element>
<!-- Types -->
<xs:simpleType name="timeZoneOffsetType">
<xs:restriction base="xs:string">
<xs:pattern value="(\+|\-)([0-9]|1[0-3])"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="timeType">
<xs:restriction base="xs:string">
<xs:pattern value="(([0-9]|[0-1][0-9]|2[0-3]):([0-5][0-9]))(-([0-9]|[0-1][0-9]|2[0-3]):([0-5][0-9])){0,1}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="timeListType">
<xs:list itemType="timeType"/>
</xs:simpleType>
<xs:simpleType name="yearType">
<xs:restriction base="xs:string">
<xs:pattern value="([2-9][0-9][0-9][0-9])(-[2-9][0-9][0-9][0-9]){0,1}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="yearListType">
<xs:list itemType="yearType"/>
</xs:simpleType>
<xs:simpleType name="monthType">
<xs:restriction base="xs:string">
<xs:pattern value="(jan|feb|mar|apr|may|jun|jul|aug|sep|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|nov|dec)){0,1}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="monthListType">
<xs:list itemType="monthType"/>
</xs:simpleType>
<xs:simpleType name="weekDayType">
<xs:restriction base="xs:string">
<xs:pattern value="(sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat)){0,1}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="weekDayListType">
<xs:list itemType="weekDayType"/>
</xs:simpleType>
<xs:simpleType name="monthDayType">
<xs:restriction base="xs:string">
<xs:pattern value="(3[0-1]|[1-2][0-9]|0[1-9]|[1-9])(-(3[0-1]|[1-2][0-9]|0[1-9]|[1-9])){0,1}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="monthDayListType">
<xs:list itemType="monthDayType"/>
</xs:simpleType>
<xs:simpleType name="voiceType">
<xs:restriction base="xs:string">
<xs:enumeration value="man"/>
<xs:enumeration value="woman"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="languageType">
<xs:restriction base="xs:string">
<xs:enumeration value="en"/>
<xs:enumeration value="es"/>
<xs:enumeration value="fr"/>
<xs:enumeration value="de"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="methodType">
<xs:restriction base="xs:string">
<xs:enumeration value="POST"/>
<xs:enumeration value="GET"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="keyType">
<xs:restriction base="xs:string">
<xs:pattern value="(0{0,1}1{0,1}2{0,1}3{0,1}4{0,1}5{0,1}6{0,1}7{0,1}8{0,1}9{0,1}\*{0,1}#{0,1}|)"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="anyKeyType">
<xs:restriction base="keyType">
<xs:minLength value="1"/>
<xs:maxLength value="12"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="singleKeyType">
<xs:restriction base="keyType">
<xs:minLength value="0"/>
<xs:maxLength value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="numberType">
<xs:restriction base="xs:string">
<xs:pattern value="[1-9][0-9]{1,14}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="digitType">
<xs:restriction base="xs:string">
<xs:pattern value="([0-9#\*w]|)*"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="emailType">
<xs:restriction base="xs:string">
<xs:pattern value="^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="matchModeType">
<xs:restriction base="xs:string">
<xs:enumeration value="all"/>
<xs:enumeration value="any"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment