1start = element config {
2  # Option scope
3  element optionscope {
4    attribute type { "GLOBAL" | "PER_TYPE" | "PER_ENTRY" },
5    element option { xsd:string }+
6  }+ &
7  element clrmacros           { "0" | "1" }? &
8  element collate             { "0" | "1" }? &
9  element collate_options     {
10    element option {
11      attribute name { text } &
12      attribute value { text }
13    }+
14  }? &
15# Can't specify the config file location in the config file ...
16#  element configfile          { text }? &
17  element convert_control     { "0" | "1" }? &
18  element dot_include         { text }? &
19  # Data model specification (mainly for tool mode)
20   datamodel? &
21  element decodecharsset      { text }? &
22  element debug               { "0" | "1" }? &
23  element fastsort            { "0" | "1" }? &
24  element fixinits            { "0" | "1" }? &
25# Would never want this in the config file
26#  element help                { "0" | "1" }? &
27  inheritance? &
28  element input_encoding      { text }? &
29  element listsep             { text }? &
30  element logfile             { text }? &
31  element mincrossrefs        { xsd:unsignedByte }? &
32  element mssplit             { text }? &
33  element namesep             { text }? &
34# Can't specify not to use a config file in the config file ...
35#  element noconf              { "0" | "1" }? &
36  element nodieonerror         { "0" | "1" }? &
37  element nolog                { "0" | "1" }? &
38  # noinit specification
39  element noinit {
40    element option {
41      attribute value { xsd:string },
42      empty
43    }+
44  }? &
45  # nosort specification
46  element nosort     {
47    element option {
48      attribute name { text } &
49      attribute value { text }
50    }+
51  }? &
52  element nostdmacros          { "0" | "1" }? &
53  element onlylog              { "0" | "1" }? &
54  element others_string        { text }? &
55  element output_align         { "0" | "1" }? &
56  element output_directory     { text }? &
57  element output_encoding      { text }? &
58  element output_fieldcase     { "upper" | "lower" | "title" }? &
59  element output_file          { text }? &
60  element output_format        { "bibtex" | "bbl" | "biblatexml" | "dot" }? &
61  element output_indent        { xsd:unsignedByte }? &
62  element output_macro_fields  { text }? &
63  element output_resolve       { "0" | "1" }? &
64  element output_safechars     { "0" | "1" }? &
65  element output_safecharsset  { "base" | "full" }? &
66  element quiet                { "0" | "1" }? &
67  element recodedata           { text }? &
68  element sortcase             { "0" | "1" }? &
69  element sortfirstinits       { "0" | "1" }? &
70  sorting? &
71  element sortlocale           { text }? &
72  element sortupper            { "0" | "1" }? &
73  element sourcemap            {
74    element maps {
75      attribute datatype { "bibtex" | "biblatexml" | "ris" | "zoterordfxml" | "endnotexml" },
76      attribute map_overwrite { "0" | "1" }?,
77      map+
78    }+
79  }? &
80  element ssl-nointernalca     { "0" | "1" }? &
81  element ssl-noverify-host    { "0" | "1" }? &
82  element tool                 { "0" | "1" }? &
83  element tool_config          { text }? &
84  element trace                { "0" | "1" }? &
85  element validate_config      { "0" | "1" }? &
86  element validate_control     { "0" | "1" }? &
87  element validate_datamodel   { "0" | "1" }? &
88# Meaningless in the config file
89#  element version              { "0" | "1" }? &
90  element wraplines            { "0" | "1" }?
91}
92
93datamodel =
94 element datamodel {
95    # Valid entrytypes
96    element entrytypes {
97      element entrytype {
98        # Some entrytypes should be completely skipped on output (XDATA etc.)
99        attribute skip_output { "true" }?,
100        text
101      }+
102    },
103    # BibLaTeX field types. Biber uses this to determine how to output various types
104    # to the .bbl
105    element fields {
106      element field {
107        # fieldtype is "field" or "list"
108        attribute fieldtype { "field" | "list" },
109        # format is a specification of the format of the field. If not specified, field contents
110        # are just as is.
111        attribute format { "csv" }?,
112        # datatype of field content
113        attribute datatype { "literal" | "name" | "key" | "entrykey" | "date" | "verbatim" | "integer" | "range" | "csv" | "code" | "uri" | "datepart" | "keyword" | "option" },
114        # Are we allowed to output a null field value to the .bbl for this field?
115        attribute nullok { "true" }?,
116        # Should this field be skipped and not output to the .bbl?
117        attribute skip_output { "true" }?,
118        text
119      }+
120    },
121    # Allowable fields for entrytypes
122    # Only one specification per entrytype: even though it might be nice to have several
123    # so that one could share information, this would be hard to manage and confusing as it
124    # not be visible in one place which fields were valid for an entrytype.
125    element entryfields {
126      element entrytype { text }*,
127      element field { text }+
128    }+,
129    # Constraints on field (co-)existence and format
130    element constraints {
131      # Set of entrytypes that this constraint applies to
132      # An entrytype can be specified in multiple constraints
133      #
134      element entrytype { text }*,
135      # A constraint specification
136      element constraint {
137        (
138          # Conditional constraints have an antecedent and consequent
139          # both of which have a quantifier. This allows you to enforce
140          # constraints like:
141          #
142          # if field a,b,c are all present then one of x,y,z must be
143          # if one of field a,b,c are present then none of x,y,z must be
144          # etc.
145          (attribute type { "conditional" },
146            element antecedent {
147              attribute quant { "all" | "one" | "none"},
148              element field { text }+
149            },
150            element consequent {
151              attribute quant { "all" | "one" | "none"},
152              element field { text }+
153            }
154          ) |
155          # Datatype and format constraints
156          (attribute type { "data" },
157            # range* attributes are for limiting integer type range
158            attribute datatype { "integer" | "isbn" | "issn" | "ismn" | "date" | "pattern" }?,
159            attribute rangemin { xsd:int }?,
160            attribute rangemax { xsd:int }?,
161            attribute pattern { text }?,
162            element field { text }+
163          ) |
164          # Mandatoriness constraints which say which fields must appear
165          (attribute type { "mandatory" },
166            (element field { text } |
167              # An XOR set of fields so you can enforce:
168              #
169              # One (but not more) of fields a,b,c must exist
170              element fieldxor {
171                element field { text }+
172              } |
173              # An OR set of fields so you can enforce:
174              #
175              # One (possibly more) of fields a,b,c must exist
176              element fieldor {
177                element field { text }+
178              }
179            )+
180          )
181        )
182      }*
183    }+
184  }
185inheritance =
186    # Cross-reference inheritance specifications
187    element inheritance {
188      # Defaults
189      element defaults {
190        # Whether to inherit all fields
191        attribute inherit_all { "true" | "false" },
192        # Should we overwrite the target field if it exists?
193        attribute override_target { "true" | "false" },
194        # Default inherit_all and override_target settings for entrytype source/target pairs
195        element type_pair {
196          attribute source { "*" | xsd:string {minLength="1"}},
197          attribute target { "*" | xsd:string {minLength="1"}},
198          attribute inherit_all { "true" | "false" }?,
199          attribute override_target { "true" | "false" }?,
200          empty
201        }*
202      },
203      # An inheritance specification
204      element inherit {
205        # applies to these pairs of source/target entrytypes
206        element type_pair {
207          attribute source { "*" | xsd:string {minLength="1"}},
208          attribute target { "*" | xsd:string {minLength="1"}},
209          empty
210        }+,
211        # and here are the field specifications
212        element field {
213          (
214            # either a "skip this field" specification
215            # so we can say inherit all except certain fields OR ...
216            (attribute source { xsd:string },
217              attribute skip { "true" | "false" }) |
218            # ... a source and target field with an optional override attribute
219            (attribute source { xsd:string {minLength="1"}},
220              attribute target { xsd:string {minLength="1"}},
221              attribute override_target { "true" | "false" }?)
222          ),
223          empty
224        }+
225      }*
226    }
227
228
229
230map =
231  element map {
232    attribute map_overwrite { "0" | "1" }?,
233    element per_datasource { xsd:string {minLength="1"} }*,
234    element per_type { xsd:string {minLength="1"} }*,
235    element map_step {
236      (
237        (
238          attribute map_entry_null { "1" }
239        ) |
240        (
241          attribute map_type_source { xsd:string {minLength="1"} },
242          attribute map_type_target { xsd:string {minLength="1"} }?,
243          attribute map_final { "1" }?
244        ) |
245        (
246          attribute map_field_source { xsd:string {minLength="1"} },
247          attribute map_field_target { xsd:string {minLength="1"} }?,
248          attribute map_final { "1" }?,
249          attribute map_match { xsd:string {minLength="1"} }?,
250          attribute map_notmatch { xsd:string {minLength="1"} }?,
251          attribute map_replace { xsd:string {minLength="1"} }?
252        ) |
253        (
254          attribute map_field_set { xsd:string {minLength="1"} },
255          attribute map_append { "1" }?,
256          attribute map_final { "1" }?,
257          ( attribute map_null { "1" } |
258            attribute map_origfield { "1" } |
259            attribute map_origfieldval { "1" } |
260            attribute map_origentrytype { "1" } |
261            attribute map_field_value { xsd:string {minLength="1"} } )
262        )
263      ),
264      empty
265    }+
266  }
267
268sorting =
269  element sorting {
270    # locale for entire sorting specification
271    attribute locale { xsd:string {minLength="1"}}?,
272    # presort default strings for different entry types
273    element presort {
274      attribute type { text }?,
275      text
276    }+,
277    # excludes of certain fields for sorting for specified types
278    element sortexclusion {
279      attribute type { text },
280      element exclusion { text }+
281    }*,
282    sort+
283  }
284
285sort =
286  # sort specification
287  element sort {
288    # order of this specification in the set of all sort specifications
289    attribute order { xsd:integer },
290    # Should we stop generating sorting information after this item?
291    attribute final { "1" }?,
292    # Sort ascending or descending
293    attribute sort_direction { "ascending" | "descending" }?,
294    # Sort case sensitive or not?
295    attribute sortcase { "0" | "1" }?,
296    # Sort upper before lower?
297    attribute sortupper { "0" | "1" }?,
298    # sortset specific override for locale
299    attribute locale { xsd:string {minLength="1"}}?,
300    # A sort item specification - a field or pseudo-field to get sort information from
301    element sortitem {
302      # order of this item in the set of all other item specifications
303      attribute order { xsd:integer },
304      # Just use a part of the item information for sorting?
305      attribute substring_side { "left" | "right" }?,
306      attribute substring_width { xsd:integer }?,
307      # Pad the item information when sorting with it?
308      attribute pad_side { "left" | "right" }?,
309      attribute pad_width { xsd:integer }?,
310      attribute pad_char { xsd:string { minLength = "1" maxLength = "1" } }?,
311      attribute form { "original" | "translated" | "romanised" | "uniform" }?,
312      text
313    }+
314  }+
315# Copyright 2009-2015 François Charette and Philip Kime, all rights reserved.
316
317# This code is free software.  You can redistribute it and/or
318# modify it under the terms of the Artistic License 2.0.
319
320# This program is distributed in the hope that it will be useful,
321# but without any warranty; without even the implied warranty of
322# merchantability or fitness for a particular purpose.
323