Class IncorrectNamespaceURIChecker
- java.lang.Object
-
- org.xml.sax.helpers.XMLFilterImpl
-
- com.sun.tools.xjc.reader.xmlschema.parser.IncorrectNamespaceURIChecker
-
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
,XMLFilter
,XMLReader
public class IncorrectNamespaceURIChecker extends XMLFilterImpl
This filter detects the use of incorrect JAXB namespace URI. When the binding compiler looks at a schema file, it always look for the namespace URI of the elements (which is correct, BTW.)However, one unfortunate downside of this philosophically correct behavior is that there is no provision or safety check when an user misspelled JAXB binding customization namespace.
This checker inspects the input document and look for the use of the prefix "jaxb". If the document doesn't associate any prefix to the JAXB customization URI and if it does associate the jaxb prefix, this checker will issue a warning.
This warning can happen to completely correct schema (because nothing prevents you from using the prefix "jaxb" for other purpose while using a JAXB compiler on the same schema) but in practice this would be quite unlikely.
This justifies the use of this filter.
- Author:
- Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
-
-
Constructor Summary
Constructors Constructor Description IncorrectNamespaceURIChecker(ErrorHandler handler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
endDocument()
void
endPrefixMapping(String prefix)
void
setDocumentLocator(Locator locator)
void
startElement(String namespaceURI, String localName, String qName, Attributes atts)
void
startPrefixMapping(String prefix, String uri)
-
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
characters, endElement, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, parse, processingInstruction, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, unparsedEntityDecl, warning
-
-
-
-
Constructor Detail
-
IncorrectNamespaceURIChecker
public IncorrectNamespaceURIChecker(ErrorHandler handler)
-
-
Method Detail
-
endDocument
public void endDocument() throws SAXException
- Specified by:
endDocument
in interfaceContentHandler
- Overrides:
endDocument
in classXMLFilterImpl
- Throws:
SAXException
-
startPrefixMapping
public void startPrefixMapping(String prefix, String uri) throws SAXException
- Specified by:
startPrefixMapping
in interfaceContentHandler
- Overrides:
startPrefixMapping
in classXMLFilterImpl
- Throws:
SAXException
-
endPrefixMapping
public void endPrefixMapping(String prefix) throws SAXException
- Specified by:
endPrefixMapping
in interfaceContentHandler
- Overrides:
endPrefixMapping
in classXMLFilterImpl
- Throws:
SAXException
-
startElement
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
- Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classXMLFilterImpl
- Throws:
SAXException
-
setDocumentLocator
public void setDocumentLocator(Locator locator)
- Specified by:
setDocumentLocator
in interfaceContentHandler
- Overrides:
setDocumentLocator
in classXMLFilterImpl
-
-