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
public class AttributeWildcardComputer extends ExpressionWalker
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:
According to the spec, the derived type will have the 'abc' attribute. By "propagation", we mean this behavior.
-
-
Field Summary
Fields Modifier and Type Field Description private XMLSchemaReaderreaderprivate java.util.StackunprocessedElementExpsprivate java.util.SetvisitedExpsVisited ElementExps and ReferenceExps to prevent infinite recursion.private java.util.SetwildcardsUsed to collect AttributeWildcards of children.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAttributeWildcardComputer(XMLSchemaReader _reader)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private AttributeWildcardcalcCompleteWildcard(AttributeWildcard local, java.util.Set s)Computes the "complete attribute wildcard"private AttributeWildcardcalcComplexTypeWildcard(AttributeWildcard complete, AttributeWildcard base)private voidcompute(Expression topLevel)static voidcompute(XMLSchemaReader reader, Expression topLevel)voidonElement(ElementExp exp)voidonRef(ReferenceExp exp)private voidpropagateAttributes(ComplexTypeExp cexp)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 Detail
-
reader
private final XMLSchemaReader reader
-
visitedExps
private final java.util.Set visitedExps
Visited ElementExps and ReferenceExps to prevent infinite recursion.
-
unprocessedElementExps
private final java.util.Stack unprocessedElementExps
-
wildcards
private java.util.Set wildcards
Used to collect AttributeWildcards of children.
-
-
Constructor Detail
-
AttributeWildcardComputer
protected AttributeWildcardComputer(XMLSchemaReader _reader)
-
-
Method Detail
-
compute
public static void compute(XMLSchemaReader reader, Expression topLevel)
-
compute
private void compute(Expression topLevel)
-
onElement
public void onElement(ElementExp exp)
- Specified by:
onElementin interfaceExpressionVisitorVoid- Overrides:
onElementin classExpressionWalker
-
onRef
public void onRef(ReferenceExp exp)
- Specified by:
onRefin interfaceExpressionVisitorVoid- Overrides:
onRefin classExpressionWalker
-
calcCompleteWildcard
private AttributeWildcard calcCompleteWildcard(AttributeWildcard local, java.util.Set s)
Computes the "complete attribute wildcard"
-
calcComplexTypeWildcard
private AttributeWildcard calcComplexTypeWildcard(AttributeWildcard complete, AttributeWildcard base)
-
propagateAttributes
private void propagateAttributes(ComplexTypeExp cexp)
Computes the propagated attributes.
-
-