| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
|
| 3 |
<!-- |
| 4 |
This type of file is for ordering named PPD files for a given |
| 5 |
printer. |
| 6 |
|
| 7 |
When choosing a driver for a known printer, first the complete list |
| 8 |
of available drivers is compiled. This includes any generic |
| 9 |
drivers that are likely to be able to drive the device, based on |
| 10 |
its IEEE 1284 Device ID's COMMAND SET field. |
| 11 |
|
| 12 |
The next task is to present this list to the user in order of |
| 13 |
preference, i.e. the drivers most likely to be the "right" ones |
| 14 |
first. |
| 15 |
|
| 16 |
This is done with reference to an XML file of the type described |
| 17 |
here. |
| 18 |
|
| 19 |
Child elements of the preferenceorder element are processed in |
| 20 |
order, with each printer element being matched against the printer |
| 21 |
in question. Once all the elements have been processed, the result |
| 22 |
will be a list of driver types in preference order (most preferred |
| 23 |
first), and a set of blacklisted driver types. |
| 24 |
|
| 25 |
For each printer element, at least one of the make-and-model and |
| 26 |
deviceid elements must match. A deviceid element matches if all of |
| 27 |
the field regular expressions match. For a matching printer |
| 28 |
element, the driver types matching each pattern contained in the |
| 29 |
drivers, avoid, and blacklist elements are appended to separate |
| 30 |
lists for drivers to use, drivers to avoid, and drivers that must |
| 31 |
not be used. |
| 32 |
|
| 33 |
A printer element that does not contain any make-and-model or |
| 34 |
deviceid elements is a "catch-all" element and matches any |
| 35 |
printer. |
| 36 |
|
| 37 |
To convert this into a list of drivers (i.e. PPDs), the drivertypes |
| 38 |
element is examined. Each PPD is assigned a driver type name, and |
| 39 |
then the PPDs are arranged in order corresponding to the list of |
| 40 |
preferred driver types. Drivers in the avoid list are then placed |
| 41 |
at the end of the list, and drivers in the blacklist are removed |
| 42 |
altogether. |
| 43 |
|
| 44 |
To determine the driver type name for a PPD, the child elements of |
| 45 |
the drivertypes element are examined. For each drivertype element, |
| 46 |
the criteria elements defined are matched against the PPD |
| 47 |
attributes. If all criteria are satisfied, this PPD's driver type |
| 48 |
is given by the "name" attribute of the containing drivertype |
| 49 |
element. In this case, no further drivertype elements are |
| 50 |
examined. |
| 51 |
|
| 52 |
If there are no criteria defined by a driver type, it is considered |
| 53 |
to match (i.e. it is a "catch-all" type). |
| 54 |
--> |
| 55 |
|
| 56 |
<grammar xmlns="http://relaxng.org/ns/structure/1.0" |
| 57 |
xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" |
| 58 |
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> |
| 59 |
<start> |
| 60 |
<element name="preferreddrivers"> |
| 61 |
<ref name="drivertypes"/> |
| 62 |
<ref name="preferenceorder"/> |
| 63 |
</element> |
| 64 |
</start> |
| 65 |
|
| 66 |
<!-- drivertypes --> |
| 67 |
<define name="drivertypes"> |
| 68 |
<element name="drivertypes"> |
| 69 |
<zeroOrMore> |
| 70 |
<!-- First matching element stops processing of elements |
| 71 |
following it --> |
| 72 |
<ref name="drivertype"/> |
| 73 |
</zeroOrMore> |
| 74 |
</element> |
| 75 |
</define> |
| 76 |
|
| 77 |
<define name="drivertype"> |
| 78 |
<element name="drivertype"> |
| 79 |
<attribute name="name"> |
| 80 |
<!-- Same name may be specified in more than one drivertype |
| 81 |
element --> |
| 82 |
<data type="normalizedString"/> |
| 83 |
</attribute> |
| 84 |
|
| 85 |
<optional> |
| 86 |
<attribute name="packagehint"> |
| 87 |
<!-- A filename belonging to the package providing this |
| 88 |
driver type --> |
| 89 |
<data type="normalizedString"/> |
| 90 |
</attribute> |
| 91 |
</optional> |
| 92 |
|
| 93 |
<!-- Match criteria (ppdname, attributes, deviceid, fit) |
| 94 |
within one drivertype element must all be satisfied --> |
| 95 |
<interleave> |
| 96 |
<optional> |
| 97 |
<ref name="ppdname"/> |
| 98 |
</optional> |
| 99 |
|
| 100 |
<zeroOrMore> |
| 101 |
<ref name="attribute"/> |
| 102 |
</zeroOrMore> |
| 103 |
|
| 104 |
<zeroOrMore> |
| 105 |
<ref name="deviceid"/> |
| 106 |
</zeroOrMore> |
| 107 |
|
| 108 |
<zeroOrMore> |
| 109 |
<ref name="fit"/> |
| 110 |
</zeroOrMore> |
| 111 |
</interleave> |
| 112 |
</element> |
| 113 |
</define> |
| 114 |
|
| 115 |
<define name="ppdname"> |
| 116 |
<element name="ppdname"> |
| 117 |
<attribute name="match"> |
| 118 |
<!-- Extended regular expression for matching against |
| 119 |
ppd-name attribute value (starting at beginning) |
| 120 |
--> |
| 121 |
<data type="string"/> |
| 122 |
</attribute> |
| 123 |
|
| 124 |
<empty/> |
| 125 |
</element> |
| 126 |
</define> |
| 127 |
|
| 128 |
<define name="attribute"> |
| 129 |
<element name="attribute"> |
| 130 |
<attribute name="name"> |
| 131 |
<!-- IPP attribute name, e.g. ppd-make-and-model --> |
| 132 |
<data type="normalizedString"/> |
| 133 |
</attribute> |
| 134 |
|
| 135 |
<attribute name="match"> |
| 136 |
<!-- Extended regular expression for matching against |
| 137 |
attribute's value (starting at beginning) --> |
| 138 |
<data type="string"/> |
| 139 |
</attribute> |
| 140 |
|
| 141 |
<empty/> |
| 142 |
</element> |
| 143 |
</define> |
| 144 |
|
| 145 |
<define name="deviceid"> |
| 146 |
<element name="deviceid"> |
| 147 |
<oneOrMore> |
| 148 |
<element name="field"> |
| 149 |
<attribute name="name"> |
| 150 |
<!-- Case-insensitive, abbreviated form of IEEE 1284 |
| 151 |
Device ID field key name e.g. MFG --> |
| 152 |
<data type="normalizedString"/> |
| 153 |
</attribute> |
| 154 |
|
| 155 |
<attribute name="match"> |
| 156 |
<!-- Extended regular expression for matching against |
| 157 |
IEEE 1284 Device ID field's value (starting at |
| 158 |
beginning) --> |
| 159 |
<data type="string"/> |
| 160 |
</attribute> |
| 161 |
|
| 162 |
<empty/> |
| 163 |
</element> |
| 164 |
</oneOrMore> |
| 165 |
</element> |
| 166 |
</define> |
| 167 |
|
| 168 |
<define name="fit"> |
| 169 |
<element name="fit"> |
| 170 |
<list> |
| 171 |
<oneOrMore> |
| 172 |
<choice> |
| 173 |
<!-- Drivers are put into one of the following categories |
| 174 |
regarding how well it fits for this particular |
| 175 |
printer. When matching against a category of |
| 176 |
fitness, "exact" implies "exact-cmd", i.e. an |
| 177 |
"exact-cmd" driver will match an entry listing |
| 178 |
"exact". --> |
| 179 |
|
| 180 |
<!-- STATUS_SUCCESS and CMD matches --> |
| 181 |
<value>exact-cmd</value> |
| 182 |
|
| 183 |
<!-- STATUS_SUCCESS --> |
| 184 |
<value>exact</value> |
| 185 |
|
| 186 |
<!-- STATUS_MODEL_MISMATCH --> |
| 187 |
<value>close</value> |
| 188 |
|
| 189 |
<!-- STATUS_GENERIC_DRIVER --> |
| 190 |
<value>generic</value> |
| 191 |
|
| 192 |
<!-- STATUS_NO_DRIVER --> |
| 193 |
<value>none</value> |
| 194 |
</choice> |
| 195 |
</oneOrMore> |
| 196 |
</list> |
| 197 |
</element> |
| 198 |
</define> |
| 199 |
|
| 200 |
<!-- typeorders --> |
| 201 |
<define name="preferenceorder"> |
| 202 |
<element name="preferenceorder"> |
| 203 |
<zeroOrMore> |
| 204 |
<!-- Matches are accumulated --> |
| 205 |
<ref name="printer"/> |
| 206 |
</zeroOrMore> |
| 207 |
</element> |
| 208 |
</define> |
| 209 |
|
| 210 |
<define name="printer"> |
| 211 |
<element name="printer"> |
| 212 |
|
| 213 |
<!-- Any of these make-and-model or deviceid criteria must match --> |
| 214 |
<optional> |
| 215 |
<element name="make-and-model"> |
| 216 |
<attribute name="match"> |
| 217 |
<!-- Extended regular expression for matching against |
| 218 |
device-make-and-model attribute value (starting at |
| 219 |
beginning) --> |
| 220 |
<data type="string"/> |
| 221 |
</attribute> |
| 222 |
<empty/> |
| 223 |
</element> |
| 224 |
</optional> |
| 225 |
|
| 226 |
<zeroOrMore> |
| 227 |
<ref name="deviceid"/> |
| 228 |
</zeroOrMore> |
| 229 |
|
| 230 |
<interleave> |
| 231 |
<optional> |
| 232 |
<element name="drivers"> |
| 233 |
<!-- Ordered list of named drivertypes, most preferred |
| 234 |
first --> |
| 235 |
<oneOrMore> |
| 236 |
<element name="drivertype"> |
| 237 |
<!-- drivertype glob pattern --> |
| 238 |
<text/> |
| 239 |
</element> |
| 240 |
</oneOrMore> |
| 241 |
</element> |
| 242 |
</optional> |
| 243 |
|
| 244 |
<optional> |
| 245 |
<!-- These drivertypes will collectively be put last in |
| 246 |
the preference list, in no particular order. --> |
| 247 |
<element name="avoid"> |
| 248 |
<oneOrMore> |
| 249 |
<element name="drivertype"> |
| 250 |
<!-- drivertype glob pattern --> |
| 251 |
<text/> |
| 252 |
</element> |
| 253 |
</oneOrMore> |
| 254 |
</element> |
| 255 |
</optional> |
| 256 |
|
| 257 |
<optional> |
| 258 |
<element name="blacklist"> |
| 259 |
<!-- List of named drivertypes which must not be used --> |
| 260 |
<oneOrMore> |
| 261 |
<element name="drivertype"> |
| 262 |
<!-- drivertype glob pattern --> |
| 263 |
<text/> |
| 264 |
</element> |
| 265 |
</oneOrMore> |
| 266 |
</element> |
| 267 |
</optional> |
| 268 |
</interleave> |
| 269 |
</element> |
| 270 |
</define> |
| 271 |
</grammar> |