Package com.sun.msv.reader.xmlschema
Class AttributeWildcardComputer
java.lang.Object
com.sun.msv.grammar.util.ExpressionWalker
com.sun.msv.reader.xmlschema.AttributeWildcardComputer
- All Implemented Interfaces:
ExpressionVisitorVoid
Processes the attribtue wildcard according to the spec.
Since the definition of the attribute wildcard is very adhoc, it cannot be naturally caputred by our AGM.
Therefore, when we parse a schema, we just parse <anyAttribute> directly. After all components are loaded, arcane computation is done to correctly compute the attribute wildcard.
Attribute wildcard will be ultimately converted into an expression, and that
will be attached to the ComplexTypeExp.attWildcard
.
This class also computes the attribute propagation that happens only when a complex type is derived by restriction. Consider the following fragment:
<attribute name="abc" ... />
According to the spec, the derived type will have the 'abc' attribute. By "propagation", we mean this behavior.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final XMLSchemaReader
private final Stack
private final Set
Visited ElementExps and ReferenceExps to prevent infinite recursion.private Set
Used to collect AttributeWildcards of children. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate AttributeWildcard
calcCompleteWildcard
(AttributeWildcard local, Set s) Computes the "complete attribute wildcard"private AttributeWildcard
calcComplexTypeWildcard
(AttributeWildcard complete, AttributeWildcard base) private void
compute
(Expression topLevel) static void
compute
(XMLSchemaReader reader, Expression topLevel) void
onElement
(ElementExp exp) void
onRef
(ReferenceExp exp) private void
Computes the propagated attributes.Methods inherited from class com.sun.msv.grammar.util.ExpressionWalker
onAnyString, onAttribute, onBinExp, onChoice, onConcur, onData, onEpsilon, onInterleave, onList, onMixed, onNullSet, onOneOrMore, onOther, onSequence, onValue
-
Field Details
-
reader
-
visitedExps
Visited ElementExps and ReferenceExps to prevent infinite recursion. -
unprocessedElementExps
-
wildcards
Used to collect AttributeWildcards of children.
-
-
Constructor Details
-
AttributeWildcardComputer
-
-
Method Details
-
compute
-
compute
-
onElement
- Specified by:
onElement
in interfaceExpressionVisitorVoid
- Overrides:
onElement
in classExpressionWalker
-
onRef
- Specified by:
onRef
in interfaceExpressionVisitorVoid
- Overrides:
onRef
in classExpressionWalker
-
calcCompleteWildcard
Computes the "complete attribute wildcard" -
calcComplexTypeWildcard
private AttributeWildcard calcComplexTypeWildcard(AttributeWildcard complete, AttributeWildcard base) -
propagateAttributes
Computes the propagated attributes.
-