|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.XMLFilterImpl
com.sun.tools.xjc.reader.xmlschema.parser.CustomizationContextChecker
public class CustomizationContextChecker
Checks if binding declarations are placed where they are allowed.
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)
Constructor Summary | |
---|---|
CustomizationContextChecker(ErrorHandler _errorHandler)
|
Method Summary | |
---|---|
void |
endElement(String namespaceURI,
String localName,
String qName)
|
void |
setDocumentLocator(Locator locator)
|
void |
startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
|
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl |
---|
characters, endDocument, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, parse, processingInstruction, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CustomizationContextChecker(ErrorHandler _errorHandler)
_errorHandler
- Detected errors will be sent to this object.Method Detail |
---|
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
startElement
in interface ContentHandler
startElement
in class XMLFilterImpl
SAXException
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class XMLFilterImpl
SAXException
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in class XMLFilterImpl
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |