com.saxonica.schema
Class SchemaStructure

java.lang.Object
  extended by com.saxonica.schema.SchemaStructure
All Implemented Interfaces:
Serializable, SourceLocator
Direct Known Subclasses:
Assertion, AttributeDecl, AttributeGroupDecl, AttributeGroupReference, AttributeWildcard, ElementDecl, IdentityConstraint, IdentityConstraintReference, IdentityField, IdentitySelector, ModelGroup, Notation, PreparedSchema, SimpleComponentReference, TypeAlternative, TypeReference, UserDefinedType, Wildcard

public abstract class SchemaStructure
extends Object
implements Serializable, SourceLocator

The base class for all XML Schema stuctures. Generally represents a schema component in the sense of the XML Schema specification, though the correspondence is not always one to one. Maintains information about the location of the schema construct in an XML Schema document, for diagnostic purposes.

See Also:
Serialized Form

Constructor Summary
SchemaStructure()
           
 
Method Summary
 void elaborate(SchemaCompiler compiler)
          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)
          Fixup references from this schema component to others
 int getColumnNumber()
          Get the column number of the element defining this schema component.
 EnterpriseConfiguration getConfiguration()
          Get the schema containing this structure
 int getFixupStatus()
          Get the current fixup status
 int getLineNumber()
          Get the line number of the element defining this schema component, within its module.
 String getPublicId()
          Get the public ID of the containing module, if known.
 int getRedefinitionLevel()
          Get the redefinition level.
 String getSchemaDocumentURI()
          Get the base URI of the containing xs:schema element.
 String getSystemId()
          Get the system identifier (URI) of the schema module (XML document) containing the definition of this component.
 int getValidationStatus()
          Get the current validation status
 void lookForCycles(Stack references, SchemaCompiler compiler)
          This method is called to look for cycles.
 void setConfiguration(EnterpriseConfiguration config)
          Set the configuration containing this structure
 void setFixupStatus(int status)
          Set the fixup status
 void setLineNumber(int lineNumber)
          Set the line number
 void setLocator(SourceLocator locator)
          Set the location information for this schema component.
 void setRedefinitionLevel(int level)
          Set the redefinition level.
 void setSchemaDocumentURI(String uri)
          Set the base URI of the containing xs:schema element.
 void setSystemId(String systemId)
          Set the system Id
 void setValidationStatus(int status)
          Set the validation status
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaStructure

public SchemaStructure()
Method Detail

getSystemId

public String getSystemId()
Get the system identifier (URI) of the schema module (XML document) containing the definition of this component.

Specified by:
getSystemId in interface SourceLocator
Returns:
the URI of the containing module.

getPublicId

public String getPublicId()
Get the public ID of the containing module, if known.

Specified by:
getPublicId in interface SourceLocator
Returns:
This information is not currently maintained, the method always returns null.

getLineNumber

public int getLineNumber()
Get the line number of the element defining this schema component, within its module. This will be as delivered by the SAX2 parser: that is, the line number of an element is generally the line number on which its start tag ends.

Specified by:
getLineNumber in interface SourceLocator
Returns:
the line number where the relevant element can be found.

getColumnNumber

public int getColumnNumber()
Get the column number of the element defining this schema component.

Specified by:
getColumnNumber in interface SourceLocator
Returns:
-1: this information is not maintained.

setLocator

public void setLocator(SourceLocator locator)
Set the location information for this schema component.

Parameters:
locator - the location information.

setSystemId

public void setSystemId(String systemId)
Set the system Id

Parameters:
systemId - the systemId (the URI of the schema document in which the component is declared)

setLineNumber

public void setLineNumber(int lineNumber)
Set the line number

Parameters:
lineNumber - the line number of the declaration of the component within its schema document

setSchemaDocumentURI

public void setSchemaDocumentURI(String uri)
Set the base URI of the containing xs:schema element. This will normally be the same as the systemId, unless the schema document is made up of multiple XML entities

Parameters:
uri - the base URI of the schema document

getSchemaDocumentURI

public String getSchemaDocumentURI()
Get the base URI of the containing xs:schema element. This will normally be the same as the systemId, unless the schema document is made up of multiple XML entities

Returns:
the base URI of the containing schema document

getValidationStatus

public int getValidationStatus()
Get the current validation status

Returns:
an integer code indicating whether validation has not yet been started, is underway, has completed successfully, or has completed unsuccessfully

setValidationStatus

public void setValidationStatus(int status)
Set the validation status

Parameters:
status - an integer code indicating whether validation has not yet been started, is underway, has completed successfully, or has completed unsuccessfully

getFixupStatus

public int getFixupStatus()
Get the current fixup status

Returns:
an integer code indicating whether fixup of component references has not yet been started, is underway, has completed successfully, or has completed unsuccessfully

setFixupStatus

public void setFixupStatus(int status)
Set the fixup status

Parameters:
status - an integer code indicating whether fixup of component references has not yet been started, is underway, has completed successfully, or has completed unsuccessfully

setConfiguration

public void setConfiguration(EnterpriseConfiguration config)
Set the configuration containing this structure

Parameters:
config - the Saxon configuration

getConfiguration

public EnterpriseConfiguration getConfiguration()
Get the schema containing this structure

Returns:
the Saxon configuration

setRedefinitionLevel

public void setRedefinitionLevel(int level)
Set the redefinition level. This is zero for a component that has not been redefined; for a redefinition of a level-0 component, it is 1; for a redefinition of a level-N component, it is N+1. This concept is used to support the notion of "pervasive" redefinition: if a component is redefined at several levels, the top level wins, but it is an error to have two versions of the component at the same redefinition level.

Parameters:
level - the redefinition level

getRedefinitionLevel

public int getRedefinitionLevel()
Get the redefinition level. This is zero for a component that has not been redefined; for a redefinition of a level-0 component, it is 1; for a redefinition of a level-N component, it is N+1. This concept is used to support the notion of "pervasive" redefinition: if a component is redefined at several levels, the top level wins, but it is an error to have two versions of the component at the same redefinition level.

Returns:
the redefinition level

lookForCycles

public void lookForCycles(Stack references,
                          SchemaCompiler compiler)
                   throws SchemaException,
                          UnresolvedReferenceException
This method is called to look for cycles. The object implementing this method is required (a) to raise an exception if the object itself appears in the list of references, (b) to add itself to the list of references, and (c) to call the lookForCycles method on all the objects that it references. This is a dummy implementation that does nothing; it must be overridden for components that can participate in cycles.

Parameters:
references - A stack of objects that contain direct or indirect references to this object, and that must therefore not be referred to from this object.
compiler - the schema compiler
Throws:
SchemaException
UnresolvedReferenceException

fixup

public boolean fixup(SchemaCompiler compiler)
              throws SchemaException
Fixup references from this schema component to others

Parameters:
compiler - the SchemaCompiler, used primarily for reporting errors
Returns:
true if all references were fixed up successfully, false if dangling references were found
Throws:
SchemaException

elaborate

public void elaborate(SchemaCompiler compiler)
               throws SchemaException
Elaborate the schema component: after reloading a serialized schema component model, this expands the component with derived information needed during validation episodes. The model is assumed to be valid.

Parameters:
compiler -
Throws:
SchemaException


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