Class IncorrectNamespaceURIChecker
- java.lang.Object
-
- org.xml.sax.helpers.XMLFilterImpl
-
- com.sun.tools.xjc.reader.xmlschema.parser.IncorrectNamespaceURIChecker
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
,org.xml.sax.XMLFilter
,org.xml.sax.XMLReader
public class IncorrectNamespaceURIChecker extends org.xml.sax.helpers.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(org.xml.sax.ErrorHandler handler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
endDocument()
void
endPrefixMapping(java.lang.String prefix)
void
setDocumentLocator(org.xml.sax.Locator locator)
void
startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
void
startPrefixMapping(java.lang.String prefix, java.lang.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
-
-
-
-
Method Detail
-
endDocument
public void endDocument() throws org.xml.sax.SAXException
- Specified by:
endDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endDocument
in classorg.xml.sax.helpers.XMLFilterImpl
- Throws:
org.xml.sax.SAXException
-
startPrefixMapping
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
- Specified by:
startPrefixMapping
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startPrefixMapping
in classorg.xml.sax.helpers.XMLFilterImpl
- Throws:
org.xml.sax.SAXException
-
endPrefixMapping
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
- Specified by:
endPrefixMapping
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endPrefixMapping
in classorg.xml.sax.helpers.XMLFilterImpl
- Throws:
org.xml.sax.SAXException
-
startElement
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classorg.xml.sax.helpers.XMLFilterImpl
- Throws:
org.xml.sax.SAXException
-
setDocumentLocator
public void setDocumentLocator(org.xml.sax.Locator locator)
- Specified by:
setDocumentLocator
in interfaceorg.xml.sax.ContentHandler
- Overrides:
setDocumentLocator
in classorg.xml.sax.helpers.XMLFilterImpl
-
-