Source Code Cross Referenced for SchemaType.java in  » XML » XPath-Saxon » 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 » XPath Saxon » 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.NodeInfo;
006:        import net.sf.saxon.om.SequenceIterator;
007:        import net.sf.saxon.trans.XPathException;
008:        import net.sf.saxon.value.Value;
009:
010:        /**
011:         * SchemaType is an interface implemented by all schema types: simple and complex types, built-in and
012:         * user-defined types.
013:         *
014:         * <p>There is a hierarchy of interfaces that extend SchemaType, representing the top levels of the schema
015:         * type system: SimpleType and ComplexType, with SimpleType further subdivided into List, Union, and Atomic
016:         * types.</p>
017:         *
018:         * <p>The implementations of these interfaces are organized into a different hierarchy: on the one side,
019:         * built-in types such as AnyType, AnySimpleType, and the built-in atomic types and list types; on the other
020:         * side, user-defined types defined in a schema.</p>
021:         */
022:
023:        public interface SchemaType extends SchemaComponent {
024:
025:            // DerivationMethods. These constants are copied from org.w3.dom.TypeInfo. They are redefined here to avoid
026:            // creating a dependency on the TypeInfo class, which is only available when JAXP 1.3 is available.
027:
028:            /**
029:             *  If the document's schema is an XML Schema [<a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>]
030:             * , this constant represents the derivation by <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#key-typeRestriction'>
031:             * restriction</a> if complex types are involved, or a <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-restriction'>
032:             * restriction</a> if simple types are involved.
033:             * <br>  The reference type definition is derived by restriction from the
034:             * other type definition if the other type definition is the same as the
035:             * reference type definition, or if the other type definition can be
036:             * reached recursively following the {base type definition} property
037:             * from the reference type definition, and all the <em>derivation methods</em> involved are restriction.
038:             */
039:            public static final int DERIVATION_RESTRICTION = 0x00000001;
040:            /**
041:             *  If the document's schema is an XML Schema [<a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>]
042:             * , this constant represents the derivation by <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#key-typeExtension'>
043:             * extension</a>.
044:             * <br>  The reference type definition is derived by extension from the
045:             * other type definition if the other type definition can be reached
046:             * recursively following the {base type definition} property from the
047:             * reference type definition, and at least one of the <em>derivation methods</em> involved is an extension.
048:             */
049:            public static final int DERIVATION_EXTENSION = 0x00000002;
050:            /**
051:             *  If the document's schema is an XML Schema [<a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>]
052:             * , this constant represents the <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-union'>
053:             * union</a> if simple types are involved.
054:             * <br> The reference type definition is derived by union from the other
055:             * type definition if there exists two type definitions T1 and T2 such
056:             * as the reference type definition is derived from T1 by
057:             * <code>DERIVATION_RESTRICTION</code> or
058:             * <code>DERIVATION_EXTENSION</code>, T2 is derived from the other type
059:             * definition by <code>DERIVATION_RESTRICTION</code>, T1 has {variety} <em>union</em>, and one of the {member type definitions} is T2. Note that T1 could be
060:             * the same as the reference type definition, and T2 could be the same
061:             * as the other type definition.
062:             */
063:            public static final int DERIVATION_UNION = 0x00000004;
064:            /**
065:             *  If the document's schema is an XML Schema [<a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>]
066:             * , this constant represents the <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-list'>list</a>.
067:             * <br> The reference type definition is derived by list from the other
068:             * type definition if there exists two type definitions T1 and T2 such
069:             * as the reference type definition is derived from T1 by
070:             * <code>DERIVATION_RESTRICTION</code> or
071:             * <code>DERIVATION_EXTENSION</code>, T2 is derived from the other type
072:             * definition by <code>DERIVATION_RESTRICTION</code>, T1 has {variety} <em>list</em>, and T2 is the {item type definition}. Note that T1 could be the same as
073:             * the reference type definition, and T2 could be the same as the other
074:             * type definition.
075:             */
076:            public static final int DERIVATION_LIST = 0x00000008;
077:
078:            /**
079:             * Derivation by substitution.
080:             * This constant, unlike the others, is NOT defined in the DOM level 3 TypeInfo interface.
081:             */
082:
083:            public static final int DERIVE_BY_SUBSTITUTION = 16;
084:
085:            /**
086:             * Get the namecode of the name of this type. This includes the prefix from the original
087:             * type declaration: in the case of built-in types, there may be a conventional prefix
088:             * or there may be no prefix.
089:             */
090:
091:            int getNameCode();
092:
093:            /**
094:             * Get the fingerprint of the name of this type
095:             * @return the fingerprint. Returns an invented fingerprint for an anonymous type.
096:             */
097:
098:            int getFingerprint();
099:
100:            /**
101:             * Get the display name of the type: that is, a lexical QName with an arbitrary prefix
102:             * @return a lexical QName identifying the type
103:             */
104:
105:            String getDisplayName();
106:
107:            /**
108:             * Test whether this SchemaType is a complex type
109:             * @return true if this SchemaType is a complex type
110:             */
111:
112:            boolean isComplexType();
113:
114:            /**
115:             * Test whether this SchemaType is a simple type
116:             * @return true if this SchemaType is a simple type
117:             */
118:
119:            boolean isSimpleType();
120:
121:            /**
122:             * Returns the value of the 'block' attribute for this type, as a bit-signnificant
123:             * integer with fields such as {@link SchemaType#DERIVATION_LIST} and {@link SchemaType#DERIVATION_EXTENSION}
124:             * @return the value of the 'block' attribute for this type
125:             */
126:
127:            int getBlock();
128:
129:            /**
130:             * Returns the base type that this type inherits from. This method can be used to get the
131:             * base type of a type that is known to be valid.
132:             * If this type is a Simpletype that is a built in primitive type then null is returned.
133:             * @return the base type.
134:             * @throws IllegalStateException if this type is not valid.
135:             */
136:
137:            SchemaType getBaseType() throws UnresolvedReferenceException;
138:
139:            /**
140:             * Gets the integer code of the derivation method used to derive this type from its
141:             * parent. Returns zero for primitive types.
142:             * @return a numeric code representing the derivation method, for example {@link SchemaType#DERIVATION_RESTRICTION}
143:             */
144:
145:            int getDerivationMethod();
146:
147:            /**
148:             * Determines whether derivation (of a particular kind)
149:             * from this type is allowed, based on the "final" property
150:             * @param derivation the kind of derivation, for example {@link SchemaType#DERIVATION_LIST}
151:             * @return true if this kind of derivation is allowed
152:             */
153:
154:            boolean allowsDerivation(int derivation);
155:
156:            /**
157:             * Analyze an expression to see whether the expression is capable of delivering a value of this
158:             * type.
159:             * @param expression the expression that delivers the content
160:             * @param kind the node kind whose content is being delivered: {@link Type#ELEMENT},
161:             * {@link Type#ATTRIBUTE}, or {@link Type#DOCUMENT}
162:             * @param env The static evaluation context for the query or stylesheet
163:             * @throws XPathException if the expression will never deliver a value of the correct type
164:             */
165:
166:            void analyzeContentExpression(Expression expression, int kind,
167:                    StaticContext env) throws XPathException;
168:
169:            /**
170:             * Get the typed value of a node that is annotated with this schema type. The results of this method
171:             * are consistent with the {@link #atomize} method, but this version returns a SequenceIterator which may
172:             * be more efficient when handling long lists.
173:             * @param node the node whose typed value is required
174:             * @return a SequenceIterator over the atomic values making up the typed value of the specified
175:             * node. The objects returned by this iterator are of type {@link net.sf.saxon.value.AtomicValue}
176:             */
177:
178:            SequenceIterator getTypedValue(NodeInfo node) throws XPathException;
179:
180:            /**
181:             * 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
182:             * {@link #getTypedValue}. However, this method is often more convenient and may be
183:             * more efficient, especially in the common case where the value is expected to be a singleton.
184:             * @param node the node whose typed value is required
185:             * @return the typed value. 
186:             * @since 8.5
187:             */
188:
189:            Value atomize(NodeInfo node) throws XPathException;
190:
191:            /**
192:             * Test whether this is the same type as another type. They are considered to be the same type
193:             * if they are derived from the same type definition in the original XML representation (which
194:             * can happen when there are multiple includes of the same file)
195:             */
196:
197:            boolean isSameType(SchemaType other);
198:
199:            /**
200:             * Get a description of this type for use in error messages. This is the same as the display name
201:             * in the case of named types; for anonymous types it identifies the type by its position in a source
202:             * schema document.
203:             * @return text identifing the type, for use in a phrase such as "the type XXXX".
204:             */
205:
206:            String getDescription();
207:
208:            /**
209:             * Check that this type is validly derived from a given type, following the rules for the Schema Component
210:             * Constraint "Is Type Derivation OK (Simple)" (3.14.6) or "Is Type Derivation OK (Complex)" (3.4.6) as
211:             * appropriate.
212:             * @param base the base type; the algorithm tests whether derivation from this type is permitted
213:             * @param block the derivations that are blocked by the relevant element declaration
214:             * @throws SchemaException if the derivation is not allowed
215:             */
216:
217:            public void isTypeDerivationOK(SchemaType base, int block)
218:                    throws SchemaException, ValidationException;
219:
220:        }
221:
222:        //
223:        // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
224:        // you may not use this file except in compliance with the License. You may obtain a copy of the
225:        // License at http://www.mozilla.org/MPL/
226:        //
227:        // Software distributed under the License is distributed on an "AS IS" basis,
228:        // WITHOUT WARRANTY OF ANY KIND, either express or implied.
229:        // See the License for the specific language governing rights and limitations under the License.
230:        //
231:        // The Original Code is: all this file.
232:        //
233:        // The Initial Developer of the Original Code is Michael H. Kay
234:        //
235:        // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
236:        //
237:        // Contributor(s): none.
238:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.