com.saxonica.schema
Class ElementWildcard

java.lang.Object
  extended by com.saxonica.schema.SchemaStructure
      extended by com.saxonica.schema.SimpleComponentReference
          extended by com.saxonica.schema.Particle
              extended by com.saxonica.schema.ElementWildcard
All Implemented Interfaces:
ComponentReference, UserSchemaComponent, Serializable, SourceLocator, SchemaComponent

public class ElementWildcard
extends Particle

This class represents an element in the schema.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.saxonica.schema.Particle
UNBOUNDED
 
Fields inherited from class com.saxonica.schema.SimpleComponentReference
nameCode, symbolSpace, target
 
Fields inherited from interface net.sf.saxon.type.SchemaComponent
FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING
 
Constructor Summary
ElementWildcard(EnterpriseConfiguration config)
           
ElementWildcard(Wildcard wc)
           
 
Method Summary
 void compile(SchemaCompiler compiler)
          Compile a particle
 boolean containsElementWildcard()
          Ask whether the particle contains an element wildcard
 ElementWildcard copy()
           
 boolean fixup(SchemaCompiler compiler)
          Check references from this component to other components
 void gatherAllPermittedElements(IntHashSet result, boolean ignoreWildcards)
          Find the set of all element particles allowed within the content model of this particle, identified by their integer fingerprints.
 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.
 Term getTerm()
          Get the term represented by this particle
 Wildcard getWildcard()
           
 boolean isEmptiable()
          Determine if this particle can be empty
 boolean isPointless(ModelGroup container)
          Test whether the particle is pointless, as described in XML Schema Part 1 Schema Component Constraint: Particle Valid (Restriction)
 void serializeParticle(SchemaModelSerializer serializer)
          Serialize the particle
 void setWildcard(Wildcard wildcard)
           
 boolean validate(SchemaCompiler compiler)
          Check the validity (consistency) of this element wildcard definition.
 
Methods inherited from class com.saxonica.schema.Particle
computeParticleCardinality, getMaxOccurs, getMinOccurs, isVulnerable, markVulnerableSubParticles, setMaxOccurs, setMinOccurs, setVulnerable
 
Methods inherited from class com.saxonica.schema.SimpleComponentReference
getFingerprint, getNameCode, getSymbolSpace, getTarget, isResolved, setNameCode, setTarget, tryToResolve
 
Methods inherited from class com.saxonica.schema.SchemaStructure
elaborate, getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, lookForCycles, setConfiguration, setFixupStatus, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, 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
elaborate, lookForCycles
 
Methods inherited from interface net.sf.saxon.type.SchemaComponent
getRedefinitionLevel, getValidationStatus
 
Methods inherited from interface com.saxonica.schema.ComponentReference
getConfiguration
 
Methods inherited from interface javax.xml.transform.SourceLocator
getColumnNumber, getLineNumber, getPublicId, getSystemId
 

Constructor Detail

ElementWildcard

public ElementWildcard(EnterpriseConfiguration config)

ElementWildcard

public ElementWildcard(Wildcard wc)
Method Detail

copy

public ElementWildcard copy()

setWildcard

public void setWildcard(Wildcard wildcard)

getWildcard

public Wildcard getWildcard()

isEmptiable

public boolean isEmptiable()
Determine if this particle can be empty

Specified by:
isEmptiable in class Particle
Returns:
true if the particle matches empty content

isPointless

public boolean isPointless(ModelGroup container)
Test whether the particle is pointless, as described in XML Schema Part 1 Schema Component Constraint: Particle Valid (Restriction)

Specified by:
isPointless in class Particle
Parameters:
container - the model group containing this particle; null if there is no containing model group
Returns:
true if the particle is pointless (for example, a sequence of one item)

getTerm

public Term getTerm()
Get the term represented by this particle

Specified by:
getTerm in class Particle
Returns:
the corresponding term

fixup

public boolean fixup(SchemaCompiler compiler)
              throws SchemaException
Check references from this component to other components

Specified by:
fixup in interface UserSchemaComponent
Specified by:
fixup in class Particle
Parameters:
compiler - the schema compiler
Returns:
true if all is well, false if errors found
Throws:
SchemaException

compile

public void compile(SchemaCompiler compiler)
             throws SchemaException
Description copied from class: Particle
Compile a particle

Specified by:
compile in class Particle
Parameters:
compiler - the schema compiler
Throws:
SchemaException - if a fatal error occurs

getElementParticleType

public 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. If there is no such particle, return null. If the fingerprint matches an element wildcard, return the type of the global element declaration with the given name if one exists, or AnyType if none exists and lax validation is permitted by the wildcard.

Specified by:
getElementParticleType in class Particle
Parameters:
fingerprint - Identifies the name of the child element within this content model
Returns:
the type of the element identified by the given name fingerprint. The consistency rule "Element Declarations Consistent" ensures that if there are multiple matching declarations, they have consistent types

getElementParticleCardinality

public 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. The value is one of 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.ALLOWS_ZERO.

Specified by:
getElementParticleCardinality in class Particle
Parameters:
fingerprint - Identifies the name of the child element within this content model
Returns:
the computed cardinality of this child element within the complex type

containsElementWildcard

public boolean containsElementWildcard()
Ask whether the particle contains an element wildcard

Specified by:
containsElementWildcard in class Particle
Returns:
true if the particle is an element wildcard, or contains one

gatherAllPermittedElements

public void gatherAllPermittedElements(IntHashSet result,
                                       boolean ignoreWildcards)
                                throws SchemaException
Find the set of all element particles allowed within the content model of this particle, identified by their integer fingerprints.

Specified by:
gatherAllPermittedElements in class Particle
Parameters:
result - an initially-empty integer set in which the results are accumulated
ignoreWildcards - true if wildcards are to be ignored. If false, the value -1 is added to the result set if an element wildcard is present (which it is, if we get as far as this version of the method)
Throws:
SchemaException - if an error is found in the schema

validate

public boolean validate(SchemaCompiler compiler)
                 throws SchemaException
Check the validity (consistency) of this element wildcard definition.

Specified by:
validate in interface UserSchemaComponent
Specified by:
validate in class Particle
Parameters:
compiler - the schema compiler
Returns:
true if validation succeeded, false if errors were found.
Throws:
SchemaException - if an error is found and the error listener decides that the error is fatal

serializeParticle

public void serializeParticle(SchemaModelSerializer serializer)
                       throws XPathException
Serialize the particle

Specified by:
serializeParticle in class Particle
Parameters:
serializer - the object responsible for serialization
Throws:
XPathException - if serialization fails


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.