|
|||||||
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.SchemaTypeImpl com.saxonica.schema.UserComplexType
public class UserComplexType
A user-defined complex type (that is, any complex type other than xs:anyType)
Field Summary |
---|
Fields inherited from interface net.sf.saxon.type.SchemaType |
---|
DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION, DERIVE_BY_SUBSTITUTION |
Fields inherited from interface net.sf.saxon.type.SchemaComponent |
---|
FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING |
Constructor Summary | |
---|---|
UserComplexType(SchemaAwareConfiguration config,
SourceLocator locator)
Creates a new user-defined Complextype |
Method Summary | |
---|---|
void |
addAssertion(Assertion assertion)
Add an assertion to this complex type |
void |
addAttributeGroupReference(AttributeGroupReference attrGroupRef)
Adds the given AttributeGroupReference to this UserComplexType |
void |
addAttributeUse(AttributeUse attrDecl)
Adds the given AttributeDecl to this UserComplexType. |
String |
allSubsumes(ComplexType sub,
SchemaCompiler compiler)
Test whether a complex type constructed using "all" subsumes another complex type. |
void |
analyzeContentExpression(Expression expression,
int kind,
StaticContext env)
Analyze an expression to see whether the expression is capable of delivering a value of this type. |
Value |
atomize(NodeInfo node)
Get the typed value of a node that is annotated with this schema type. |
void |
cancelValidation()
Cancel validation and compilation: this happens when the complex type is redefined |
static void |
checkTypeDerivation(ComplexType derived,
SchemaType base,
int block)
Check that a type is validly derived from a given type. |
void |
compile(SchemaCompiler compiler)
Compile the finite-state machine for validating instances against this type |
boolean |
computeIsAllContent()
Compute whether this complex type has a content model defined by an xs:all compositor (after simplification to remove pointless particles) |
void |
elaborate()
Elaborate the schema component: after reloading a serialized schema component model, this expands the component with derived information needed during validation episodes. |
boolean |
fixup(SchemaCompiler compiler)
Check references from this component to other components |
void |
gatherAllPermittedChildren(IntHashSet children)
Get a list of all the names of elements that can appear as children of an element having this complex type, as integer fingerprints. |
void |
gatherAllPermittedDescendants(IntHashSet descendants)
Get a list of all the names of elements that can appear as descendants of an element having this complex type, as integer fingerprints. |
ModelGroupParticle |
getAllCompositor()
For a complex type with "all" content, get the "all" model group. |
Set |
getAssertions()
Get the assertions defined on this complex type |
AttributeGroupDecl |
getAttributeGroup()
Returns the attribute group containing details of all the attributes defined for this complex type. |
SchemaType |
getAttributeUseType(int fingerprint)
Find an attribute use within this complex type definition having a given attribute name (identified by fingerprint), and return the schema type associated with that attribute. |
int |
getBlock()
Returns the value of the 'block' attribute for this element |
AttributeGroupDecl |
getCombinedAttributeGroup()
Returns the attribute group containing details of all the attributes defined for this complex type. |
int |
getElementParticleCardinality(int fingerprint)
Find an element particle within this complex type definition having a given element name (identified by fingerprint), and return the cardinality associated with that element particle, that is, the number of times the element can occur within this complex type. |
SchemaType |
getElementParticleType(int fingerprint)
Find an element particle within this complex type definition having a given element name (identified by fingerprint), and return the schema type associated with that element particle. |
AutomatonState |
getInitialState()
Get the initial state of the finite state machine used for validating against this type. |
Particle |
getParticle()
Get the (extended) particle representing the content model of this complex type. |
SimpleType |
getSimpleContentType()
For a complex type with simple content, return the simple type of the content. |
TypeReference |
getSimpleContentTypeReference()
Get the reference to the simple content type |
SequenceIterator |
getTypedValue(NodeInfo node)
Get the typed value of a node that is annotated with this schema type |
boolean |
hasAssertions()
Test whether there are any assertions defined on this complex type |
boolean |
hasRegisteredExtension(UserComplexType extension)
Determine whether a particular complex type is among the registered extensions of this type |
boolean |
isAbstract()
Returns true if this UserComplexType has been marked as Abstract. |
boolean |
isAllContent()
Test whether this complex type has "all" content, that is, a content model using an xs:all compositor |
boolean |
isAtomicType()
Test whether this SchemaType is an atomic type |
boolean |
isComplexContent()
Returns true if this complexType has complex content: that is, if its {content type} is anything other than a simple type definition. |
boolean |
isEmptiable()
Test whether the content model of this complexType allows empty content |
boolean |
isEmptyContent()
Test whether the contentType of this complexType is empty |
boolean |
isMixedContent()
Determine whether this complex type allows mixed content |
boolean |
isRestricted()
Returns true if this complexType is a restriction |
boolean |
isSimpleContent()
Returns true if this complexType has simple content; that is, if its {content type} is a simple type definition |
boolean |
isSimpleType()
Test whether this SchemaType is a simple type |
String |
isSubsumedBy(ComplexType base,
SchemaCompiler compiler)
Test whether this complex type is subsumed by another complex type. |
boolean |
isValidRestriction(SchemaType base,
SchemaCompiler compiler)
Determine whether this type is a valid restriction of another type |
Iterator |
iterateAssertions()
Iterate over all the assertions defined on this complex type |
void |
lookForCycles(Stack references,
SchemaCompiler compiler)
This method is called to look for cycles. |
Particle |
makeExtendedParticle(SchemaCompiler compiler)
Get the particle corresponding to this UserComplexType, combining it with the content model of the base type if this type is derived by extension. |
void |
recompile(SchemaCompiler compiler)
Recompile the complex type when new members are added to the substitution group of an element |
void |
serialize(SchemaModelSerializer serializer)
Serialize the schema component |
void |
setAbstract(boolean isAbstract)
Sets whether or not this UserComplexType should be abstract. |
void |
setAnyAttribute(AttributeWildcard wildcard)
Sets the wildcard (anyAttribute) of the complexType. |
void |
setBlock(int block)
Sets the value of the 'block' attribute for this UserComplexType. |
void |
setComplexContent(boolean complexContent)
Sets whether or not this complexType is a 'complexContent' |
void |
setFiniteStateMachine(FiniteStateMachine machine)
Set the finite state machine. |
void |
setMixed(boolean isMixed)
Sets whether this complex type allows mixed content |
void |
setParticle(Particle particle)
Sets the particle representing the content model of this complex type |
void |
setRestriction(boolean restricted)
Sets whether or not this complexType is a restriction |
void |
setSaxonDebug(boolean debug)
Set Saxon debugging on or off |
void |
setSimpleContent(boolean simpleContent)
Set that this complex type has (or does not have) simple content |
void |
setSimpleContentTypeReference(TypeReference ref)
For a complex type with simple content, set a reference to the simple type of the content |
String |
subsumesAll(UserComplexType sub,
SchemaCompiler compiler)
Test whether the particle of this complex type subsumes a complex type defined using xs:all |
boolean |
validate(SchemaCompiler compiler)
Checks the validity of this UserComplexType definition. |
Methods inherited from class com.saxonica.schema.SchemaStructure |
---|
getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getSystemId, getValidationStatus, setConfiguration, setFixupStatus, setLineNumber, setLocator, setSystemId, setValidationStatus |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.saxon.type.SchemaType |
---|
allowsDerivation, checkTypeDerivationIsOK, getBaseType, getDerivationMethod, getDescription, getDisplayName, getFingerprint, getName, getNameCode, getSystemId, getTargetNamespace, isAnonymousType, isComplexType, isSameType |
Methods inherited from interface net.sf.saxon.type.SchemaComponent |
---|
getValidationStatus |
Constructor Detail |
---|
public UserComplexType(SchemaAwareConfiguration config, SourceLocator locator)
config
- the Configuration to which this user-defined complex type belongslocator
- the location of this complex type within a schema documentMethod Detail |
---|
public void setSaxonDebug(boolean debug)
debug
- true to switch debugging on; false to switch it offpublic void setFiniteStateMachine(FiniteStateMachine machine)
machine
- the FSM for this complex typepublic void addAttributeUse(AttributeUse attrDecl)
attrDecl
- the AttributeDecl to add to this UserComplexTypepublic void addAttributeGroupReference(AttributeGroupReference attrGroupRef)
attrGroupRef
- the AttributeGroupReference to add to this
UserComplexTypepublic AttributeGroupDecl getAttributeGroup()
public AttributeGroupDecl getCombinedAttributeGroup()
public boolean hasRegisteredExtension(UserComplexType extension)
extension
- the type to be tested to see whether it is an extension of this one
public int getBlock()
getBlock
in interface SchemaType
getBlock
in class SchemaTypeImpl
public boolean isAbstract()
isAbstract
in interface ComplexType
public boolean isComplexContent()
isComplexContent
in interface ComplexType
public boolean isSimpleContent()
isSimpleContent
in interface ComplexType
public void setSimpleContent(boolean simpleContent)
simpleContent
- true if the complex type has simple contentpublic boolean isAllContent()
isAllContent
in interface ComplexType
public boolean computeIsAllContent() throws SchemaException
SchemaException
public ModelGroupParticle getAllCompositor()
public void setSimpleContentTypeReference(TypeReference ref)
ref
- a reference to a simple typepublic TypeReference getSimpleContentTypeReference()
public SimpleType getSimpleContentType()
getSimpleContentType
in interface ComplexType
public boolean isRestricted()
isRestricted
in interface ComplexType
public boolean isEmptyContent()
isEmptyContent
in interface ComplexType
public boolean isSimpleType()
isSimpleType
in interface SchemaType
public boolean isAtomicType()
isAtomicType
in interface SchemaType
public void setAbstract(boolean isAbstract)
isAbstract
- a boolean that when true makes this UserComplexType
abstract.public void setAnyAttribute(AttributeWildcard wildcard)
wildcard
- the attribute wildcardpublic void setBlock(int block)
block
- the value of the block attribute for this
UserComplexType definition, as a bit-significant integer.public void setComplexContent(boolean complexContent)
complexContent
- true if this complexType is a 'complexContent'public void setMixed(boolean isMixed)
isMixed
- if true, this type allows mixed contentpublic boolean isMixedContent()
isMixedContent
in interface ComplexType
public void setRestriction(boolean restricted)
restricted
- true if this complexType is a restrictionpublic void setParticle(Particle particle) throws SchemaException
particle
- the Particle to add
SchemaException
- if the particle cannot be added (for example,
because there is another with the same name in the same scope)public void addAssertion(Assertion assertion)
assertion
- the assertion to be addedpublic boolean hasAssertions()
public Iterator iterateAssertions()
public Set getAssertions()
public void lookForCycles(Stack references, SchemaCompiler compiler) throws SchemaException, UnresolvedReferenceException
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
fixup
in interface UserSchemaComponent
fixup
in class SchemaStructure
compiler
- used for error reporting
SchemaException
public boolean validate(SchemaCompiler compiler) throws SchemaException
validate
in interface UserSchemaComponent
SchemaException
- if the ErrorListener decides that an error is fatal.public boolean isValidRestriction(SchemaType base, SchemaCompiler compiler) throws SchemaException
base
- the specified base typecompiler
- used for error reporting
SchemaException
- if an error occurspublic void compile(SchemaCompiler compiler) throws SchemaException
compiler
- used for error reporting
SchemaException
- to indicate an invalid schemapublic void recompile(SchemaCompiler compiler) throws SchemaException, ValidationException
compiler
- user for error reporting
SchemaException
ValidationException
public void cancelValidation()
public AutomatonState getInitialState()
public Particle makeExtendedParticle(SchemaCompiler compiler) throws SchemaException
compiler
- used for error reporting. May be null if the schema has already been fully validated.
SchemaException
- if an error occurspublic Particle getParticle()
public boolean isEmptiable()
isEmptiable
in interface ComplexType
public SchemaType getElementParticleType(int fingerprint)
getElementParticleType
in interface ComplexType
fingerprint
- Identifies the name of the child element within this content model
public int getElementParticleCardinality(int fingerprint)
StaticProperty.EXACTLY_ONE
, StaticProperty.ALLOWS_ZERO_OR_ONE
,
StaticProperty.ALLOWS_ZERO_OR_MORE
, StaticProperty.ALLOWS_ONE_OR_MORE
,
If there is no such particle, return StaticProperty.EMPTY
.
getElementParticleCardinality
in interface ComplexType
fingerprint
- Identifies the name of the child element within this content model
StaticProperty.EMPTY
.public SchemaType getAttributeUseType(int fingerprint) throws SchemaException, ValidationException
getAttributeUseType
in interface ComplexType
fingerprint
- Identifies the name of the child element within this content model
SchemaException
ValidationException
public void gatherAllPermittedChildren(IntHashSet children) throws SchemaException
gatherAllPermittedChildren
in interface ComplexType
children
- an integer set, initially empty, which on return will hold the fingerprints of all permitted
child elements; if the result contains the value -1, this indicates that it is not possible to enumerate
all the children, typically because of wildcards. In this case the other contents of the set should
be ignored.
SchemaException
public void gatherAllPermittedDescendants(IntHashSet descendants) throws SchemaException
gatherAllPermittedDescendants
in interface ComplexType
descendants
- an integer set, initially empty, which on return will hold the fingerprints of all permitted
descendant elements; if the result contains the value -1, this indicates that it is not possible to enumerate
all the descendants, typically because of wildcards. In this case the other contents of the set should
be ignored.
SchemaException
public String isSubsumedBy(ComplexType base, SchemaCompiler compiler) throws SchemaException
base
- the other type (the type that this is derived from by restriction, validly or otherwise)compiler
- used for error reporting
SchemaException
public String allSubsumes(ComplexType sub, SchemaCompiler compiler) throws SchemaException
sub
- the particle that is (supposedly) subsumedcompiler
- used for reporting errors and warnings
SchemaException
public String subsumesAll(UserComplexType sub, SchemaCompiler compiler) throws SchemaException
sub
- the derived typecompiler
- used for error reporting
SchemaException
public void analyzeContentExpression(Expression expression, int kind, StaticContext env) throws XPathException
analyzeContentExpression
in interface SchemaType
expression
- the expression that delivers the contentkind
- the node kind whose content is being delivered: Type.ELEMENT
,
Type.ATTRIBUTE
, or Type.DOCUMENT
env
- the static context
XPathException
- if the expression will never deliver a value of the correct typepublic SequenceIterator getTypedValue(NodeInfo node) throws XPathException
getTypedValue
in interface SchemaType
node
- the node whose typed value is required
XPathException
public Value atomize(NodeInfo node) throws XPathException
getTypedValue(net.sf.saxon.om.NodeInfo)
. However, this method is often more convenient and may be
more efficient, especially in the common case where the value is expected to be a singleton.
atomize
in interface SchemaType
node
- the node whose typed value is required
XPathException
public static void checkTypeDerivation(ComplexType derived, SchemaType base, int block) throws SchemaException
derived
- the derived typebase
- the type from which this type is derivedblock
- the derivations that are blocked by the relevant element declaration
SchemaException
- if the derivation is not allowedpublic void elaborate() throws SchemaException
elaborate
in interface UserSchemaComponent
elaborate
in class SchemaStructure
SchemaException
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 |