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 betweenDTDExtensionBindingCheckerandExtensionBindingChecker.- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanallowExtensionsIf false, any use of extensions is reported as an error.protected Set<String>enabledExtensionsSet of namespace URIs that designates enabled extensions.protected NamespaceSupportnsSupportRemembers in-scope namespace bindings.protected StringschemaLanguageNamespace 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 voidcheckAndEnable(String uri)Verify that the given URI is indeed a valid extension namespace URI, and if so enable it.voidendPrefixMapping(String prefix)protected SAXParseExceptionerror(String msg)Reports an error and returns the created SAXParseExceptionprotected booleanisRecognizableExtension(String namespaceUri)Checks if the given namespace URI can be potentially recognized by this XJC.protected booleanisSupportedExtension(String namespaceUri)Checks if the given namespace URI is supported as the extension bindings.voidsetDocumentLocator(Locator locator)voidstartDocument()voidstartPrefixMapping(String prefix, String uri)protected voidverifyTagName(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 voidwarning(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:
setDocumentLocatorin interfaceContentHandler- Overrides:
setDocumentLocatorin classXMLFilterImpl
-
startDocument
public void startDocument() throws SAXException- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classSubtreeCutter- Throws:
SAXException
-
startPrefixMapping
public void startPrefixMapping(String prefix, String uri) throws SAXException
- Specified by:
startPrefixMappingin interfaceContentHandler- Overrides:
startPrefixMappingin classXMLFilterImpl- Throws:
SAXException
-
endPrefixMapping
public void endPrefixMapping(String prefix) throws SAXException
- Specified by:
endPrefixMappingin interfaceContentHandler- Overrides:
endPrefixMappingin 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
-
-