Top Description Fields Constructors Methods
com.sun.tools.xjc.reader.xmlschema.parser

public Class IncorrectNamespaceURIChecker

extends XMLFilterImpl
Class Inheritance
Imports
com.sun.tools.xjc.reader.Const, org.xml.sax.Attributes, .ErrorHandler, .Locator, .SAXException, .SAXParseException, org.xml.sax.helpers.XMLFilterImpl, javax.xml.XMLConstants

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 ([email protected])

Field Summary

Modifier and TypeField and Description
private ErrorHandler
private boolean
isCustomizationUsed

Sets to true once we see the JAXB customization namespace URI.

private boolean
isJAXBPrefixUsed

Sets to true once we see the jaxb prefix in use.

private Locator

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
endPrefixMapping(String prefix)

Overrides org.xml.sax.helpers.XMLFilterImpl.endPrefixMapping.

Implements org.xml.sax.ContentHandler.endPrefixMapping.

Filter an end Namespace prefix mapping event.

public void
public void
startElement(String namespaceURI, String localName, String qName, Attributes atts)

Overrides org.xml.sax.helpers.XMLFilterImpl.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Filter a start element event.

public void
startPrefixMapping(String prefix, String uri)

Overrides org.xml.sax.helpers.XMLFilterImpl.startPrefixMapping.

Implements org.xml.sax.ContentHandler.startPrefixMapping.

Filter a start Namespace prefix mapping event.

Inherited from org.xml.sax.helpers.XMLFilterImpl:
charactersendElementerrorfatalErrorgetContentHandlergetDTDHandlergetEntityResolvergetErrorHandlergetFeaturegetParentgetPropertyignorableWhitespacenotationDeclparseparseprocessingInstructionresolveEntitysetContentHandlersetDTDHandlersetEntityResolversetErrorHandlersetFeaturesetParentsetPropertyskippedEntitystartDocumentunparsedEntityDeclwarning

Field Detail

errorHandlerback to summary
private ErrorHandler errorHandler

Hides org.xml.sax.helpers.XMLFilterImpl.errorHandler.

isCustomizationUsedback to summary
private boolean isCustomizationUsed

Sets to true once we see the JAXB customization namespace URI.

isJAXBPrefixUsedback to summary
private boolean isJAXBPrefixUsed

Sets to true once we see the jaxb prefix in use.

locatorback to summary
private Locator locator

Hides org.xml.sax.helpers.XMLFilterImpl.locator.

Constructor Detail

IncorrectNamespaceURICheckerback to summary
public IncorrectNamespaceURIChecker(ErrorHandler handler)

Method Detail

endDocumentback to summary
public void endDocument() throws SAXException

Overrides org.xml.sax.helpers.XMLFilterImpl.endDocument.

Implements org.xml.sax.ContentHandler.endDocument.

Doc from org.xml.sax.helpers.XMLFilterImpl.endDocument.

Filter an end document event.

Annotations
@Override
Exceptions
SAXException:
The client may throw an exception during processing.
endPrefixMappingback to summary
public void endPrefixMapping(String prefix) throws SAXException

Overrides org.xml.sax.helpers.XMLFilterImpl.endPrefixMapping.

Implements org.xml.sax.ContentHandler.endPrefixMapping.

Doc from org.xml.sax.helpers.XMLFilterImpl.endPrefixMapping.

Filter an end Namespace prefix mapping event.

Annotations
@Override
Exceptions
SAXException:
The client may throw an exception during processing.
setDocumentLocatorback to summary
public void setDocumentLocator(Locator locator)

Overrides org.xml.sax.helpers.XMLFilterImpl.setDocumentLocator.

Implements org.xml.sax.ContentHandler.setDocumentLocator.

Doc from org.xml.sax.helpers.XMLFilterImpl.setDocumentLocator.

Filter a new document locator event.

Annotations
@Override
startElementback to summary
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException

Overrides org.xml.sax.helpers.XMLFilterImpl.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Doc from org.xml.sax.helpers.XMLFilterImpl.startElement.

Filter a start element event.

Annotations
@Override
Exceptions
SAXException:
The client may throw an exception during processing.
startPrefixMappingback to summary
public void startPrefixMapping(String prefix, String uri) throws SAXException

Overrides org.xml.sax.helpers.XMLFilterImpl.startPrefixMapping.

Implements org.xml.sax.ContentHandler.startPrefixMapping.

Doc from org.xml.sax.helpers.XMLFilterImpl.startPrefixMapping.

Filter a start Namespace prefix mapping event.

Annotations
@Override
Exceptions
SAXException:
The client may throw an exception during processing.