public class AttributeWildcardComputer extends ExpressionWalker
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.
Modifier and Type | Field and Description |
---|---|
private XMLSchemaReader |
reader |
private java.util.Stack |
unprocessedElementExps |
private java.util.Set |
visitedExps
Visited ElementExps and ReferenceExps to prevent infinite recursion.
|
private java.util.Set |
wildcards
Used to collect AttributeWildcards of children.
|
Modifier | Constructor and Description |
---|---|
protected |
AttributeWildcardComputer(XMLSchemaReader _reader) |
Modifier and Type | Method and Description |
---|---|
private AttributeWildcard |
calcCompleteWildcard(AttributeWildcard local,
java.util.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 |
propagateAttributes(ComplexTypeExp cexp)
Computes the propagated attributes.
|
onAnyString, onAttribute, onBinExp, onChoice, onConcur, onData, onEpsilon, onInterleave, onList, onMixed, onNullSet, onOneOrMore, onOther, onSequence, onValue
private final XMLSchemaReader reader
private final java.util.Set visitedExps
private final java.util.Stack unprocessedElementExps
private java.util.Set wildcards
protected AttributeWildcardComputer(XMLSchemaReader _reader)
public static void compute(XMLSchemaReader reader, Expression topLevel)
private void compute(Expression topLevel)
public void onElement(ElementExp exp)
onElement
in interface ExpressionVisitorVoid
onElement
in class ExpressionWalker
public void onRef(ReferenceExp exp)
onRef
in interface ExpressionVisitorVoid
onRef
in class ExpressionWalker
private AttributeWildcard calcCompleteWildcard(AttributeWildcard local, java.util.Set s)
private AttributeWildcard calcComplexTypeWildcard(AttributeWildcard complete, AttributeWildcard base)
private void propagateAttributes(ComplexTypeExp cexp)