|
5 | 5 | xmlns:xlink="http://www.w3.org/1999/xlink"> |
6 | 6 | <info> |
7 | 7 | <title>XML Validation</title> |
8 | | - <date>4Q25</date> |
| 8 | + <date>2Q26</date> |
9 | 9 | <keywordset> |
10 | 10 | <keyword>application-development</keyword> |
11 | 11 | <keyword>testing</keyword> |
|
109 | 109 | <para>All grammars (XML schema, DTD) used for implicit validation must be registered |
110 | 110 | with eXist using <link condition="_blank" |
111 | 111 | xlink:href="https://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html" |
112 | | - >OASIS catalog</link> files. The actual resolving is performed by the Apache <link |
113 | | - condition="_blank" xlink:href="https://xml.apache.org/commons/components/resolver/" |
114 | | - >xml-commons resolver</link> library.</para> |
| 112 | + >OASIS catalog</link> files. The actual resolving is performed by Norman Walsh's |
| 113 | + <link condition="_blank" xlink:href="https://github.com/xmlresolver/xmlresolver" |
| 114 | + >xmlresolver</link> library.</para> |
115 | 115 | <para>Catalogs can be stored on disk and/or in the database.</para> |
116 | 116 | <para>It is possible to configure multiple catalog entries in <tag>entity-resolver</tag> |
117 | 117 | child element(s) of <tag>validation</tag> in <code>conf.xml</code>. For instance: </para> |
|
237 | 237 | </listitem> |
238 | 238 | </varlistentry> |
239 | 239 | </variablelist> |
| 240 | + |
| 241 | + <para>XSD 1.1 schemas (declaring <code>vc:minVersion="1.1"</code>) are supported |
| 242 | + transparently. The bundled Xerces library only wires XSD 1.1 support into the |
| 243 | + <code>javax.xml.validation</code> API, not into the dynamic-discovery parser |
| 244 | + <code>jaxp()</code>/<code>jaxp-report()</code> otherwise use, so when the instance's |
| 245 | + own <code>xsi:schemaLocation</code>/<code>xsi:noNamespaceSchemaLocation</code> hint |
| 246 | + resolves to an XSD 1.1 schema, validation is transparently routed through the |
| 247 | + <link linkend="jaxv">JAXV</link> validator pipeline instead. This also works for |
| 248 | + schemas resolved purely by namespace via a directory-search (collection) catalog, |
| 249 | + with no <code>schemaLocation</code> hint present. <code>$cache-grammars</code> |
| 250 | + applies in both cases.</para> |
| 251 | + <note> |
| 252 | + <para>The schemaLocation-hint resolution that picks the XSD 1.1 pipeline only ever |
| 253 | + follows locations within the instance document's own origin (same scheme and |
| 254 | + host/port) — an absolute, cross-origin hint is never followed, since the hint |
| 255 | + is document-author-controlled.</para> |
| 256 | + </note> |
240 | 257 | </sect2> |
241 | 258 |
|
242 | 259 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
|
247 | 264 | <para>The JAXV validation functions are based on the <link condition="_blank" |
248 | 265 | xlink:href="https://docs.oracle.com/javase/10/docs/api/javax/xml/validation/package-summary.html" |
249 | 266 | > <code>java.xml.validation</code> </link> API which has been introduced in Java 5 |
250 | | - to provide a schema-language-independent interface to validation services. Although |
251 | | - officially the specification allows use of additional schema languages, only XML |
252 | | - schemas can be really used so far. </para> |
| 267 | + to provide a schema-language-independent interface to validation services, backed |
| 268 | + by a pluggable <code>SchemaFactory</code> per schema language. eXist-db bundles |
| 269 | + factories for XSD 1.0, XSD 1.1, and RELAX NG 1.0 — see <code>$language</code> |
| 270 | + below. </para> |
253 | 271 | <para>The <code>jaxv()</code> and <code>jaxv-report()</code> functions accept the |
254 | 272 | following parameters: </para> |
255 | 273 | <variablelist> |
|
291 | 309 | </itemizedlist> |
292 | 310 | </listitem> |
293 | 311 | </varlistentry> |
| 312 | + <varlistentry> |
| 313 | + <term> <code>$catalogs</code> </term> |
| 314 | + <listitem> |
| 315 | + <para>Optional. One or more OASIS catalog files referenced as |
| 316 | + <code>xs:anyURI</code>, used for resolving <code>xs:import</code>/ |
| 317 | + <code>xs:include</code> inside <code>$grammars</code>. Resolution |
| 318 | + happens when the grammar is compiled (before validation runs), and |
| 319 | + follows the same rules as <code>jaxp()</code>'s <code>$catalogs</code> |
| 320 | + parameter: </para> |
| 321 | + <itemizedlist> |
| 322 | + <listitem> |
| 323 | + <para>When passing an empty sequence <code>()</code>, the catalog |
| 324 | + files defined in <code>conf.xml</code> are used.</para> |
| 325 | + </listitem> |
| 326 | + <listitem> |
| 327 | + <para>If the URI ends with <code>.xml</code> the specified catalog |
| 328 | + is used.</para> |
| 329 | + </listitem> |
| 330 | + <listitem> |
| 331 | + <para>If the URI ends with <code>/</code> it is supposed to point |
| 332 | + to a collection. The grammar files are searched in this |
| 333 | + collection and its sub-collections by their |
| 334 | + <code>targetNamespace</code> attribute.</para> |
| 335 | + </listitem> |
| 336 | + </itemizedlist> |
| 337 | + </listitem> |
| 338 | + </varlistentry> |
294 | 339 | </variablelist> |
295 | 340 | </sect2> |
296 | 341 |
|
|
301 | 346 |
|
302 | 347 | <para>The Jing validation functions are based on James Clark's <link condition="_blank" |
303 | 348 | xlink:href="http://www.thaiopensource.com/relaxng/jing.html">Jing</link> library. |
304 | | - eXist uses the maintained version that is available via <link condition="_blank" |
305 | | - xlink:href="https://code.google.com/p/jing-trang/">Google Code</link>. The library |
306 | | - relies on the <link condition="_blank" |
| 349 | + eXist uses the maintained <link condition="_blank" |
| 350 | + xlink:href="https://github.com/relaxng/jing-trang">jing-trang</link> fork. The |
| 351 | + library relies on the <link condition="_blank" |
307 | 352 | xlink:href="http://www.thaiopensource.com/relaxng/api/jing/com/thaiopensource/validate/ValidationDriver.html" |
308 | 353 | ><code>com.thaiopensource.validate.ValidationDriver</code></link> which supports a |
309 | 354 | wide range of grammar types: </para> |
|
439 | 484 |
|
440 | 485 | <itemizedlist> |
441 | 486 | <listitem> |
442 | | - <para>Apache <link condition="_blank" |
443 | | - xlink:href="https://xml.apache.org/commons/components/resolver/">xml-commons |
444 | | - resolver</link> </para> |
| 487 | + <para> <link condition="_blank" |
| 488 | + xlink:href="https://github.com/xmlresolver/xmlresolver">xmlresolver</link> </para> |
445 | 489 | </listitem> |
446 | 490 | <listitem> |
447 | 491 | <para>OASIS <link condition="_blank" |
|
0 commit comments