Source Code Cross Referenced for AnySimpleType.java in  » XML » saxonb » net » sf » saxon » type » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » XML » saxonb » net.sf.saxon.type 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.sf.saxon.type;
002:
003:        import net.sf.saxon.expr.Expression;
004:        import net.sf.saxon.expr.StaticContext;
005:        import net.sf.saxon.om.*;
006:        import net.sf.saxon.style.StandardNames;
007:        import net.sf.saxon.value.UntypedAtomicValue;
008:        import net.sf.saxon.value.Value;
009:        import net.sf.saxon.value.Whitespace;
010:
011:        /**
012:         * This class has a singleton instance which represents the XML Schema built-in type xs:anySimpleType
013:         */
014:
015:        public final class AnySimpleType implements  SimpleType {
016:
017:            private static AnySimpleType theInstance = new AnySimpleType();
018:
019:            /**
020:             * Private constructor
021:             */
022:            private AnySimpleType() {
023:            }
024:
025:            /**
026:             * Get the most specific possible atomic type that all items in this SimpleType belong to
027:             * @return the lowest common supertype of all member types
028:             */
029:
030:            public AtomicType getCommonAtomicType() {
031:                return Type.ANY_ATOMIC_TYPE;
032:            }
033:
034:            /**
035:             * Get the singular instance of this class
036:             * @return the singular object representing xs:anyType
037:             */
038:
039:            public static AnySimpleType getInstance() {
040:                return theInstance;
041:            }
042:
043:            /**
044:             * Get the validation status - always valid
045:             */
046:            public int getValidationStatus() {
047:                return VALIDATED;
048:            }
049:
050:            /**
051:             * Get the base type
052:             * @return AnyType
053:             */
054:
055:            public SchemaType getBaseType() {
056:                return AnyType.getInstance();
057:            }
058:
059:            /**
060:             * Returns the base type that this type inherits from. This method can be used to get the
061:             * base type of a type that is known to be valid.
062:             * @return the base type.
063:             */
064:
065:            public SchemaType getKnownBaseType() throws IllegalStateException {
066:                return getBaseType();
067:            }
068:
069:            /**
070:             * Test whether this SchemaType is a complex type
071:             *
072:             * @return true if this SchemaType is a complex type
073:             */
074:
075:            public boolean isComplexType() {
076:                return false;
077:            }
078:
079:            /**
080:             * Test whether this SchemaType is a simple type
081:             * @return true if this SchemaType is a simple type
082:             */
083:
084:            public boolean isSimpleType() {
085:                return true;
086:            }
087:
088:            /**
089:             * Get the fingerprint of the name of this type
090:             * @return the fingerprint.
091:             */
092:
093:            public int getFingerprint() {
094:                return StandardNames.XS_ANY_SIMPLE_TYPE;
095:            }
096:
097:            /**
098:             * Get the namecode of the name of this type. This includes the prefix from the original
099:             * type declaration: in the case of built-in types, there may be a conventional prefix
100:             * or there may be no prefix.
101:             */
102:
103:            public int getNameCode() {
104:                return StandardNames.XS_ANY_SIMPLE_TYPE;
105:            }
106:
107:            /**
108:             * Get a description of this type for use in diagnostics
109:             * @return the string "xs:anyType"
110:             */
111:
112:            public String getDescription() {
113:                return "xs:anySimpleType";
114:            }
115:
116:            /**
117:             * Get the display name of the type: that is, a lexical QName with an arbitrary prefix
118:             *
119:             * @return a lexical QName identifying the type
120:             */
121:
122:            public String getDisplayName() {
123:                return "xs:anySimpleType";
124:            }
125:
126:            /**
127:             * Test whether this is the same type as another type. They are considered to be the same type
128:             * if they are derived from the same type definition in the original XML representation (which
129:             * can happen when there are multiple includes of the same file)
130:             */
131:
132:            public boolean isSameType(SchemaType other) {
133:                return (other instanceof  AnySimpleType);
134:            }
135:
136:            /**
137:             * Get the typed value of a node that is annotated with this schema type. This shouldn't happen: nodes
138:             * are never annotated as xs:anySimpleType; but if it does happen, we treat it as if it were
139:             * untypedAtomic.
140:             * @param node the node whose typed value is required
141:             * @return an iterator returning a single untyped atomic value, equivalent to the string value of the node.
142:             */
143:
144:            public SequenceIterator getTypedValue(NodeInfo node) {
145:                return SingletonIterator.makeIterator(new UntypedAtomicValue(
146:                        node.getStringValueCS()));
147:            }
148:
149:            /**
150:             * Get the typed value of a node that is annotated with this schema type. The result of this method will always be consistent with the method
151:             * {@link #getTypedValue}. However, this method is often more convenient and may be
152:             * more efficient, especially in the common case where the value is expected to be a singleton.
153:             *
154:             * @param node the node whose typed value is required
155:             * @return the typed value.
156:             * @since 8.5
157:             */
158:
159:            public Value atomize(NodeInfo node) {
160:                return new UntypedAtomicValue(node.getStringValueCS());
161:            }
162:
163:            /**
164:             * Check that this type is validly derived from a given type
165:             *
166:             * @param type  the type from which this type is derived
167:             * @param block the derivations that are blocked by the relevant element declaration
168:             * @throws SchemaException
169:             *          if the derivation is not allowed
170:             */
171:
172:            public void isTypeDerivationOK(SchemaType type, int block)
173:                    throws SchemaException {
174:                throw new SchemaException(
175:                        "Cannot derive xs:anySimpleType from another type");
176:            }
177:
178:            /**
179:             * Test whether this Simple Type is an atomic type
180:             * @return false, this is not (necessarily) an atomic type
181:             */
182:
183:            public boolean isAtomicType() {
184:                return false;
185:            }
186:
187:            /**
188:             * Determine whether this is a list type
189:             * @return false (it isn't a list type)
190:             */
191:            public boolean isListType() {
192:                return false;
193:            }
194:
195:            /**
196:             * Determin whether this is a union type
197:             * @return false (it isn't a union type)
198:             */
199:            public boolean isUnionType() {
200:                return false;
201:            }
202:
203:            /**
204:             * Get the built-in ancestor of this type in the type hierarchy
205:             * @return this type itself
206:             */
207:            public SchemaType getBuiltInBaseType() {
208:                return this ;
209:            }
210:
211:            /**
212:             * Get the typed value corresponding to a given string value, assuming it is
213:             * valid against this type
214:             *
215:             * @param value    the string value
216:             * @param resolver a namespace resolver used to resolve any namespace prefixes appearing
217:             *                 in the content of values. Can supply null, in which case any namespace-sensitive content
218:             *                 will be rejected.
219:             * @param nameChecker
220:             * @return an iterator over the atomic sequence comprising the typed value. The objects
221:             *         returned by this SequenceIterator will all be of type {@link net.sf.saxon.value.AtomicValue}
222:             */
223:
224:            public SequenceIterator getTypedValue(CharSequence value,
225:                    NamespaceResolver resolver, NameChecker nameChecker) {
226:                return SingletonIterator.makeIterator(new UntypedAtomicValue(
227:                        value));
228:            }
229:
230:            /**
231:             * Check whether a given input string is valid according to this SimpleType
232:             * @param value the input string to be checked
233:             * @param nsResolver a namespace resolver used to resolve namespace prefixes if the type
234:             * is namespace sensitive. The value supplied may be null; in this case any namespace-sensitive
235:             * content will throw an UnsupportedOperationException.
236:             * @param nameChecker
237:             * @return null if validation succeeds (which it always does for this implementation)
238:             * @throws UnsupportedOperationException if the type is namespace-sensitive and no namespace
239:             * resolver is supplied
240:             */
241:            public ValidationException validateContent(CharSequence value,
242:                    NamespaceResolver nsResolver, NameChecker nameChecker) {
243:                return null;
244:            }
245:
246:            /**
247:             * Test whether this type represents namespace-sensitive content
248:             * @return false
249:             */
250:            public boolean isNamespaceSensitive() {
251:                return false;
252:            }
253:
254:            /**
255:             * Returns the value of the 'block' attribute for this type, as a bit-signnificant
256:             * integer with fields such as {@link SchemaType#DERIVATION_LIST} and {@link SchemaType#DERIVATION_EXTENSION}
257:             *
258:             * @return the value of the 'block' attribute for this type
259:             */
260:
261:            public int getBlock() {
262:                return 0;
263:            }
264:
265:            /**
266:             * Gets the integer code of the derivation method used to derive this type from its
267:             * parent. Returns zero for primitive types.
268:             *
269:             * @return a numeric code representing the derivation method, for example {@link SchemaType#DERIVATION_RESTRICTION}
270:             */
271:
272:            public int getDerivationMethod() {
273:                return SchemaType.DERIVATION_RESTRICTION;
274:            }
275:
276:            /**
277:             * Determines whether derivation (of a particular kind)
278:             * from this type is allowed, based on the "final" property
279:             *
280:             * @param derivation the kind of derivation, for example {@link SchemaType#DERIVATION_LIST}
281:             * @return true if this kind of derivation is allowed
282:             */
283:
284:            public boolean allowsDerivation(int derivation) {
285:                return true;
286:            }
287:
288:            /**
289:             * Determine how values of this simple type are whitespace-normalized.
290:             *
291:             * @return one of {@link net.sf.saxon.value.Whitespace#PRESERVE}, {@link net.sf.saxon.value.Whitespace#COLLAPSE},
292:             *         {@link net.sf.saxon.value.Whitespace#REPLACE}.
293:             * @param th
294:             */
295:
296:            public int getWhitespaceAction(TypeHierarchy th) {
297:                return Whitespace.COLLAPSE;
298:            }
299:
300:            /**
301:             * Analyze an expression to see whether the expression is capable of delivering a value of this
302:             * type.
303:             *
304:             * @param expression the expression that delivers the content
305:             * @param kind       the node kind whose content is being delivered: {@link net.sf.saxon.type.Type#ELEMENT},
306:             *                   {@link net.sf.saxon.type.Type#ATTRIBUTE}, or {@link net.sf.saxon.type.Type#DOCUMENT}
307:             * @param env
308:             */
309:
310:            public void analyzeContentExpression(Expression expression,
311:                    int kind, StaticContext env) {
312:                return;
313:            }
314:        }
315:
316:        //
317:        // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
318:        // you may not use this file except in compliance with the License. You may obtain a copy of the
319:        // License at http://www.mozilla.org/MPL/
320:        //
321:        // Software distributed under the License is distributed on an "AS IS" basis,
322:        // WITHOUT WARRANTY OF ANY KIND, either express or implied.
323:        // See the License for the specific language governing rights and limitations under the License.
324:        //
325:        // The Original Code is: all this file.
326:        //
327:        // The Initial Developer of the Original Code is Saxonica Limited
328:        //
329:        // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
330:        //
331:        // Contributor(s): none
332:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.