KickJava   Java API By Example, From Geeks To Geeks.

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


1 package net.sf.saxon.type;
2
3 /**
4  * A complex type as defined in XML Schema: either a user-defined complex type, or xs:anyType.
5  * In the non-schema-aware version of the Saxon product, the only complex type encountered is xs:anyType.
6  */

7
8 public interface ComplexType extends SchemaType {
9
10     /**
11      * Test whether this complex type has been marked as abstract.
12      * @return true if this complex type is abstract.
13     **/

14
15     public boolean isAbstract();
16
17     /**
18      * Test whether this complex type has complex content
19      * @return true if this complex type has a complex content model, false if it has a simple content model
20      */

21
22     public boolean isComplexContent();
23
24     /**
25      * Test whether this complexType has simple content
26      * @return true if this complex type has a simple content model, false if it has a complex content model
27      */

28
29     public boolean isSimpleContent();
30
31     /**
32      * Test whether this complex type has "all" content, that is, a content model
33      * using an xs:all compositor
34      */

35
36     public boolean isAllContent();
37
38     /**
39      * Get the simple content type
40      * @return For a complex type with simple content, returns the simple type of the content.
41      * Otherwise, returns null.
42      */

43
44     public SimpleType getSimpleContentType();
45
46     /**
47      * Test whether this complex type is derived by restriction
48      * @return true if this complex type is derived by restriction
49      */

50
51     public boolean isRestricted();
52
53     /**
54      * Test whether the content model of this complex type is empty
55      * @return true if the content model is defined as empty
56      */

57
58     public boolean isEmptyContent();
59
60     /**
61      * Test whether the content model of this complex type allows empty content
62      * @return true if empty content is valid
63      */

64
65     public boolean isEmptiable() throws SchemaException, ValidationException;
66
67     /**
68      * Test whether this complex type allows mixed content
69      * @return true if mixed content is allowed
70      */

71
72     public boolean isMixedContent();
73
74     /**
75      * Test whether this complex type subsumes another complex type. The algorithm
76      * used is as published by Thompson and Tobin, XML Europe 2003.
77      * @param sub the other type (the type that is derived by restriction, validly or otherwise)
78      * @return null indicating that this type does indeed subsume the other; or a string indicating
79      * why it doesn't.
80      */

81
82     public String JavaDoc subsumes(ComplexType sub) throws ValidationException;
83
84     /**
85      * Find an element particle within this complex type definition having a given element name
86      * (identified by fingerprint), and return the schema type associated with that element particle.
87      * If there is no such particle, return null. If the fingerprint matches an element wildcard,
88      * return the type of the global element declaration with the given name if one exists, or AnyType
89      * if none exists and lax validation is permitted by the wildcard.
90      * @param fingerprint Identifies the name of the child element within this content model
91      */

92
93     public SchemaType getElementParticleType(int fingerprint) throws SchemaException, ValidationException;
94
95     /**
96      * Find an element particle within this complex type definition having a given element name
97      * (identified by fingerprint), and return the cardinality associated with that element particle,
98      * that is, the number of times the element can occur within this complex type. The value is one of
99      * {@link net.sf.saxon.expr.StaticProperty#EXACTLY_ONE}, {@link net.sf.saxon.expr.StaticProperty#ALLOWS_ZERO_OR_ONE},
100      * {@link net.sf.saxon.expr.StaticProperty#ALLOWS_ZERO_OR_MORE}, {@link net.sf.saxon.expr.StaticProperty#ALLOWS_ONE_OR_MORE},
101      * If there is no such particle, return zero.
102      * @param fingerprint Identifies the name of the child element within this content model
103      */

104
105     public int getElementParticleCardinality(int fingerprint) throws SchemaException, ValidationException;
106
107     /**
108      * Find an attribute use within this complex type definition having a given attribute name
109      * (identified by fingerprint), and return the schema type associated with that attribute.
110      * If there is no such attribute use, return null. If the fingerprint matches an attribute wildcard,
111      * return the type of the global attribute declaration with the given name if one exists, or AnySimpleType
112      * if none exists and lax validation is permitted by the wildcard.
113      * @param fingerprint Identifies the name of the child element within this content model
114      */

115
116     public SchemaType getAttributeUseType(int fingerprint) throws SchemaException, ValidationException;
117
118 }
119
120
121 //
122
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
123
// you may not use this file except in compliance with the License. You may obtain a copy of the
124
// License at http://www.mozilla.org/MPL/
125
//
126
// Software distributed under the License is distributed on an "AS IS" basis,
127
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
128
// See the License for the specific language governing rights and limitations under the License.
129
//
130
// The Original Code is: all this file.
131
//
132
// The Initial Developer of the Original Code is Saxonica Limited
133
//
134
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
135
//
136
// Contributor(s): none
137
//
Popular Tags