Package com.sun.tools.xjc.reader
Class AbstractExtensionBindingChecker
- java.lang.Object
-
- org.xml.sax.helpers.XMLFilterImpl
-
- com.sun.tools.xjc.util.SubtreeCutter
-
- com.sun.tools.xjc.reader.AbstractExtensionBindingChecker
-
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
,XMLFilter
,XMLReader
- Direct Known Subclasses:
ExtensionBindingChecker
public abstract class AbstractExtensionBindingChecker extends SubtreeCutter
Common code betweenDTDExtensionBindingChecker
andExtensionBindingChecker
.- 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 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
Constructors Constructor Description AbstractExtensionBindingChecker(String schemaLanguage, Options options, ErrorHandler handler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 SAXParseExceptionprotected 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
-
-
-
-
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 interfaceContentHandler
- Overrides:
setDocumentLocator
in classXMLFilterImpl
-
startDocument
public void startDocument() throws SAXException
- Specified by:
startDocument
in interfaceContentHandler
- Overrides:
startDocument
in classSubtreeCutter
- 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
-
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
-
-