Skip to content

Commit d220805

Browse files
authored
Merge pull request #1258 from duncdrum/dp-validation
fix(validate): update article
2 parents 67fb6d8 + 00cf43d commit d220805

3 files changed

Lines changed: 60 additions & 24 deletions

File tree

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
<catalog xmlns="urn:oasis:names:tc:entity:
2-
3-
4-
5-
xmlns:xml:catalog">
1+
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
62
<public publicId="-//PLAY//EN" uri="entities/play.dtd"/>
73
<system systemId="play.dtd" uri="entities/play.dtd"/>
84
<system systemId="mondial.dtd" uri="entities/mondial.dtd"/>
95
<uri name="http://exist-db.org/samples/shakespeare" uri="entities/play.xsd"/>
106
<uri name="http://www.w3.org/XML/1998/namespace" uri="entities/xml.xsd"/>
117
<uri name="http://www.w3.org/2001/XMLSchema" uri="entities/XMLSchema.xsd"/>
12-
<uri name="urn:oasis:names:tc:entity:
13-
14-
15-
16-
xmlns:xml:catalog" uri="entities/catalog.xsd"/>
8+
<uri name="urn:oasis:names:tc:entity:xmlns:xml:catalog" uri="entities/catalog.xsd"/>
179
</catalog>

src/main/xar-resources/data/validation/listings/listing-7.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<class>java.net.MalformedURLException</class>
77
<message>unknown protocol: foo</message>
88
<stacktrace>java.net.MalformedURLException: unknown protocol: foo at java.net.URL.<init>(URL.java:574) at java.net.URL.<init>(URL.java:464) at java.net.URL.<init>(URL.java:413) at
9-
org.exist.xquery.functions.validation.Shared.getStreamSource(Shared.java:140) at org.exist.xquery.functions.validation.Shared.getInputSource(Shared.java:190) at org.exist.xquery.functions.validation.Parse.eval(Parse.java:179) at
9+
org.exist.xquery.functions.validation.Shared.getStreamSource(Shared.java:124) at org.exist.xquery.functions.validation.Shared.getInputSource(Shared.java:213) at org.exist.xquery.functions.validation.Jaxp.eval(Jaxp.java:251) at
1010
org.exist.xquery.BasicFunction.eval(BasicFunction.java:68) at ......
1111
</stacktrace>
1212
</exception>

src/main/xar-resources/data/validation/validation.xml

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:xlink="http://www.w3.org/1999/xlink">
66
<info>
77
<title>XML Validation</title>
8-
<date>4Q25</date>
8+
<date>2Q26</date>
99
<keywordset>
1010
<keyword>application-development</keyword>
1111
<keyword>testing</keyword>
@@ -109,9 +109,9 @@
109109
<para>All grammars (XML schema, DTD) used for implicit validation must be registered
110110
with eXist using <link condition="_blank"
111111
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>
115115
<para>Catalogs can be stored on disk and/or in the database.</para>
116116
<para>It is possible to configure multiple catalog entries in <tag>entity-resolver</tag>
117117
child element(s) of <tag>validation</tag> in <code>conf.xml</code>. For instance: </para>
@@ -237,6 +237,23 @@
237237
</listitem>
238238
</varlistentry>
239239
</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>
240257
</sect2>
241258

242259
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
@@ -247,9 +264,10 @@
247264
<para>The JAXV validation functions are based on the <link condition="_blank"
248265
xlink:href="https://docs.oracle.com/javase/10/docs/api/javax/xml/validation/package-summary.html"
249266
> <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>
253271
<para>The <code>jaxv()</code> and <code>jaxv-report()</code> functions accept the
254272
following parameters: </para>
255273
<variablelist>
@@ -291,6 +309,33 @@
291309
</itemizedlist>
292310
</listitem>
293311
</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>
294339
</variablelist>
295340
</sect2>
296341

@@ -301,9 +346,9 @@
301346

302347
<para>The Jing validation functions are based on James Clark's <link condition="_blank"
303348
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"
307352
xlink:href="http://www.thaiopensource.com/relaxng/api/jing/com/thaiopensource/validate/ValidationDriver.html"
308353
><code>com.thaiopensource.validate.ValidationDriver</code></link> which supports a
309354
wide range of grammar types: </para>
@@ -439,9 +484,8 @@
439484

440485
<itemizedlist>
441486
<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>
445489
</listitem>
446490
<listitem>
447491
<para>OASIS <link condition="_blank"

0 commit comments

Comments
 (0)