|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.saxonica.schema.SchemaStructure com.saxonica.schema.ElementDecl
public class ElementDecl
The object represents an element declaration in the schema. It may be a global element declaration, or a local element declaration.
Field Summary |
---|
Fields inherited from interface net.sf.saxon.type.SchemaComponent |
---|
FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING |
Constructor Summary | |
---|---|
ElementDecl(EnterpriseConfiguration config,
boolean global,
SourceLocator locator)
Creates a new element declaration |
Method Summary | |
---|---|
void |
addIdentityConstraint(IdentityConstraintReference constraint)
Adds the given IdentityConstraint to this element definition. |
void |
addSubstitutionGroupHead(int nameCode)
Adds the fingerprint of the name of the head of a substitutionGroup for this element definition. |
void |
addSubstitutionGroupMember(ElementDecl member,
SchemaCompiler compiler)
Add a member of the substitution group that has this element as its head. |
void |
addTypeAlternative(TypeAlternative alternative)
Add a type alternative to the type alternative table. |
boolean |
allowsDerivation(int derivation)
Determines whether derivation (of a particular kind) from this type is allowed, based on the "final" property (that is, the {substitution group exclusions} in the component model |
boolean |
fixup(SchemaCompiler compiler)
Check references from this component to other components |
protected void |
fixupSubstitutionGroup(SchemaCompiler compiler)
Fix up the reference(s) to the head(s) of the substitition group(s) |
void |
gatherSubstititionGroupOwnersTransitively(Set<ElementDecl> headSet)
Get the heads of all substitution groups, expanded transitively (including this element declaration itself) |
int |
getBlock()
Returns the value of the 'block' attribute for this element. |
UserComplexType |
getContainingComplexType()
Get the containing complex type. |
String |
getDefaultValue()
Returns the default value defined for this element definition. |
String |
getDisplayName()
Returns the name of this Element declaration in a form suitable for error messages. |
int |
getFingerprint()
Get the fingerprint of the name of this element declaration in the namePool |
Value |
getFixedValue()
Returns the 'fixed' value defined for this element declaration. |
Comparable |
getFixedValueComparable()
Return the Comparable that can be used to compare the "fixed" value against other values using XML Schema comparison semantics. |
String |
getFixedValueLexicalRepresentation()
Return the canonical lexical representation of the "fixed" value defined for this element declaration |
Iterator<IdentityConstraintReference> |
getIdentityConstraints()
Returns an Iterator over the identity constraints defined within this element definition. |
String |
getName()
Returns the local name of this Element declaration. |
int |
getNameCode()
Get the nameCode of the name of this element declaration in the namePool |
String |
getNamespaceURI()
Deprecated. since 9.0: use the renamed method getTargetNamespace() |
int |
getSubstitutionGroupExclusions()
Get the substitution group exclusions of this element, that is, the value of the applcable final or finalDefault attributes. |
Set<ElementDecl> |
getSubstitutionGroupMembers()
Get the known members of the substitution group of this element, as a Set containing the ElementDecl objects. |
Set<ElementDecl> |
getSubstitutionGroupOwners()
Returns the head(s) of the substitutionGroup for this element declaration, or null if there are none. |
String |
getTargetNamespace()
Get the namespace URI of this element declaration. |
SchemaType |
getType()
Returns the Schema Type (ComplexType or SimpleType) of this Element Declaration. |
int |
getTypeFingerprint()
Get the namepool fingerprint of the name of the element's type. |
boolean |
hasSameTypeTable(ElementDecl other)
Test whether this element declaration has "the same" type table as another element declaration |
boolean |
hasTypeAlternatives()
Ask whether any type alternatives are defined for this element |
boolean |
isAbstract()
Returns true if this element definition is abstract. |
boolean |
isGlobal()
Determine whether this element declaration is global. |
boolean |
isNillable()
Determine whether or not instances of this element definition permit xsi:nil to be set to "yes". |
boolean |
isSameDeclaration(ElementDecl other)
Test whether this is the same declaration as another declaration. |
Iterator<ElementDecl> |
iterateSubstitutionGroup()
Iterate over all the elements contained in the substitution group of which this element is the head. |
Iterator<TypeAlternative> |
iterateTypeAlternatives()
Iterate over the type alternatives defined for this element. |
void |
lookForCycles(Stack references,
SchemaCompiler compiler)
This method is called to look for cycles. |
NodeTest |
makeSchemaNodeTest()
Create a NodeTest that implements the semantics of schema-element(name) or schema-attribute(name) applied to this element or attribute declaration. |
void |
registerComplexTypeUsingThisElement(UserComplexType type)
Register a complex type that contains this element as a particle. |
void |
serialize(SchemaModelSerializer serializer)
Serialize the schema component |
void |
setAbstract(boolean isAbstract)
Sets whether or not this element definition is abstract. |
void |
setBlock(int block)
Sets the value of the 'block' attribute for this element For internal use only. |
void |
setContainingComplexType(UserComplexType type)
Sets the containing complex type definition. |
void |
setDefaultValue(String value)
Sets the 'default' value for this element declaration. |
void |
setFinalProhibitions(int finalValue)
Sets the value of the 'final' property, indicating which types of derivation are not allowed. |
void |
setFixedValue(Value value)
Sets the fixed value for this element definition. |
void |
setNameCode(int nameCode)
Set the name of this element declaration |
void |
setNamespaceResolver(NamespaceResolver resolver)
Set the namespace resolver to be used |
void |
setNillable(boolean nillable)
Sets whether or not instances of this element definition may set xsi:nil='true'. |
void |
setTypeReference(TypeReference type)
Sets the schema type for this element declaration. |
String |
toString()
|
boolean |
validate(SchemaCompiler compiler)
Check the validity (consistency) of this element definition. |
Methods inherited from class com.saxonica.schema.SchemaStructure |
---|
elaborate, getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, setConfiguration, setFixupStatus, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatus |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.saxonica.schema.UserSchemaComponent |
---|
elaborate |
Methods inherited from interface net.sf.saxon.type.SchemaComponent |
---|
getRedefinitionLevel, getValidationStatus |
Constructor Detail |
---|
public ElementDecl(EnterpriseConfiguration config, boolean global, SourceLocator locator)
config
- the Configuration to which this element declaration
belongsglobal
- true if the element declaration is top-levellocator
- identifies the location of the element declaration in theMethod Detail |
---|
public void setNamespaceResolver(NamespaceResolver resolver)
resolver
- the namespace resolverpublic void addIdentityConstraint(IdentityConstraintReference constraint)
constraint
- the IdentityConstraint to add.public void setContainingComplexType(UserComplexType type)
type
- the complex type containing this local element declarationpublic int getBlock()
SchemaType.DERIVE_BY_SUBSTITUTION
, indicating
which kinds of derivation from this element declaration are blocked.public String getDefaultValue()
public int getSubstitutionGroupExclusions()
final
or finalDefault
attributes.
Corresponds to the property {substitution group exclusions} in the schema component
model.
SchemaType.DERIVATION_EXTENSION
and
SchemaType.DERIVATION_RESTRICTION
public boolean allowsDerivation(int derivation)
derivation
- the kind of derivation, e.g. SchemaType.DERIVATION_EXTENSION
public UserComplexType getContainingComplexType()
public Value getFixedValue()
public String getFixedValueLexicalRepresentation()
public Comparable getFixedValueComparable()
public Iterator<IdentityConstraintReference> getIdentityConstraints()
IdentityConstraint
objects contained within
this element definition.public String getDisplayName()
public String getName()
public String getTargetNamespace()
public String getNamespaceURI()
public int getTypeFingerprint()
public SchemaType getType() throws UnresolvedReferenceException
getType
in interface SchemaDeclaration
UnresolvedReferenceException
- if the reference from the element declaration
to its type cannot be resolved.public Set<ElementDecl> getSubstitutionGroupOwners() throws UnresolvedReferenceException
UnresolvedReferenceException
- if the element is a member of a substitution group but
no declaration of the referenced element is (yet) availablepublic void gatherSubstititionGroupOwnersTransitively(Set<ElementDecl> headSet)
headSet
- the set into which the heads of all groups will be placedpublic Set<ElementDecl> getSubstitutionGroupMembers()
public void addSubstitutionGroupMember(ElementDecl member, SchemaCompiler compiler) throws SchemaException
member
- The element declaration to be added to the substitution group of which this
element declaration is the head. Elements are added to each ancestor in the substitution
group hierarchy.compiler
- used for error reporting
SchemaException
public void registerComplexTypeUsingThisElement(UserComplexType type)
type
- A complex type that contains this element as a particle.public boolean isAbstract()
isAbstract
in interface SchemaDeclaration
public boolean isNillable()
isNillable
in interface SchemaDeclaration
public boolean isGlobal()
public void setAbstract(boolean isAbstract)
isAbstract
- a boolean: when true indicates that this
element definition is abstractpublic void setBlock(int block)
block
- the value of the block attribute for this
element definition, indicating the types of derivation that are not allowed,
as a bit-significant integer, using constants such as SchemaType.DERIVATION_EXTENSION
public void setDefaultValue(String value)
value
- the default value for this element declaration.public void setFinalProhibitions(int finalValue)
finalValue
- the bit-significant code representing the final property,
made up of values such as SchemaType.DERIVE_BY_SUBSTITUTION
public void setFixedValue(Value value)
value
- the fixed value for this element definition. This is stored initially
as the string value initially specified in the schema document; once the type of
the element is known (during schema validation) this is replaced by the typed value.public void setNillable(boolean nillable)
nillable
- the flag when true indicates that instances
of this element definition may be nilledpublic void setNameCode(int nameCode)
nameCode
- the nameCode of the element name in the namePoolpublic int getFingerprint()
getFingerprint
in interface SchemaDeclaration
public int getNameCode()
public void addSubstitutionGroupHead(int nameCode)
nameCode
- the nameCode of the name of the head of the
substitutionGroup of this element definition.public Iterator<ElementDecl> iterateSubstitutionGroup()
public void setTypeReference(TypeReference type)
type
- the schema type for this element declaration.public void addTypeAlternative(TypeAlternative alternative)
alternative
- the type alternative to be addedpublic boolean hasTypeAlternatives()
public Iterator<TypeAlternative> iterateTypeAlternatives()
TypeAlternative
public void lookForCycles(Stack references, SchemaCompiler compiler) throws SchemaException, UnresolvedReferenceException
In this particular case the cycles we are looking for are cycles in substitution group membership.
lookForCycles
in interface UserSchemaComponent
lookForCycles
in class SchemaStructure
references
- A list of objects that contain direct or indirect references
to this object, and that must therefore not be referred to from this object.compiler
- used for error reporting
SchemaException
UnresolvedReferenceException
public boolean fixup(SchemaCompiler compiler) throws SchemaException, UnresolvedReferenceException
fixup
in interface UserSchemaComponent
fixup
in class SchemaStructure
compiler
- used for error reporting
SchemaException
UnresolvedReferenceException
public NodeTest makeSchemaNodeTest()
makeSchemaNodeTest
in interface SchemaDeclaration
public boolean validate(SchemaCompiler compiler) throws SchemaException
validate
in interface UserSchemaComponent
compiler
- used for error reporting
SchemaException
- if an error is found and the
error listener decides that the error is fatalprotected void fixupSubstitutionGroup(SchemaCompiler compiler) throws SchemaException, ValidationException
compiler
- used for error reporting
SchemaException
- if any error occurs, for example a name that is referenced
but not declared
ValidationException
public boolean isSameDeclaration(ElementDecl other)
other
- the declaration with which to compare this one
public boolean hasSameTypeTable(ElementDecl other)
public String toString()
toString
in class Object
public void serialize(SchemaModelSerializer serializer) throws XPathException
serialize
in interface SerializableSchemaComponent
XPathException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |