|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.saxonica.schema.SchemaStructure
com.saxonica.schema.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(PreparedSchema schema,
javax.xml.transform.SourceLocator locator)
Creates a new element declaration |
Method Summary | |
void |
addIdentityConstraint(IdentityConstraint constraint)
Adds the given IdentityConstraint to this element definition. |
void |
addSubstitutionGroupMember(ElementDecl member)
Add a member of the substitution group that has this element as its head. |
boolean |
allowsDerivation(int derivation)
Determines whether derivation (of a particular kind) from this type is allowed, based on the "final" property |
boolean |
fixup(PreparedSchema schema)
Check references from this component to other components |
protected void |
fixupSubstitutionGroup(PreparedSchema schema)
Fix up the reference to the head of the substitition group |
int |
getBlock()
Returns the value of the 'block' attribute for this element |
java.lang.String |
getDefaultValue()
Returns the default value defined for this element definition. |
java.lang.String |
getDisplayName()
Returns the display name of this Element declaration. |
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. |
java.util.Iterator |
getIdentityConstraints()
Returns an Iterator over the identity constrains defined within this element definition. |
java.lang.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 |
java.lang.String |
getNamespaceURI()
Get the namespace URI of this element declaration |
int |
getSubstitutionGroupHead()
Returns the fingerprint of the name of the head of the substitutionGroup for this element declaration, or -1 if there is none. |
java.util.Set |
getSubstitutionGroupMembers()
Get the known members of the substitution group of this element, as a Set containing the ElementDecl objects. |
ElementDecl |
getSubstitutionGroupOwner()
Returns the head of the substitutionGroup for this element declaration, or null if there is none. |
ComponentReference |
getSubstitutionGroupOwnerReference()
Get the component reference pointing to the owner of the substitution group. |
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 |
isAbstract()
Returns true if this element definition is abstract |
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 type as another type. |
java.util.Iterator |
iterateSubstitutionGroup()
Iterate over all the elements contained in the substitution group of which this element is the head. |
void |
registerComplexTypeUsingThisElement(UserComplexType type)
Register a complex type that contains this element as a particle. |
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 |
setDefaultValue(java.lang.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 |
setSubstitutionGroupHead(int nameCode)
Sets the fingerprint of the name of the head of the substitutionGroup for this element definition. |
void |
setTypeReference(TypeReference type)
Sets the schema type for this element declaration. |
boolean |
validate(PreparedSchema schema)
Check the validity (consistency) of this element definition. |
Methods inherited from class com.saxonica.schema.SchemaStructure |
getColumnNumber, getFixupStatus, getLineNumber, getPublicId, getSchema, getSystemId, getValidationStatus, lookForCycles, setFixupStatus, setLineNumber, setLocator, setSchema, setSystemId, setValidationStatus |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.saxonica.schema.UserSchemaComponent |
lookForCycles |
Methods inherited from interface net.sf.saxon.type.SchemaComponent |
getValidationStatus |
Constructor Detail |
public ElementDecl(PreparedSchema schema, javax.xml.transform.SourceLocator locator)
schema
- the XML Schema to which this element declaration
belongslocator
- identifies the location of the element declaration in the
source schemaMethod Detail |
public void setNamespaceResolver(NamespaceResolver resolver)
public void addIdentityConstraint(IdentityConstraint constraint)
constraint
- the IdentityConstraint to add.public int getBlock()
SchemaType.DERIVE_BY_SUBSTITUTION
, indicating
which kinds of derivation from this element declaration are blocked.public java.lang.String getDefaultValue()
public boolean allowsDerivation(int derivation)
derivation
- the kind of derivation, e.g. SchemaType.DERIVATION_LIST
public Value getFixedValue()
public java.util.Iterator getIdentityConstraints()
IdentityConstraint
objects contained within
this element definition.public java.lang.String getDisplayName()
public java.lang.String getNamespaceURI()
public java.lang.String getName()
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 int getSubstitutionGroupHead()
public ComponentReference getSubstitutionGroupOwnerReference()
public ElementDecl getSubstitutionGroupOwner() throws UnresolvedReferenceException
UnresolvedReferenceException
- if the element is a member of a substitution group but
no declaration of the referenced element is (yet) availablepublic java.util.Set getSubstitutionGroupMembers()
public void addSubstitutionGroupMember(ElementDecl member) throws SchemaException, ValidationException
This method may be called at any time, for example when a new schema is loaded as a result of validating an instance document. The method is therefore synchronized, since the schema may be used in several threads concurrently. Adding a new member to a substitution group means that all complex type definitions that include this element in their content model must be recompiled.
It is not possible to add to a substitution group once the element declaration has been used, either for validating a source document or for compiling stylesheets or schemas.
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.
SchemaException
ValidationException
public void registerComplexTypeUsingThisElement(UserComplexType type)
type
- A complex type that contains this element as a particle.public boolean isAbstract()
public boolean isNillable()
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(java.lang.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()
public int getNameCode()
public void setSubstitutionGroupHead(int nameCode)
nameCode
- the nameCode of the name of the head of the
substitutionGroup of this element definition.public java.util.Iterator iterateSubstitutionGroup()
public void setTypeReference(TypeReference type)
type
- the schema type for this element declaration.public boolean fixup(PreparedSchema schema) throws SchemaException, UnresolvedReferenceException
fixup
in interface UserSchemaComponent
schema
- The schema is used for reporting errors
SchemaException
UnresolvedReferenceException
public boolean validate(PreparedSchema schema) throws SchemaException, ValidationException
validate
in interface UserSchemaComponent
schema
- the containing schema - used for reporting errors. Any
errors will be reported to the error listener.
SchemaException
- if an error is found and the
error listener decides that the error is fatal
ValidationException
protected void fixupSubstitutionGroup(PreparedSchema schema) throws SchemaException, ValidationException
schema
- the name schema
SchemaException
- if any error occurs, for example a name that is referenced
but not declared
ValidationException
public boolean isSameDeclaration(ElementDecl other)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |