For example, if a <jaxb:property> customization is given under
the <xs:simpleContent> element, this class raises an error.
our main checkpoint of misplaced customizations are in BGMBuilder. There, we mark a customization whenever we use it. At the end of the day, we look for unmarked customizations and raise errors for them.
Between this approach and the JAXB spec 1.0 is a problem that the spec allows/prohibits customizations at schema element level, while BGMBuilder and XSOM works on schema component levels.
For example, a property customization is allowed on a complex type
schema component, but it's only allowed on the <complexType>
element. The spec team informed us that they would consider resolving
this discrepancy in favor of RI, but meanwhile we need to detect
errors correctly.
This filter is implemented for this purpose.
For simple types, customizations are allowed only under the <xs:simpleType>
element, and for complex types they are allowed only under the
<xs:cimplexType> element.
So the bottom line is that it would be suffice if we just make sure that no customization will be attached under other elements of simple types and complex types. Those are: - simpleType/restriction - list - union - complexType/(simple or complex)Content - complexType/(simple or complex)Content/(restriction of extension)
| Modifier and Type | Field and Description |
|---|---|
| private final Stack | elementNames
Keep names of all the ancestor elements. |
| private final ErrorHandler | |
| private Locator | |
| private static final Set | prohibitedSchemaElementNames
Set of element names that cannot have JAXB customizations. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | endElement(String namespaceURI, String localName, String qName)
Overrides org. Implements org. Filter an end element event. |
| public void | setDocumentLocator(Locator locator)
Overrides org. Implements org. Filter a new document locator event. |
| public void | startElement(String namespaceURI, String localName, String qName, Attributes atts)
Overrides org. Implements org. Filter a start element event. |
| private QName |
| elementNames | back to summary |
|---|---|
| private final Stack<QName> elementNames Keep names of all the ancestor elements. | |
| errorHandler | back to summary |
|---|---|
| private final ErrorHandler errorHandler | |
| locator | back to summary |
|---|---|
| private Locator locator | |
| prohibitedSchemaElementNames | back to summary |
|---|---|
| private static final Set<String> prohibitedSchemaElementNames Set of element names that cannot have JAXB customizations. | |
| CustomizationContextChecker | back to summary |
|---|---|
public CustomizationContextChecker(ErrorHandler _errorHandler)
| |
| endElement | back to summary |
|---|---|
| public void endElement(String namespaceURI, String localName, String qName) throws SAXException Overrides org. Implements org. Doc from org. Filter an end element event.
| |
| setDocumentLocator | back to summary |
|---|---|
| public void setDocumentLocator(Locator locator) Overrides org. Implements org. Doc from org. Filter a new document locator event.
| |
| startElement | back to summary |
|---|---|
| public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException Overrides org. Implements org. Doc from org. Filter a start element event.
| |
| top | back to summary |
|---|---|
| private QName top() Gets the stack top. | |