1 /** |
|
2 * Copyright (c) 2001, Thai Open Source Software Center Ltd |
|
3 * All rights reserved. |
|
4 * |
|
5 * Redistribution and use in source and binary forms, with or without |
|
6 * modification, are permitted provided that the following conditions are |
|
7 * met: |
|
8 * |
|
9 * Redistributions of source code must retain the above copyright |
|
10 * notice, this list of conditions and the following disclaimer. |
|
11 * |
|
12 * Redistributions in binary form must reproduce the above copyright |
|
13 * notice, this list of conditions and the following disclaimer in |
|
14 * the documentation and/or other materials provided with the |
|
15 * distribution. |
|
16 * |
|
17 * Neither the name of the Thai Open Source Software Center Ltd nor |
|
18 * the names of its contributors may be used to endorse or promote |
|
19 * products derived from this software without specific prior written |
|
20 * permission. |
|
21 * |
|
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR |
|
26 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
|
27 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
|
28 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
|
29 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
|
30 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|
31 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
33 */ |
|
34 package org.relaxng.datatype; |
|
35 |
|
36 /** |
|
37 * Datatype streaming validator. |
|
38 * |
|
39 * <p> |
|
40 * The streaming validator is an optional feature that is useful for |
|
41 * certain Datatypes. It allows the caller to incrementally provide |
|
42 * the literal. |
|
43 * |
|
44 * @author <a href="mailto:jjc@jclark.com">James Clark</a> |
|
45 * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a> |
|
46 */ |
|
47 public interface DatatypeStreamingValidator { |
|
48 |
|
49 /** |
|
50 * Passes an additional fragment of the literal. |
|
51 * |
|
52 * <p> |
|
53 * The application can call this method several times, then call |
|
54 * the isValid method (or the checkValid method) to check the validity |
|
55 * of the accumulated characters. |
|
56 */ |
|
57 void addCharacters( char[] buf, int start, int len ); |
|
58 |
|
59 /** |
|
60 * Tells if the accumulated literal is valid with respect to |
|
61 * the underlying Datatype. |
|
62 * |
|
63 * @return |
|
64 * True if it is valid. False if otherwise. |
|
65 */ |
|
66 boolean isValid(); |
|
67 |
|
68 /** |
|
69 * Similar to the isValid method, but this method throws |
|
70 * Exception (with possibly diagnostic information), instead of |
|
71 * returning false. |
|
72 * |
|
73 * @exception DatatypeException |
|
74 * If the callee supports the diagnosis and the accumulated |
|
75 * literal is invalid, then this exception that possibly |
|
76 * contains diagnosis information is thrown. |
|
77 */ |
|
78 void checkValid() throws DatatypeException; |
|
79 } |
|