<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
			CATCHWORD
	Contacts: WIPO: Patrick Fi&eacute;vet (patrick.fievet@wipo.int).
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  -->

<!-- 20050804 TA external entry needed to include EN/FR versions in the same file -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
	<xs:import namespace="http://www.w3.org/XML/1998/namespace"/>
	<xs:element name="CWSet">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="CW" maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	
	<!--  CW
			lang		language of indications in this file
			TRANSLATIONLANG 	default language of the translations, if any
			EDITION	edition of IPC the CW belongs to
			TYPE	   	CW,SW or anything else (e.g. reverse IPC)
			LETTER	[A-Z] capital letter
			Interface only:
			CW 	sequence number of the document;  the XML file is called: type edition lang _ lowercase(letter) (CW) .xml
			FROMBEGIN	first entry of the preceding page; empty when == FROMBEGINID
			FROMBEGINID	id of first entry of the preceding page
			FROMEND	last entry of the preceding page; empty when == FROMENDID
			FROMENDID	id of last entry of the preceding page
			TOBEGIN	first entry of the subsequent page; empty when == TOBEGINID
			TOBEGINID	id of first entry of the subsequent page
			TOEND	last entry of the preceding page; empty when == TOENDID
			TOENDID	id of last entry of the subsequent page
			PURPOSE	purpose of the file
	-->
	<xs:element name="CW">
		<xs:complexType>
			<xs:choice>
				<xs:element ref="CWEntry" maxOccurs="unbounded"/>
				<xs:element ref="CWLetter" maxOccurs="unbounded"/>
			</xs:choice>
			<xs:attribute name="lang" type="xs:anySimpleType" use="required"/>
			<xs:attribute name="TRANSLATIONLANG" type="xs:anySimpleType"/>
			<xs:attribute name="edition" type="xs:anySimpleType" use="required"/>
			<xs:attribute name="type" type="xs:anySimpleType"/>
			<xs:attribute name="view" type="xs:anySimpleType"/>
			<xs:attribute name="displaymode" type="xs:anySimpleType"/>
			<xs:attribute name="letter" type="xs:anySimpleType"/>
			<xs:attribute name="CW" type="xs:anySimpleType"/>
			<xs:attribute name="FROMBEGIN" type="xs:anySimpleType" default=""/>
			<xs:attribute name="FROMBEGINID" type="xs:anySimpleType"/>
			<xs:attribute name="FROMEND" type="xs:anySimpleType" default=""/>
			<xs:attribute name="FROMENDID" type="xs:anySimpleType"/>
			<xs:attribute name="TOBEGIN" type="xs:anySimpleType" default=""/>
			<xs:attribute name="TOBEGINID" type="xs:anySimpleType"/>
			<xs:attribute name="TOEND" type="xs:anySimpleType" default=""/>
			<xs:attribute name="TOENDID" type="xs:anySimpleType"/>
			<xs:attribute name="PURPOSE" type="xs:anySimpleType"/>
			<xs:attribute name="documentRoot" type="xs:anySimpleType" default=""/>
		</xs:complexType>
	</xs:element>
	<xs:element name="CWLetter">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="CWEntryInterval" maxOccurs="unbounded"/>
			</xs:sequence>
			<xs:attribute name="letter" type="xs:anySimpleType"/>
		</xs:complexType>
	</xs:element>
	<xs:element name="CWEntryInterval">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="CWEntry" maxOccurs="unbounded"/>
			</xs:sequence>
			<xs:attribute name="en" type="xs:anySimpleType"/>
		</xs:complexType>
	</xs:element>
	
	<!--  CWEntry	right-recursive structure containing tree of entries [currently: 3 levels are defined in CW, SW needs analysis, reverse IPC is variable depth]
					each entry has:
			an CWIndication (the text itself, with a little markup)
			an optional CWSee also clause, defining related CW entries,
			a (may be, empty) set of  TRANSLATIONs (in one [//CW[@translationlang] or more languages)
			optionally, it may contain CWReferences (e.g. a very broad CWentry has no specified reference)
			'child' CWentries, narrowing the meaning of the main CWentry
		   ATTLIST
			ID	generated identifier of the entry; type ID would not allow data development!!!
	-->
	<xs:element name="CWEntry">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="CWIndication"/>
				<xs:element ref="CWSee" minOccurs="0"/>
				<xs:element ref="CWReferences" minOccurs="0"/>
				<xs:element ref="CWEntry" minOccurs="0" maxOccurs="unbounded"/>
			</xs:sequence>
			<xs:attribute name="id" type="xs:anySimpleType"/>
			<xs:attribute name="rn" type="xs:anySimpleType"/>
			<xs:attribute name="xmlId" type="xs:anySimpleType"/>
			<xs:attribute name="remark" type="xs:anySimpleType"/>
		</xs:complexType>
	</xs:element>
	
	<!--  CWIndication	the text of the entry; SUB is used in CW; the CWIndication entry is subject of change during SW and reverse IPC integration -->
	<xs:element name="CWIndication">
		<xs:complexType mixed="true">
			<xs:choice minOccurs="0" maxOccurs="unbounded">
				<xs:element ref="sub"/>
				<xs:element ref="ldash"/>
				<xs:element ref="larrow"/>
				<xs:element ref="rarrow"/>
			</xs:choice>
		</xs:complexType>
	</xs:element>
	
	<!--  CWSee
			see also references; it contains:
			free text (maybe SUB or LDASH), and
			CWRefS
	-->
	<xs:element name="CWSee">
		<xs:complexType mixed="true">
			<xs:choice minOccurs="0" maxOccurs="unbounded">
				<xs:element ref="sub"/>
				<xs:element ref="ldash"/>
				<xs:element ref="CWRef"/>
			</xs:choice>
		</xs:complexType>
	</xs:element>
	
	<!--  CWRef	reference to an CW entry
	      ATTLIST
			REFID	identifier to which the reference refers; REFID would not tolerate data development!
	-->
	<xs:element name="CWRef">
		<xs:complexType mixed="true">
			<xs:attribute name="REFID" type="xs:anySimpleType" use="required"/>
			<xs:attribute name="SEQUENCE" type="xs:anySimpleType"/>
		</xs:complexType>
	</xs:element>
	
	<!--  CWReferences either single or multiple references -->
	<xs:element name="CWReferences">
		<xs:complexType>
			<xs:choice maxOccurs="unbounded">
				<xs:element ref="sref"/>
				<xs:element ref="mref"/>
			</xs:choice>
		</xs:complexType>
	</xs:element>
	
	<!--  sref, mref: references to IPC symbols
		  Attributes:
			ref:	IPC symbol in A99AZZZMGGZZZZ format
			endRef:	end of reference interval IPC symbol in A99AZZZMGGZZZZ format
			refType: compatibility with prereform, / or :
			endRefType: type of the end of reference type
			reference level: c(ore) a(advanced), default: core
				references are rolled up in the core publication
			style: RIPCIS specific
			refAdvanced: non-rolled-up reference
			endRefAdvanced: non-rolled-up reference of the end of interval
	-->
	<xs:element name="sref">
		<xs:complexType>
			<xs:attribute name="ref" type="xs:anySimpleType" use="required"/>
			<xs:attribute name="refType" type="xs:anySimpleType" default="/"/>
			<xs:attribute name="refLevel" default="c">
				<xs:simpleType>
					<xs:restriction base="xs:NMTOKEN">
						<xs:enumeration value="a"/>
						<xs:enumeration value="c"/>
						<xs:enumeration value="i"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
			<xs:attribute name="style" type="xs:anySimpleType"/>
			<xs:attribute name="refAdvanced" type="xs:anySimpleType"/>
			<xs:attribute name="asterisk">
				<xs:simpleType>
					<xs:restriction base="xs:NMTOKEN">
						<xs:enumeration value="N"/>
						<xs:enumeration value="Y"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
		</xs:complexType>
	</xs:element>
	<xs:element name="mref">
		<xs:complexType>
			<xs:attribute name="ref" type="xs:anySimpleType" use="required"/>
			<xs:attribute name="endRef" type="xs:anySimpleType" use="required"/>
			<xs:attribute name="refType" type="xs:anySimpleType" default="/"/>
			<xs:attribute name="endRefType" type="xs:anySimpleType" default="/"/>
			<xs:attribute name="refLevel" default="c">
				<xs:simpleType>
					<xs:restriction base="xs:NMTOKEN">
						<xs:enumeration value="a"/>
						<xs:enumeration value="c"/>
						<xs:enumeration value="i"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
			<xs:attribute name="endRefLevel" default="c">
				<xs:simpleType>
					<xs:restriction base="xs:NMTOKEN">
						<xs:enumeration value="a"/>
						<xs:enumeration value="c"/>
						<xs:enumeration value="i"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
			<xs:attribute name="style" type="xs:anySimpleType"/>
			<xs:attribute name="endStyle" type="xs:anySimpleType"/>
			<xs:attribute name="refAdvanced" type="xs:anySimpleType"/>
			<xs:attribute name="endRefAdvanced" type="xs:anySimpleType"/>
			<xs:attribute name="asterisk">
				<xs:simpleType>
					<xs:restriction base="xs:NMTOKEN">
						<xs:enumeration value="N"/>
						<xs:enumeration value="Y"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
		</xs:complexType>
	</xs:element>
	
	<!-- Special characters -->
	<xs:element name="sub">
		<xs:complexType mixed="true"/>
	</xs:element>
	<xs:element name="larrow">
		<xs:complexType/>
	</xs:element>
	<xs:element name="rarrow">
		<xs:complexType/>
	</xs:element>
	<xs:element name="oe">
		<xs:complexType/>
	</xs:element>
	<xs:element name="OE">
		<xs:complexType/>
	</xs:element>
	<xs:element name="ldash">
		<xs:complexType/>
	</xs:element>
</xs:schema>
