ExpressionWalker is used to walk the content model thoroughly. Depending on the current context, different walkers are used so that we can detect contextual restrictions properly.
For each ElementExp and AttributeExp, its name class is checked to detect the constraint set out in the section 7.1.6. Also, a set is used to avoid redundant checks.
| Modifier and Type | Class and Description |
|---|---|
| private class | RestrictionChecker.DefaultChecker
The base class of all other context-specific checker. |
| private class | |
| private class | |
| protected abstract class | |
| private class | |
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| private RestrictionChecker. | attDupChecker
Object that checks duplicate attributes in a content model. |
| private RestrictionChecker. | elemDupChecker
Object that checks conflicting elements in interleave. |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private Expression | errorContext
The source location of this expression should be also reported in case of error. |
| private final NameClassVisitor | inAnyNameClass
Used to visit children of AnyNameClass |
| private final ExpressionWalker | inAttribute
Used to visit children of attributes. |
| private final ExpressionWalker | inElement
Used to visit children of elements. |
| private final ExpressionWalker | inExcept
Used to visit children of the 'except' clause of data. |
| private final ExpressionWalker | inGroupInOneOrMoreInElement
Used to visit children of group/interleave in oneOrMore in elements. |
| private final ExpressionWalker | inInterleaveInList
Used to visit children of interleaves in lists. |
| private final ExpressionWalker | inList
Used to visit children of lists. |
| private final RestrictionChecker. | inNameClass
Used to visit name classes. |
| private final NameClassVisitor | inNsNameClass
Used to visit children of NamespaceNameClass |
| private final ExpressionWalker | inOneOrMoreInElement
Used to visit children of oneOrMore in elements. |
| private final ExpressionWalker | inStart
Used to visit the start pattern. |
| private final RELAXNGReader | reader
Reader object to which errors are reported. |
| private final Set | visitedExps
Visited ElementExp/AttributeExps. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| private void | |
| private void |
| attDupChecker | back to summary |
|---|---|
| private RestrictionChecker. Object that checks duplicate attributes in a content model. | |
| elemDupChecker | back to summary |
|---|---|
| private RestrictionChecker. Object that checks conflicting elements in interleave. | |
| ERR_ANYNAME_IN_ANYNAME | back to summary |
|---|---|
| private static final String ERR_ANYNAME_IN_ANYNAME | |
| ERR_ANYNAME_IN_NSNAME | back to summary |
|---|---|
| private static final String ERR_ANYNAME_IN_NSNAME | |
| ERR_ATTRIBUTE_IN_ATTRIBUTE | back to summary |
|---|---|
| private static final String ERR_ATTRIBUTE_IN_ATTRIBUTE | |
| ERR_ATTRIBUTE_IN_EXCEPT | back to summary |
|---|---|
| private static final String ERR_ATTRIBUTE_IN_EXCEPT | |
| ERR_ATTRIBUTE_IN_LIST | back to summary |
|---|---|
| private static final String ERR_ATTRIBUTE_IN_LIST | |
| ERR_ATTRIBUTE_IN_START | back to summary |
|---|---|
| private static final String ERR_ATTRIBUTE_IN_START | |
| ERR_DATA_IN_INTERLEAVE_IN_LIST | back to summary |
|---|---|
| private static final String ERR_DATA_IN_INTERLEAVE_IN_LIST | |
| ERR_DATA_IN_START | back to summary |
|---|---|
| private static final String ERR_DATA_IN_START | |
| ERR_DUPLICATE_ATTRIBUTES | back to summary |
|---|---|
| private static final String ERR_DUPLICATE_ATTRIBUTES | |
| ERR_DUPLICATE_ELEMENTS | back to summary |
|---|---|
| private static final String ERR_DUPLICATE_ELEMENTS | |
| ERR_ELEMENT_IN_ATTRIBUTE | back to summary |
|---|---|
| private static final String ERR_ELEMENT_IN_ATTRIBUTE | |
| ERR_ELEMENT_IN_EXCEPT | back to summary |
|---|---|
| private static final String ERR_ELEMENT_IN_EXCEPT | |
| ERR_ELEMENT_IN_LIST | back to summary |
|---|---|
| private static final String ERR_ELEMENT_IN_LIST | |
| ERR_EMPTY_IN_EXCEPT | back to summary |
|---|---|
| private static final String ERR_EMPTY_IN_EXCEPT | |
| ERR_EMPTY_IN_START | back to summary |
|---|---|
| private static final String ERR_EMPTY_IN_START | |
| ERR_INTERLEAVE_IN_EXCEPT | back to summary |
|---|---|
| private static final String ERR_INTERLEAVE_IN_EXCEPT | |
| ERR_INTERLEAVE_IN_START | back to summary |
|---|---|
| private static final String ERR_INTERLEAVE_IN_START | |
| ERR_LIST_IN_EXCEPT | back to summary |
|---|---|
| private static final String ERR_LIST_IN_EXCEPT | |
| ERR_LIST_IN_LIST | back to summary |
|---|---|
| private static final String ERR_LIST_IN_LIST | |
| ERR_LIST_IN_START | back to summary |
|---|---|
| private static final String ERR_LIST_IN_START | |
| ERR_NSNAME_IN_NSNAME | back to summary |
|---|---|
| private static final String ERR_NSNAME_IN_NSNAME | |
| ERR_ONEORMORE_IN_EXCEPT | back to summary |
|---|---|
| private static final String ERR_ONEORMORE_IN_EXCEPT | |
| ERR_ONEORMORE_IN_START | back to summary |
|---|---|
| private static final String ERR_ONEORMORE_IN_START | |
| ERR_REPEATED_GROUPED_ATTRIBUTE | back to summary |
|---|---|
| private static final String ERR_REPEATED_GROUPED_ATTRIBUTE | |
| ERR_SEQUENCE_IN_EXCEPT | back to summary |
|---|---|
| private static final String ERR_SEQUENCE_IN_EXCEPT | |
| ERR_SEQUENCE_IN_START | back to summary |
|---|---|
| private static final String ERR_SEQUENCE_IN_START | |
| ERR_TEXT_IN_EXCEPT | back to summary |
|---|---|
| private static final String ERR_TEXT_IN_EXCEPT | |
| ERR_TEXT_IN_LIST | back to summary |
|---|---|
| private static final String ERR_TEXT_IN_LIST | |
| ERR_TEXT_IN_START | back to summary |
|---|---|
| private static final String ERR_TEXT_IN_START | |
| ERR_VALUE_IN_INTERLEAVE_IN_LIST | back to summary |
|---|---|
| private static final String ERR_VALUE_IN_INTERLEAVE_IN_LIST | |
| errorContext | back to summary |
|---|---|
| private Expression errorContext The source location of this expression should be also reported in case of error. | |
| inAnyNameClass | back to summary |
|---|---|
| private final NameClassVisitor inAnyNameClass Used to visit children of AnyNameClass | |
| inAttribute | back to summary |
|---|---|
| private final ExpressionWalker inAttribute Used to visit children of attributes. | |
| inElement | back to summary |
|---|---|
| private final ExpressionWalker inElement Used to visit children of elements. | |
| inExcept | back to summary |
|---|---|
| private final ExpressionWalker inExcept Used to visit children of the 'except' clause of data. | |
| inGroupInOneOrMoreInElement | back to summary |
|---|---|
| private final ExpressionWalker inGroupInOneOrMoreInElement Used to visit children of group/interleave in oneOrMore in elements. | |
| inInterleaveInList | back to summary |
|---|---|
| private final ExpressionWalker inInterleaveInList Used to visit children of interleaves in lists. | |
| inList | back to summary |
|---|---|
| private final ExpressionWalker inList Used to visit children of lists. | |
| inNameClass | back to summary |
|---|---|
| private final RestrictionChecker. Used to visit name classes. | |
| inNsNameClass | back to summary |
|---|---|
| private final NameClassVisitor inNsNameClass Used to visit children of NamespaceNameClass | |
| inOneOrMoreInElement | back to summary |
|---|---|
| private final ExpressionWalker inOneOrMoreInElement Used to visit children of oneOrMore in elements. | |
| inStart | back to summary |
|---|---|
| private final ExpressionWalker inStart Used to visit the start pattern. | |
| reader | back to summary |
|---|---|
| private final RELAXNGReader reader Reader object to which errors are reported. | |
| visitedExps | back to summary |
|---|---|
| private final Set<Expression> visitedExps Visited ElementExp/AttributeExps. | |
| RestrictionChecker | back to summary |
|---|---|
| public RestrictionChecker(RELAXNGReader _reader) | |
| check | back to summary |
|---|---|
| public void check() Traverses the grammar and performs the contextual check. | |
| checkNameClass | back to summary |
|---|---|
| public void checkNameClass(NameClass nc) Checks the contextual restriction on a name class. If an error is found, it is reported through GrammarReader. | |
| reportError | back to summary |
|---|---|
| private void reportError(Expression exp, String errorMsg) | |
| reportError | back to summary |
|---|---|
| private void reportError(Expression exp, String errorMsg, Object[] args) | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| public void | |
| public void | |
| public void | onChoice(ChoiceExp exp)
Overrides com. Implements com. |
| public void | onData(DataExp exp)
Overrides com. Implements com. |
| public void | |
| public void | |
| public void | onList(ListExp exp)
Overrides com. Implements com. |
| DefaultChecker | back to summary |
|---|---|
| private DefaultChecker() | |
| checkAttributeInfiniteName | back to summary |
|---|---|
| protected void checkAttributeInfiniteName(final AttributeExp exp) | |
| onAnyString | back to summary |
|---|---|
| public void onAnyString() Overrides com. Implements com. | |
| onAttribute | back to summary |
|---|---|
| public void onAttribute(AttributeExp exp) Overrides com. Implements com. | |
| onChoice | back to summary |
|---|---|
| public void onChoice(ChoiceExp exp) Overrides com. Implements com. | |
| onData | back to summary |
|---|---|
| public void onData(DataExp exp) Overrides com. Implements com. | |
| onElement | back to summary |
|---|---|
| public void onElement(ElementExp exp) Overrides com. Implements com. | |
| onInterleave | back to summary |
|---|---|
| public void onInterleave(InterleaveExp exp) Overrides com. Implements com. | |
| onList | back to summary |
|---|---|
| public void onList(ListExp exp) Overrides com. Implements com. | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| protected void | check(NameClassAndExpression exp)
Implements abstract com. |
| protected String | getErrorMessage()
Implements abstract com. |
| DuplicateAttributesChecker | back to summary |
|---|---|
| private DuplicateAttributesChecker() | |
| check | back to summary |
|---|---|
| protected void check(NameClassAndExpression exp) Implements abstract com. Doc from com. tests a given exp against existing expressions (which are stored in the exps field.) | |
| getErrorMessage | back to summary |
|---|---|
| protected String getErrorMessage() Implements abstract com. Doc from com. Gets the error message resource name. | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| protected void | check(NameClassAndExpression exp)
Implements abstract com. |
| protected String | getErrorMessage()
Implements abstract com. |
| DuplicateElementsChecker | back to summary |
|---|---|
| private DuplicateElementsChecker() | |
| check | back to summary |
|---|---|
| protected void check(NameClassAndExpression exp) Implements abstract com. Doc from com. tests a given exp against existing expressions (which are stored in the exps field.) | |
| getErrorMessage | back to summary |
|---|---|
| protected String getErrorMessage() Implements abstract com. Doc from com. Gets the error message resource name. | |
| Modifier and Type | Field and Description |
|---|---|
| protected int | |
| protected int[] | areas
areas. |
| private final NameClassCollisionChecker | checker
Name class checker object. |
| protected NameClassAndExpression[] | exps
ElementExps will be added into this array. |
| protected int | expsLen
Number of items in the atts array. |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| protected abstract void | check(NameClassAndExpression exp)
tests a given exp against existing expressions (which are stored in the exps field.) |
| protected void | check(NameClassAndExpression newExp, NameClassAndExpression oldExp)
Tests two name classes to see if they collide. |
| public void | |
| public void | |
| protected abstract String | |
| public int |
| areaLen | back to summary |
|---|---|
| protected int areaLen | |
| areas | back to summary |
|---|---|
| protected int[] areas areas. An area is a range of index designated by the start and end. Areas are stored as: { start, end, start, end, ... }
The start method gives the index. The endLeftBranch method creates an area by using the start index given by the start method. The endRightBranch method will remove the area. When testing duplicate attributes, areas are created by ChoiceExp and used to exclude test candidates (as two attributes can share the same name if they are in different branches of choice.) When testing duplicate elements, areas are created by InterleaveExp and used to include test candidates (as two elements cannot share the same name if they are in different branches of interleave.) | |
| checker | back to summary |
|---|---|
| private final NameClassCollisionChecker checker Name class checker object. One object is reused throughout the test. | |
| exps | back to summary |
|---|---|
| protected NameClassAndExpression[] exps ElementExps will be added into this array. | |
| expsLen | back to summary |
|---|---|
| protected int expsLen Number of items in the atts array. | |
| DuplicateNameChecker | back to summary |
|---|---|
| protected DuplicateNameChecker() | |
| add | back to summary |
|---|---|
| public void add(NameClassAndExpression exp) Adds newly found element or attribute. | |
| check | back to summary |
|---|---|
| protected abstract void check(NameClassAndExpression exp) tests a given exp against existing expressions (which are stored in the exps field.) | |
| check | back to summary |
|---|---|
| protected void check(NameClassAndExpression newExp, NameClassAndExpression oldExp) Tests two name classes to see if they collide. | |
| endLeftBranch | back to summary |
|---|---|
| public void endLeftBranch(int start) | |
| endRightBranch | back to summary |
|---|---|
| public void endRightBranch() | |
| getErrorMessage | back to summary |
|---|---|
| protected abstract String getErrorMessage() Gets the error message resource name. | |
| start | back to summary |
|---|---|
| public int start() | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | |
| public void |
| ListChecker | back to summary |
|---|---|
| private ListChecker() | |
| onAnyString | back to summary |
|---|---|
| public void onAnyString() Overrides com. Implements com. | |
| onAttribute | back to summary |
|---|---|
| public void onAttribute(AttributeExp exp) Overrides com. Implements com. | |
| onElement | back to summary |
|---|---|
| public void onElement(ElementExp exp) Overrides com. Implements com. | |
| onList | back to summary |
|---|---|
| public void onList(ListExp exp) Overrides com. Implements com. | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Object | |
| public Object | |
| public Object | |
| public Object | |
| public Object | |
| public Object |
| NameClassWalker | back to summary |
|---|---|
| pack-priv NameClassWalker() | |
| onAnyName | back to summary |
|---|---|
| public Object onAnyName(AnyNameClass nc) Implements com. | |
| onChoice | back to summary |
|---|---|
| public Object onChoice(ChoiceNameClass nc) Implements com. | |
| onDifference | back to summary |
|---|---|
| public Object onDifference(DifferenceNameClass nc) Implements com. | |
| onNot | back to summary |
|---|---|
| public Object onNot(NotNameClass nc) Implements com. | |
| onNsName | back to summary |
|---|---|
| public Object onNsName(NamespaceNameClass nc) Implements com. | |
| onSimple | back to summary |
|---|---|
| public Object onSimple(SimpleNameClass nc) Implements com. | |