| 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2 | // Copyright (c) 2018 Saxonica Limited. |
| 3 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. |
| 4 | // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. |
| 6 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 7 | |
| 8 | package net.sf.saxon.type; |
| 9 | |
| 10 | import net.sf.saxon.om.StructuredQName; |
| 11 | import net.sf.saxon.pattern.NodeTest; |
| 12 | |
| 13 | /** |
| 14 | * This is a marker interface that acts as a surrogate for an object representing |
| 15 | * a global element or attribute declaration. |
| 16 | * The real implementation of these declarations is available in the schema-aware |
| 17 | * version of the Saxon product. |
| 18 | */ |
| 19 | public interface SchemaDeclaration { |
| 20 | |
| 21 | /** |
| 22 | * Get the name of the schema component |
| 23 | * |
| 24 | * @return the fingerprint of the component name |
| 25 | */ |
| 26 | |
| 27 | int getFingerprint(); |
| 28 | |
| 29 | /** |
| 30 | * Get the name of the schema component |
| 31 | * |
| 32 | * @return the component name as a structured QName |
| 33 | */ |
| 34 | |
| 35 | StructuredQName getComponentName(); |
| 36 | |
| 37 | /** |
| 38 | * Get the simple or complex type associated with the element or attribute declaration |
| 39 | * |
| 40 | * @return the simple or complex type |
| 41 | */ |
| 42 | |
| 43 | SchemaType getType() throws MissingComponentException; |
| 44 | |
| 45 | /** |
| 46 | * Create a NodeTest that implements the semantics of schema-element(name) or |
| 47 | * schema-attribute(name) applied to this element or attribute declaration. |
| 48 | * @throws MissingComponentException if the type of the declaration is not present in the schema. |
| 49 | */ |
| 50 | |
| 51 | NodeTest makeSchemaNodeTest() throws MissingComponentException; |
| 52 | |
| 53 | /** |
| 54 | * Determine, in the case of an Element Declaration, whether it is nillable. |
| 55 | */ |
| 56 | |
| 57 | boolean isNillable(); |
| 58 | |
| 59 | /** |
| 60 | * Determine, in the case of an Element Declaration, whether the declaration is abstract |
| 61 | */ |
| 62 | |
| 63 | boolean isAbstract(); |
| 64 | |
| 65 | /** |
| 66 | * Determine, in the case of an Element Declaration, whether there are type alternatives defined |
| 67 | * |
| 68 | * @return true if the element uses conditional type assignment |
| 69 | */ |
| 70 | |
| 71 | boolean hasTypeAlternatives(); |
| 72 | |
| 73 | |
| 74 | } |
| 75 |