<?xml version="1.0" encoding="UTF-16"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:include schemaLocation="inc-types_1-02.xsd"/>
	<xs:annotation><xs:appinfo>ipcr_catchwordindex_1-01.xsd</xs:appinfo></xs:annotation>
	<xs:annotation>
		<xs:documentation>
			<h1>IPC Catchword Master File, Schema V.1.01</h1>
	<h2>File name of master files</h2>
	<div>ipcr_catchwordindex_YYYYMMDD.xml</div>
			<h2>History</h2>
			<dl>
				<dt>200505..</dt>
				<dd>TA split from RIPCIS DTD</dd>
				<dt>20050804</dt>
				<dd>TA external CWSet entry added to include EN/FR versions in the same file</dd>
				<dt>20060506</dt>
				<dd>TA documentation</dd>
				<dt>20120906</dt>
				<dd>SzZ conversion to XSD</dd>
				<dt>20120925</dt>
				<dd>TA removal of non-used elements and documentation</dd>
			</dl>
		</xs:documentation>
	</xs:annotation>
	<xs:element name="CWSet">
		<xs:annotation>
			<xs:documentation>
				<div>set of catchword indexes</div>
				<div>The catchword index format is appropriate for</div>
				<ul>
					<li>IPC official catchword index,</li>
					<li>German Stichwort.</li>
				</ul>
				
				<div>Prereform versions contained obsolete attributes:
					<ul>
						<li>FROMBEGIN</li>
						<li>FROMEND</li>
						<li>TOBEGIN</li>
						<li>TOEND</li>
						<li>documentroot</li>
					</ul>
				</div>
				<div>In prereform versions the language code is to be capitalized.</div>
				<div>The Catchword Index contains max. 3 embedded levels.</div>

			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element name="CW" type="CW" maxOccurs="unbounded"></xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>

	<xs:complexType name="CW">
		<xs:annotation>
			<xs:documentation>
				<div>a single catchword index in one language</div>
			</xs:documentation>
		</xs:annotation>

		<xs:choice>
			<xs:element name="CWEntry" type="CWEntry" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>main catchwords</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:choice>
		<xs:attribute name="lang" type="lang" use="required">
			<xs:annotation>
				<xs:documentation><div>language of indications in this index</div>
				<div class="important"><span class="key">Language</span>xml:lang would be a better choice</div>
				</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="edition" type="edition" use="required">
			<xs:annotation>
				<xs:documentation>edition of IPC the catchword index belongs to</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:complexType name="CWEntry">
		<xs:annotation>
			<xs:documentation>
				<div>recursive structure containing tree of entries</div>
				<h3>Comments</h3>
				<ul>
					<li>English version: 3 explicit levels</li>
					<li>French version has 3 levels, but a 4th is used by sort dependencies</li>
				</ul>

			</xs:documentation>
		</xs:annotation>

		<xs:sequence>
			<xs:element name="CWIndication" type="CWIndication">
				<xs:annotation>
					<xs:documentation>
						<div>indication of the entry (the text itself, with a little markup)</div>
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="CWSee" type="CWSee" minOccurs="0">
				<xs:annotation>
					<xs:documentation>
						<div>see also clause, defining related catchword entries</div>
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="CWReferences" type="CWReferences" minOccurs="0">
				<xs:annotation>
					<xs:documentation>
						<div>references related to the indication  (a very broad CWentry has no specified reference)</div>
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="CWEntry" type="CWEntry" minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>
						<div>catchword entries, with narrower or different meaning than that covered by the indication</div>
					</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="id" type="cwNumericId">
			<xs:annotation>
				<xs:documentation>
					<div>identifier (number) of the entry, non-meaningful unique identifier</div>
				</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<!--<xs:attribute name="rn" type="xs:string"></xs:attribute>-->
		<xs:attribute name="xmlId" type="catchwordId">
			<xs:annotation>
				<xs:documentation>
					<div>XML identifier and sort key</div>
				</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="remark" type="remark">
			<xs:annotation>
				<xs:documentation>
					<div>free text comment</div>
				</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>


	<xs:complexType name="CWIndication" mixed="true">
		<xs:annotation>
			<xs:documentation>
				<div>indication of the catchword, the text of the entry</div>
			</xs:documentation>
		</xs:annotation>

		<xs:choice minOccurs="0" maxOccurs="unbounded">
			<xs:element name="sub" type="catchwordSub"></xs:element>
			<xs:element name="ldash" type="ldash"></xs:element>
			<xs:element name="larrow" type="larrow"></xs:element>
			<xs:element name="rarrow" type="rarrow"></xs:element>
		</xs:choice>
	</xs:complexType>


	<xs:complexType name="CWSee" mixed="true">
		<xs:annotation>
			<xs:documentation>
				<div>see also references</div>
				<div>May contain filler texts and separators before and between the references, e.g. "see" or "see also"</div>
			</xs:documentation>
		</xs:annotation>
		<xs:choice minOccurs="0" maxOccurs="unbounded">
			<xs:element name="sub" type="sub"></xs:element>
			<xs:element name="ldash" type="sub"></xs:element>
			<xs:element name="CWRef" type="CWRef"></xs:element>
		</xs:choice>
	</xs:complexType>


	<xs:complexType name="CWRef" mixed="true">
		<xs:annotation>
			<xs:documentation>
				<div>reference to another catchword entry</div>
			</xs:documentation>
		</xs:annotation>

		<xs:attribute name="REFID" use="required" type="catchwordRef">
			<xs:annotation>
				<xs:documentation>
					<div>contains the XMLID of the referred CWEntry</div>
					<div>There is no guarantee, that all references can be resolved. The text of the references can be converted to a reference ID only with additional logic, e.g. adding or removal plurals.</div>
				</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>
	<xs:simpleType name="catchwordId">
		<xs:annotation>
			<xs:documentation>
				<div>catchword symbolic identifier</div>
				<div>mixture of letters some punctuation; <b>can be empty</b></div>
				<div class="important"><span class="key">Non-symbolic references</span>Catchword symbolic identifiers should be removed, once all references are set to non-symbolic.</div>
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value=".*"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name="catchwordRef">
		<xs:annotation>
			<xs:documentation>
				<div>catchword symbolic reference</div>
				<div>mixture of letters some punctuation; <b>cannot be empty</b></div>
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value=".+"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:complexType name="CWReferences">
		<xs:annotation>
			<xs:documentation>
				<div>references to IPC symbols or intervals</div>
			</xs:documentation>
		</xs:annotation>

		<xs:choice maxOccurs="unbounded">
			<xs:element name="sref" type="cwSref"></xs:element>
			<xs:element name="mref" type="cwMref"></xs:element>
		</xs:choice>
	</xs:complexType>

	<xs:complexType name="catchwordSub" mixed="true">
		<xs:annotation>
			<xs:documentation>Catchword underlined text</xs:documentation>
		</xs:annotation>
	</xs:complexType>
	<xs:simpleType name="cwNumericId">
		<xs:annotation><xs:documentation>numeric identifier of the catchword entry</xs:documentation></xs:annotation>
		<xs:restriction base="xs:nonNegativeInteger">
		</xs:restriction>
	</xs:simpleType>



	<xs:complexType name="cwSref">
		<xs:annotation>
			<xs:documentation>
				<div>Catchword single reference</div>
				<div class="important"><span class="key">IPC References</span>similar to scheme sref but contains the necessary attribute for asterisks</div>
			</xs:documentation>
		</xs:annotation>
		<xs:complexContent>
			<xs:extension base="sref">
				<xs:attribute name="asterisk" type="yesno">
					<xs:annotation>
						<xs:documentation>
							<div>asterisk (restricted values) denoting the presence of an asterisk after the reference</div>
							<ul type="square">
								<li>
									<b>Y:</b>there must be an asterisk provided in the presentation</li>
								<li>
									<b>N:</b>no asterisk</li>
							</ul>
						</xs:documentation>
					</xs:annotation>
				</xs:attribute>
				<xs:attribute name="style" type="xs:string">
					<xs:annotation>
						<xs:documentation>
							<div>presentation style for indicating e.g. core/advanced status</div>
							<div>Obsolete attribute.</div>
						</xs:documentation>
					</xs:annotation>
				</xs:attribute>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="cwMref">
		<xs:annotation>
			<xs:documentation>
				<div>Catchword interval reference</div>
				<div class="important"><span class="key">IPC References</span>Similar to scheme mref but contains the necessary attribute for asterisks</div>
			</xs:documentation>
		</xs:annotation>
		<xs:complexContent>
			<xs:extension base="mref">
				<xs:attribute name="asterisk" type="yesno">
					<xs:annotation>
						<xs:documentation>
							<div>asterisk (restricted values) denoting the presence of an asterisk after the reference</div>
							<ul type="square">
								<li>
									<b>Y:</b>there must be an asterisk provided in the presentation</li>
								<li>
									<b>N:</b>no asterisk</li>
							</ul>
						</xs:documentation>
					</xs:annotation>
				</xs:attribute>
				<xs:attribute name="style" type="xs:string">
					<xs:annotation>
						<xs:documentation>
							<div>presentation style for indicating e.g. core/advanced status</div>
							<div>Obsolete attribute.</div>
						</xs:documentation>
					</xs:annotation>
				</xs:attribute>
				<xs:attribute name="endStyle" type="xs:string">
					<xs:annotation>
						<xs:documentation>style of the end symbol of reference</xs:documentation>
					</xs:annotation>
				</xs:attribute>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
</xs:schema>