New
[metaproxy-moved-to-github.git] / etc / config.xsd
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- $Id: config.xsd,v 1.1 2006-01-13 16:28:00 mike Exp $ -->
3 <!--
4         This Schema prescribes the format of YP2 configuration files.
5         Invoke it like this:
6                 xmllint -noout -schema config.xsd config1.xml
7         But use double-dashes for the option names instead of single.
8         (I couldn't include them literally, as, believe it or not,
9         it's an error to include a double dash in an XML comment.
10 -->
11 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
12            elementFormDefault="qualified"
13            targetNamespace="http://indexdata.dk/yp2/config/1"
14            xmlns:config="http://indexdata.dk/yp2/config/1">
15
16   <xs:element name="yp2">
17     <xs:complexType>
18       <xs:sequence>
19         <xs:element ref="config:start"/>
20         <xs:element ref="config:filters"/>
21         <xs:element ref="config:routes"/>
22       </xs:sequence>
23     </xs:complexType>
24   </xs:element>
25
26
27   <xs:element name="start">
28     <xs:complexType>
29       <!-- ### need to specify here that the element is empty -->
30       <xs:attribute name="route" use="required" type="xs:NCName"/>
31     </xs:complexType>
32   </xs:element>
33
34
35   <xs:element name="filters">
36     <xs:complexType>
37       <xs:sequence>
38         <xs:element maxOccurs="unbounded" ref="config:filter"/>
39       </xs:sequence>
40     </xs:complexType>
41   </xs:element>
42
43   <xs:element name="filter">
44     <xs:complexType>
45       <xs:choice>
46         <!-- In general, the content depends on the "type" attribute.
47              Perhaps the various filter-types' configuration
48              structures should each be described by their own little
49              subschemas? -->
50
51         <!-- type="frontend_net" -->
52         <xs:sequence>
53           <xs:element ref="config:threads"/>
54           <xs:element ref="config:port"/>
55         </xs:sequence>
56
57         <!-- type="z3950_client" -->
58         <xs:element ref="config:timeout"/>
59
60         <!-- type="log" -->
61         <xs:element ref="config:message"/>
62
63         <!-- type="virt_db" -->
64         <xs:element minOccurs="0" maxOccurs="unbounded" ref="config:virtual"/>
65
66       </xs:choice>
67       <xs:attribute name="id" type="xs:NCName"/>
68       <xs:attribute name="refid" type="xs:NCName"/>
69       <xs:attribute name="type" type="xs:NCName"/>
70     </xs:complexType>
71   </xs:element>
72
73   <xs:element name="threads" type="xs:integer"/>
74   <xs:element name="port" type="xs:string"/>
75   <xs:element name="timeout" type="xs:integer"/>
76   <xs:element name="message" type="xs:NCName"/>
77
78   <xs:element name="virtual">
79     <xs:complexType>
80       <xs:sequence>
81         <xs:element ref="config:database"/>
82         <xs:element ref="config:target"/>
83       </xs:sequence>
84     </xs:complexType>
85   </xs:element>
86
87   <xs:element name="database" type="xs:NCName"/>
88   <xs:element name="target" type="xs:anyURI"/>
89
90
91   <xs:element name="routes">
92     <xs:complexType>
93       <xs:sequence>
94         <xs:element maxOccurs="unbounded" ref="config:route"/>
95       </xs:sequence>
96     </xs:complexType>
97   </xs:element>
98
99   <xs:element name="route">
100     <xs:complexType>
101       <xs:sequence>
102         <xs:element maxOccurs="unbounded" ref="config:filter"/>
103       </xs:sequence>
104       <xs:attribute name="id" use="required" type="xs:NCName"/>
105     </xs:complexType>
106   </xs:element>
107 </xs:schema>