KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > saxon > type > SimpleType


1 package net.sf.saxon.type;
2
3 import net.sf.saxon.om.NamespaceResolver;
4 import net.sf.saxon.om.SequenceIterator;
5 import net.sf.saxon.ConversionContext;
6
7 /**
8  * This interface represents a simple type, which may be a built-in simple type, or
9  * a user-defined simple type.
10  */

11
12 public interface SimpleType extends SchemaType {
13
14     /**
15      * Test whether this Simple Type is an atomic type
16      * @return true if this is an atomic type
17      */

18
19     boolean isAtomicType();
20
21     /**
22      * Test whether this Simple Type is a list type
23      * @return true if this is a list type
24      */

25     boolean isListType();
26
27    /**
28      * Test whether this Simple Type is a union type
29      * @return true if this is a union type
30      */

31
32     boolean isUnionType();
33
34     /**
35      * Get the most specific possible atomic type that all items in this SimpleType belong to
36      * @return the lowest common supertype of all member types
37      */

38
39     AtomicType getCommonAtomicType();
40
41     SchemaType getBuiltInBaseType() throws ValidationException;
42
43     /**
44      * Get the typed value corresponding to a given string value, assuming it is
45      * valid against this type
46      * @param value the string value
47      * @param resolver a namespace resolver used to resolve any namespace prefixes appearing
48      * in the content of values. Can supply null, in which case any namespace-sensitive content
49      * will be rejected.
50      * @param conversion
51      * @return an iterator over the atomic sequence comprising the typed value. The objects
52      * returned by this SequenceIterator will all be of type {@link net.sf.saxon.value.AtomicValue}
53      */

54
55     public SequenceIterator getTypedValue(CharSequence JavaDoc value, NamespaceResolver resolver, ConversionContext conversion)
56             throws ValidationException;
57
58     /**
59      * Check whether a given input string is valid according to this SimpleType
60      * @param value the input string to be checked
61      * @param nsResolver a namespace resolver used to resolve namespace prefixes if the type
62      * is namespace sensitive. The value supplied may be null; in this case any namespace-sensitive
63      * content will throw an UnsupportedOperationException.
64      * @param conversion
65      * @return null if validation succeeds; return a ValidationException describing the validation failure
66      * if validation fails. Note that the exception is returned rather than being thrown.
67      * @throws UnsupportedOperationException if the type is namespace-sensitive and no namespace
68      * resolver is supplied
69      */

70
71     ValidationException validateContent(CharSequence JavaDoc value, NamespaceResolver nsResolver, ConversionContext conversion);
72
73     /**
74      * Test whether this type is namespace sensitive, that is, if a namespace context is needed
75      * to translate between the lexical space and the value space. This is true for types derived
76      * from, or containing, QNames and NOTATIONs
77      * @return true if the type is namespace-sensitive
78      */

79
80     boolean isNamespaceSensitive();
81
82     /**
83      * Determine how values of this simple type are whitespace-normalized.
84      * @return one of {@link net.sf.saxon.value.Whitespace#PRESERVE}, {@link net.sf.saxon.value.Whitespace#COLLAPSE},
85      * {@link net.sf.saxon.value.Whitespace#REPLACE}.
86      */

87
88     public int getWhitespaceAction();
89 }
90
91 //
92
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
93
// you may not use this file except in compliance with the License. You may obtain a copy of the
94
// License at http://www.mozilla.org/MPL/
95
//
96
// Software distributed under the License is distributed on an "AS IS" basis,
97
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
98
// See the License for the specific language governing rights and limitations under the License.
99
//
100
// The Original Code is: all this file.
101
//
102
// The Initial Developer of the Original Code is Michael H. Kay
103
//
104
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
105
//
106
// Contributor(s): none.
107
//
108

109
Popular Tags