Top Description Fields Constructors Methods
com.sun.msv.reader.xmlschema

public Class AttributeWildcardComputer

extends ExpressionWalker
Class Inheritance
Imports
java.util.HashSet, .Set, .Stack, com.sun.msv.grammar.AttributeExp, .ChoiceExp, .ElementExp, .Expression, .NameClass, .ReferenceExp, .SimpleNameClass, com.sun.msv.grammar.util.ExpressionWalker, com.sun.msv.grammar.xmlschema.AttWildcardExp, .AttributeGroupExp, .AttributeWildcard, .ComplexTypeExp, com.sun.msv.util.StringPair

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:

<complexType name="base">
  <attribute name="abc" ... />
</complexType>

<complexType name="derived">
  <complexContent>
    <restriction base="base"/>
  </complexContent>
</complexType>

According to the spec, the derived type will have the 'abc' attribute. By "propagation", we mean this behavior.

Author
Kohsuke KAWAGUCHI

Field Summary

Modifier and TypeField and Description
private final XMLSchemaReader
private final Stack<Expression>
private final Set<Expression>
visitedExps

Visited ElementExps and ReferenceExps to prevent infinite recursion.

private Set<AttributeWildcard>
wildcards

Used to collect AttributeWildcards of children.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
private AttributeWildcard
calcCompleteWildcard(AttributeWildcard local, Set<AttributeWildcard> s)

Computes the "complete attribute wildcard"

private AttributeWildcard
public static void
private void
compute(Expression topLevel)

public void
public void
private void
propagateAttributes(final ComplexTypeExp cexp)

Computes the propagated attributes.

Inherited from com.sun.msv.grammar.util.ExpressionWalker:
onAnyStringonAttributeonBinExponChoiceonConcuronDataonEpsilononInterleaveonListonMixedonNullSetonOneOrMoreonOtheronSequenceonValue

Field Detail

readerback to summary
private final XMLSchemaReader reader
unprocessedElementExpsback to summary
private final Stack<Expression> unprocessedElementExps
visitedExpsback to summary
private final Set<Expression> visitedExps

Visited ElementExps and ReferenceExps to prevent infinite recursion.

wildcardsback to summary
private Set<AttributeWildcard> wildcards

Used to collect AttributeWildcards of children.

Constructor Detail

AttributeWildcardComputerback to summary
protected AttributeWildcardComputer(XMLSchemaReader _reader)

Method Detail

calcCompleteWildcardback to summary
private AttributeWildcard calcCompleteWildcard(AttributeWildcard local, Set<AttributeWildcard> s)

Computes the "complete attribute wildcard"

calcComplexTypeWildcardback to summary
private AttributeWildcard calcComplexTypeWildcard(AttributeWildcard complete, AttributeWildcard base)
computeback to summary
public static void compute(XMLSchemaReader reader, Expression topLevel)
computeback to summary
private void compute(Expression topLevel)
onElementback to summary
public void onElement(ElementExp exp)

Overrides com.sun.msv.grammar.util.ExpressionWalker.onElement.

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onElement.

onRefback to summary
public void onRef(ReferenceExp exp)

Overrides com.sun.msv.grammar.util.ExpressionWalker.onRef.

Implements com.sun.msv.grammar.ExpressionVisitorVoid.onRef.

propagateAttributesback to summary
private void propagateAttributes(final ComplexTypeExp cexp)

Computes the propagated attributes.