1
<html xmlns="http://www.w3.org/1999/xhtml">
3
<title>RELAX NG Pluggable Datatype Library Example</title>
7
<h1>RELAX NG Pluggable Datatype Library Example</h1>
9
<p>This package contains a very simple example of a <a
10
href="../doc/pluggable-datatypes.html">pluggable datatype library</a>.
11
The datatype library is implemented by the class
12
<code>com.thaiopensource.datatype.sample.BalancedString</code>. The
13
bulk of the implementation is inherited from the abstract class
14
<code>com.thaiopensource.datatype.sample.SimpleDatatypeLibrary</code>,
15
which provides default implementations for the methods in the
16
interfaces which a datatype library must implement. A class that
17
derives from <code>SimpleDatatypeLibrary</code> has only to implement
18
a <code>boolean isValid(String literal)</code> method. The datatype
20
<code>http://www.thaiopensource.com/relaxng/datatypes/sample</code>,
21
and contains exactly one datatype, which is called
22
<code>balancedString</code>. This datatype allows any string in which
23
parentheses are properly balanced (nested). To use this sample
24
datatype library, simply include <code>datatype-sample.jar</code> in
25
your CLASSPATH. You will then be able to validate against schemas
26
using this additional datatype. The file <a
27
href="datatype-sample.rng">datatype-sample.rng</a> is a simple RELAX
28
NG schema using this datatype; <a href="valid.xml">valid.xml</a> is an
29
instance that is valid with respect to this schema; <a
30
href="invalid.xml">invalid.xml</a> is an instance that is not valid
31
with respect to this schema.</p>
34
<a href="mailto:jjc@jclark.com">James Clark</a>