com.sun.tools.xjc.reader
Class AbstractExtensionBindingChecker

java.lang.Object
  extended by org.xml.sax.helpers.XMLFilterImpl
      extended by com.sun.tools.xjc.util.SubtreeCutter
          extended by com.sun.tools.xjc.reader.AbstractExtensionBindingChecker
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, XMLFilter, XMLReader
Direct Known Subclasses:
DTDExtensionBindingChecker, ExtensionBindingChecker

public abstract class AbstractExtensionBindingChecker
extends SubtreeCutter

Common code between DTDExtensionBindingChecker and ExtensionBindingChecker.


Field Summary
protected  boolean allowExtensions
          If false, any use of extensions is reported as an error.
protected  Set<String> enabledExtensions
          Set of namespace URIs that designates enabled extensions.
protected  NamespaceSupport nsSupport
          Remembers in-scope namespace bindings.
protected  String schemaLanguage
          Namespace URI of the target schema language.
 
Constructor Summary
AbstractExtensionBindingChecker(String schemaLanguage, Options options, ErrorHandler handler)
           
 
Method Summary
protected  void checkAndEnable(String uri)
          Verify that the given URI is indeed a valid extension namespace URI, and if so enable it.
 void endPrefixMapping(String prefix)
           
protected  SAXParseException error(String msg)
          Reports an error and returns the created SAXParseException
protected  boolean isRecognizableExtension(String namespaceUri)
          Checks if the given namespace URI can be potentially recognized by this XJC.
protected  boolean isSupportedExtension(String namespaceUri)
          Checks if the given namespace URI is supported as the extension bindings.
 void setDocumentLocator(Locator locator)
           
 void startDocument()
           
 void startPrefixMapping(String prefix, String uri)
           
protected  void verifyTagName(String namespaceURI, String localName, String qName)
          If the tag name belongs to a plugin namespace-wise, check its local name to make sure it's correct.
protected  void warning(String msg)
          Reports a warning.
 
Methods inherited from class com.sun.tools.xjc.util.SubtreeCutter
endElement, isCutting, setContentHandler, startCutting, startElement
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
characters, endDocument, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, parse, processingInstruction, resolveEntity, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nsSupport

protected final NamespaceSupport nsSupport
Remembers in-scope namespace bindings.


enabledExtensions

protected final Set<String> enabledExtensions
Set of namespace URIs that designates enabled extensions.


schemaLanguage

protected final String schemaLanguage
Namespace URI of the target schema language. Elements in this namespace are always allowed.


allowExtensions

protected final boolean allowExtensions
If false, any use of extensions is reported as an error.

Constructor Detail

AbstractExtensionBindingChecker

public AbstractExtensionBindingChecker(String schemaLanguage,
                                       Options options,
                                       ErrorHandler handler)
Parameters:
handler - This error handler will receive detected errors.
Method Detail

checkAndEnable

protected final void checkAndEnable(String uri)
                             throws SAXException
Verify that the given URI is indeed a valid extension namespace URI, and if so enable it.

This method does all the error handling.

Throws:
SAXException

verifyTagName

protected final void verifyTagName(String namespaceURI,
                                   String localName,
                                   String qName)
                            throws SAXException
If the tag name belongs to a plugin namespace-wise, check its local name to make sure it's correct.

Throws:
SAXException

isSupportedExtension

protected final boolean isSupportedExtension(String namespaceUri)
Checks if the given namespace URI is supported as the extension bindings.


isRecognizableExtension

protected final boolean isRecognizableExtension(String namespaceUri)
Checks if the given namespace URI can be potentially recognized by this XJC.


setDocumentLocator

public void setDocumentLocator(Locator locator)
Specified by:
setDocumentLocator in interface ContentHandler
Overrides:
setDocumentLocator in class XMLFilterImpl

startDocument

public void startDocument()
                   throws SAXException
Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class SubtreeCutter
Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Specified by:
startPrefixMapping in interface ContentHandler
Overrides:
startPrefixMapping in class XMLFilterImpl
Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Specified by:
endPrefixMapping in interface ContentHandler
Overrides:
endPrefixMapping in class XMLFilterImpl
Throws:
SAXException

error

protected final SAXParseException error(String msg)
                                 throws SAXException
Reports an error and returns the created SAXParseException

Throws:
SAXException

warning

protected final void warning(String msg)
                      throws SAXException
Reports a warning.

Throws:
SAXException