Support for <filter type="multi">
[metaproxy-moved-to-github.git] / etc / config.xsd
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- $Id: config.xsd,v 1.4 2006-01-16 12:03:11 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       <!-- ### We 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 minOccurs="0" 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" or type="multi" -->
64         <xs:element minOccurs="0" maxOccurs="unbounded" ref="config:virtual"/>
65
66         <!-- type="auth_simple" or type="backend_test" -->
67         <!-- No elements included -->
68
69       </xs:choice>
70       <xs:attribute name="id" type="xs:NCName"/>
71       <xs:attribute name="refid" type="xs:NCName"/>
72       <xs:attribute name="type" type="xs:NCName"/>
73     </xs:complexType>
74   </xs:element>
75
76   <xs:element name="threads" type="xs:integer"/>
77   <xs:element name="port" type="xs:string"/>
78   <xs:element name="timeout" type="xs:integer"/>
79   <xs:element name="message" type="xs:NCName"/>
80
81   <!-- ### This is used differently depending on whether it occurs
82        within a "virt_db" or "multi" filter: for the former, it
83        contains one database and one target; for the latter, it
84        contains an optional vhost and one or more targets.  This
85        schema should be tweaked to enforce this. -->
86   <xs:element name="virtual">
87     <xs:complexType>
88       <xs:sequence>
89         <xs:element minOccurs="0" ref="config:database"/>
90         <xs:element minOccurs="0" ref="config:vhost"/>
91         <xs:element maxOccurs="unbounded" ref="config:target"/>
92       </xs:sequence>
93       <xs:attribute name="route" type="xs:NCName"/>
94     </xs:complexType>
95   </xs:element>
96
97   <xs:element name="database" type="xs:NCName"/>
98   <xs:element name="vhost" type="xs:NCName"/>
99   <xs:element name="target" type="xs:anyURI"/>
100
101
102   <xs:element name="routes">
103     <xs:complexType>
104       <xs:sequence>
105         <xs:element maxOccurs="unbounded" ref="config:route"/>
106       </xs:sequence>
107     </xs:complexType>
108   </xs:element>
109
110   <xs:element name="route">
111     <xs:complexType>
112       <xs:sequence>
113         <xs:element maxOccurs="unbounded" ref="config:filter"/>
114       </xs:sequence>
115       <xs:attribute name="id" use="required" type="xs:NCName"/>
116     </xs:complexType>
117   </xs:element>
118 </xs:schema>