public class XMLEventParserContextFactory
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
XMLEventParserContextFactory.ParserTableEntry
Holds the mime types and the associated prototype parser.
|
Modifier and Type | Field and Description |
---|---|
protected static java.util.List<XMLEventParserContextFactory.ParserTableEntry> |
parsers
The list of registered parser contexts.
|
Constructor and Description |
---|
XMLEventParserContextFactory() |
Modifier and Type | Method and Description |
---|---|
static void |
addParserContext(java.lang.String[] mimeTypes,
XMLEventParserContext prototypeContext)
Appends a specified prototype parser context to the list of those already registered.
|
protected static XMLEventParserContext |
createInstanceFromPrototype(XMLEventParserContext prototype)
Constructs a new parser context given a prototype parser context.
|
static XMLEventParserContext |
createParserContext(java.lang.String mimeType,
java.lang.String defaultNamespace)
Constructs and returns a parser context for a specified mime type and namespace.
|
static void |
prependParserContext(java.lang.String[] mimeTypes,
XMLEventParserContext prototypeContext)
Prepends a specified prototype parser context to the list of those already registered.
|
protected static java.util.List<XMLEventParserContextFactory.ParserTableEntry> parsers
public static void addParserContext(java.lang.String[] mimeTypes, XMLEventParserContext prototypeContext)
mimeTypes
- the list of mime types for which to use the specified prototype parser context.prototypeContext
- the prototype parser context to use for the specified mime types. This parser context's
class must provide a copy constructor, a constructor that takes an instance of its class
as its only argument.java.lang.IllegalArgumentException
- if the mime type list is null or empty or the prototype context is null or has
no copy constructor.protected static XMLEventParserContext createInstanceFromPrototype(XMLEventParserContext prototype) throws java.lang.Exception
prototype
- the prototype parser context. This parser context's class must provide a copy constructor, a
constructor that takes an instance of the class as its only argument.java.lang.Exception
- if an exception occurs while attempting to construct the new context.public static XMLEventParserContext createParserContext(java.lang.String mimeType, java.lang.String defaultNamespace)
XMLConstants.NULL_NS_URI
does not match any other namespace. In order for
a parser context with the empty namespace to be returned, one with the empty namespace must be registered.mimeType
- the mime type for which to construct a parser.defaultNamespace
- a namespace qualifying the parser context to return. May be null, in which case a parser
context for the specified mime type and an empty namespace, XMLConstants.NULL_NS_URI
, is searched for.java.lang.IllegalArgumentException
- if the specified mime type is null.public static void prependParserContext(java.lang.String[] mimeTypes, XMLEventParserContext prototypeContext)
mimeTypes
- the list of mime types for which to use the specified prototype parser context.prototypeContext
- the prototype parser context to use for the specified mime types. This parser context's
class must provide a copy constructor, a constructor that takes an instance of its class
as its only argument.java.lang.IllegalArgumentException
- if the mime type list is null or empty or the prototype context is null or has
no copy constructor.