Class AbstractExtensionBindingChecker

  • 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
    Direct Known Subclasses:
    ExtensionBindingChecker

    public abstract class AbstractExtensionBindingChecker
    extends SubtreeCutter
    Common code between DTDExtensionBindingChecker and ExtensionBindingChecker.
    Author:
    Kohsuke Kawaguchi
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean allowExtensions
      If false, any use of extensions is reported as an error.
      protected java.util.Set<java.lang.String> enabledExtensions
      Set of namespace URIs that designates enabled extensions.
      protected org.xml.sax.helpers.NamespaceSupport nsSupport
      Remembers in-scope namespace bindings.
      protected java.lang.String schemaLanguage
      Namespace URI of the target schema language.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void checkAndEnable​(java.lang.String uri)
      Verify that the given URI is indeed a valid extension namespace URI, and if so enable it.
      void endPrefixMapping​(java.lang.String prefix)  
      protected org.xml.sax.SAXParseException error​(java.lang.String msg)
      Reports an error and returns the created SAXParseException
      protected boolean isRecognizableExtension​(java.lang.String namespaceUri)
      Checks if the given namespace URI can be potentially recognized by this XJC.
      protected boolean isSupportedExtension​(java.lang.String namespaceUri)
      Checks if the given namespace URI is supported as the extension bindings.
      void setDocumentLocator​(org.xml.sax.Locator locator)  
      void startDocument()  
      void startPrefixMapping​(java.lang.String prefix, java.lang.String uri)  
      protected void verifyTagName​(java.lang.String namespaceURI, java.lang.String localName, java.lang.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​(java.lang.String msg)
      Reports a warning.
      • 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 org.xml.sax.helpers.NamespaceSupport nsSupport
        Remembers in-scope namespace bindings.
      • enabledExtensions

        protected final java.util.Set<java.lang.String> enabledExtensions
        Set of namespace URIs that designates enabled extensions.
      • schemaLanguage

        protected final java.lang.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​(java.lang.String schemaLanguage,
                                               Options options,
                                               org.xml.sax.ErrorHandler handler)
        Parameters:
        handler - This error handler will receive detected errors.
    • Method Detail

      • checkAndEnable

        protected final void checkAndEnable​(java.lang.String uri)
                                     throws org.xml.sax.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:
        org.xml.sax.SAXException
      • verifyTagName

        protected final void verifyTagName​(java.lang.String namespaceURI,
                                           java.lang.String localName,
                                           java.lang.String qName)
                                    throws org.xml.sax.SAXException
        If the tag name belongs to a plugin namespace-wise, check its local name to make sure it's correct.
        Throws:
        org.xml.sax.SAXException
      • isSupportedExtension

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

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

        public void setDocumentLocator​(org.xml.sax.Locator locator)
        Specified by:
        setDocumentLocator in interface org.xml.sax.ContentHandler
        Overrides:
        setDocumentLocator in class org.xml.sax.helpers.XMLFilterImpl
      • startDocument

        public void startDocument()
                           throws org.xml.sax.SAXException
        Specified by:
        startDocument in interface org.xml.sax.ContentHandler
        Overrides:
        startDocument in class SubtreeCutter
        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 interface org.xml.sax.ContentHandler
        Overrides:
        startPrefixMapping in class org.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 interface org.xml.sax.ContentHandler
        Overrides:
        endPrefixMapping in class org.xml.sax.helpers.XMLFilterImpl
        Throws:
        org.xml.sax.SAXException
      • error

        protected final org.xml.sax.SAXParseException error​(java.lang.String msg)
                                                     throws org.xml.sax.SAXException
        Reports an error and returns the created SAXParseException
        Throws:
        org.xml.sax.SAXException
      • warning

        protected final void warning​(java.lang.String msg)
                              throws org.xml.sax.SAXException
        Reports a warning.
        Throws:
        org.xml.sax.SAXException