com.sun.msv.reader.xmlschema

Class RedefinableDeclState

Implemented Interfaces:
ContentHandler, ExpressionOwner
Known Direct Subclasses:
AttributeGroupState, ComplexTypeDeclState, GroupState

public abstract class RedefinableDeclState
extends ExpressionWithChildState

state that parses redefinable declaration. "Declarations" are attribute, element, complexType, group, and attributeGroup. simpleType is treated differently.

When this state is used under states other than RedefineState, this class doesn't do anything. When used under RedefineState, this class does several tricks to make redefinition easy.

Redefinition is done in the following steps.

Step.1

First, say redefinition of declaration "ABC" is found, "ABC" has already defined once and it is

Step.2

In startSelf method, this class clones the current definition, and updates ReferenceContainer to point to the cloned definition (right side).

Note that other expressions hold direct reference to the original definition (left side), and these references are not affected by this update.

Step.3

Body of redefinition is parsed and corresponding expression is created by derived class. This step is done no differently.

Since ReferenceContainer has updated, any reference to this expression found during this step is bound to the cloned definition. This self reference usually happens.

Step.4

After the body of redefinition is parsed, the original definition (left side) is updated by using new expression.

From now on, redefinition becomes visible to all expressions that hold direct reference to the original definition. The cloned definition is kept as-is so that any self reference found in the body will be maintained correctly.

Step.5

Finally, ReferenceContainer is updated again to point to the updated definition. Therefore successive reference to "ABC" will be bound to the updated definition. Cloned old definition is kept as-is.

Field Summary

Fields inherited from class com.sun.msv.reader.State

reader

Method Summary

Methods inherited from class com.sun.msv.reader.ExpressionWithChildState

onEndChild

Methods inherited from class com.sun.msv.reader.SimpleState

endDocument, endElement, startElement

Methods inherited from class com.sun.msv.reader.State

_assert, characters, endPrefixMapping, getBaseURI, getLocation, getParentState, getStartTag, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping