added full RelaxNG based config file syntax checking
[metaproxy-moved-to-github.git] / xml / schema / metaproxy.rnc
1 # Metaproxy XML config file schemas
2 #  $Id: metaproxy.rnc,v 1.5 2006-10-10 15:10:18 marc Exp $
3
4 #   Copyright (c) 2005-2006, Index Data.
5
6 #   See the LICENSE file for details
7
8
9 # The RelaxNG Compact Syntax file 'metaproxy.rnc' is the master copy.
10
11 # The RelaxNG XML Syntax and XML Schema are generated using 'trang':
12 # trang metaproxy.rnc metaproxy.rng 
13 # trang metaproxy.rnc metaproxy.xsd 
14
15 # Config file validation is done using 'xmllint':
16 # xmllint -/-relaxng metaproxy.rng ../../../etc/config1.xml 
17 # xmllint -/-schema metaproxy.xsd config-bytarget.xml
18
19 # For information on RelaxNG see http://relaxng.org 
20 # see also http://books.xmlschemata.org/relaxng/
21
22 default namespace = "http://indexdata.dk/yp2/config/1"
23
24 start = metaproxy
25
26 metaproxy =
27   element yp2 {
28     element start {
29       attribute route { xsd:NCName }
30     },
31     element filters { filter+ }?,
32     element routes { route+ }
33   }
34
35 route =
36   element route {
37     attribute id { xsd:NCName },
38     filter+
39   }
40
41 filter =
42   element filter {
43     filter_refid
44     | filter_auth_simple
45     | filter_backend_test
46     | filter_bounce
47     | filter_frontend_net
48     | filter_http_file
49     | filter_log
50     | filter_multi
51     | filter_query_rewrite
52     | filter_record_transform
53     | filter_session_shared
54     | filter_sru_z3950
55     | filter_virt_db
56     | filter_z3950_client
57   }
58
59 filter_refid = attribute refid { xsd:NCName }
60
61 filter_auth_simple =
62   attribute type { "auth_simple" },
63   attribute id { xsd:NCName }?,
64   attribute name { xsd:NCName }?,
65   element userRegister { xsd:string }?,
66   element targetRegister { xsd:string }?,
67   element discardUnauthorisedTargets { empty }?
68
69 filter_backend_test =
70   attribute type { "backend_test" },
71   attribute id { xsd:NCName }?,
72   attribute name { xsd:NCName }?
73
74 filter_bounce =
75   attribute type { "bounce" },
76   attribute id { xsd:NCName }?,
77   attribute name { xsd:NCName }?
78
79 filter_frontend_net =
80   attribute type { "frontend_net" },
81   attribute id { xsd:NCName }?,
82   attribute name { xsd:NCName }?,
83   element threads { xsd:integer }?,
84   element port { xsd:string }
85
86 filter_http_file =
87   attribute type { "http_file" },
88   attribute id { xsd:NCName }?,
89   attribute name { xsd:NCName }?,
90   element mimetypes { xsd:string },
91   element area {
92     element documentroot { xsd:string },
93     element prefix { xsd:string }
94   }
95
96 filter_log =
97   attribute type { "log" },
98   attribute id { xsd:NCName }?,
99   attribute name { xsd:NCName }?,
100   element message { xsd:string }?,
101   element filename { xsd:string }?,
102   element category {
103     attribute init-options { xsd:boolean }?,
104     attribute request-session { xsd:boolean }?,
105     attribute response-session { xsd:boolean }?,
106     attribute apdu { xsd:boolean }?,
107     attribute request-apdu { xsd:boolean }?,
108     attribute response-apdu { xsd:boolean }?
109   }?
110
111 filter_multi =
112   attribute type { "multi" },
113   attribute id { xsd:NCName }?,
114   attribute name { xsd:NCName }?,
115   element target {
116     attribute route { xsd:string },
117     xsd:string
118   }*,
119   element hideunavailable { empty }?
120
121 filter_query_rewrite =
122   attribute type { "query_rewrite" },
123   attribute id { xsd:NCName }?,
124   attribute name { xsd:NCName }?,
125   element xslt { xsd:string }
126
127 filter_record_transform =
128   attribute type { "record_transform" },
129   attribute id { xsd:NCName }?,
130   attribute name { xsd:NCName }?,
131   retrievalinfo 
132
133 filter_session_shared =
134   attribute type { "session_shared" },
135   attribute id { xsd:NCName }?,
136   attribute name { xsd:NCName }?,
137   element resultset {
138     attribute max { xsd:integer },
139     attribute ttl { xsd:integer }
140   },
141   element session {
142     attribute ttl { xsd:integer }
143   }
144
145 filter_sru_z3950 =
146   attribute type { "sru_z3950" },
147   attribute id { xsd:NCName }?,
148   attribute name { xsd:NCName }?
149
150 filter_virt_db =
151   attribute type { "virt_db" },
152   attribute id { xsd:NCName }?,
153   attribute name { xsd:NCName }?,
154   element virtual {
155     attribute route { xsd:NCName }?,
156     element database { xsd:NCName },
157     element target { xsd:string }+
158   }+
159
160 filter_z3950_client =
161   attribute type { "z3950_client" },
162   attribute id { xsd:NCName }?,
163   attribute name { xsd:NCName }?,
164   element timeout { xsd:integer }?
165
166 retrievalinfo = 
167   element retrievalinfo { 
168     element retrieval {
169       attribute syntax { xsd:string },
170       attribute name { xsd:string }?,
171       attribute identifier { xsd:string }?,
172       attribute backendsyntax { xsd:string }?,
173       attribute backendname { xsd:string }?,
174       element convert {
175         element marc {
176           attribute inputformat { xsd:string },
177           attribute outputformat { xsd:string },
178           attribute inputcharset { xsd:string }
179         },
180         element xslt {
181           attribute stylesheet { xsd:string }
182         }?
183       }?
184     }+
185   }