public class RootXMLContentHandlerImpl extends XMLContentHandlerImpl
ContentHandler implementation that matches root element names and namespaces.| Modifier and Type | Class and Description |
|---|---|
static class |
RootXMLContentHandlerImpl.Describer
A describer that
creates a RootXMLContentHandlerImpl instance. |
XMLContentHandlerImpl.XMI| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONTENT_TYPE_ID
The key in the
constructor's parameter map representing the content type identifier String. |
protected java.lang.String |
contentTypeID
The content type identifier for content that matches this handler.
|
static java.lang.String |
ELEMENT_NAMES
The key in the
constructor's parameter map representing the root element names
which are encoded as a space separated list of names. |
protected java.lang.String[] |
elementNames
The expected name of the root element or the first non-XMI element.
|
protected java.lang.String[] |
extensions
The file extensions for which this handler applies.
|
static java.lang.String |
EXTENSIONS
The key in the
constructor's parameter map representing the extensions
which are encoded as a space separate list of suffixes. |
protected java.lang.String |
kind
The kind of content that's expected;
XMI content has special handling. |
static java.lang.String |
KIND
The key in the
constructor's parameter map representing the kind of resource being processed;
only the value xmi |
protected java.lang.String |
namespace
The namespace of the root element or the first non-XMI element.
|
static java.lang.String |
NAMESPACE
The key in the
constructor's parameter map representing the namespace. |
static java.lang.String |
NAMESPACE_PATTERN
The key in the
constructor's parameter map representing the namespace pattern. |
protected java.util.regex.Pattern |
namespacePattern
The namespace pattern of the root element or the first non-XMI element.
|
static java.lang.String |
XMI_KIND
A
kind value indicating XMI content. |
| Constructor and Description |
|---|
RootXMLContentHandlerImpl(java.util.Map<java.lang.String,java.lang.String> parameters)
Creates an instance corresponding to the given parameters.
|
RootXMLContentHandlerImpl(java.lang.String contentTypeID,
java.lang.String[] extensions,
java.lang.String kind,
java.util.regex.Pattern namespacePattern,
java.lang.String[] elementNames)
Creates an instance initialized with the given arguments.
|
RootXMLContentHandlerImpl(java.lang.String contentTypeID,
java.lang.String[] extensions,
java.lang.String kind,
java.lang.String namespace,
java.lang.String[] elementNames)
Creates an instance initialized with the given arguments.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canHandle(URI uri)
Returns true if the
extensions are null or empty, of if the URI's file extension matches one of the extension's values. |
java.util.Map<java.lang.String,java.lang.Object> |
contentDescription(URI uri,
java.io.InputStream inputStream,
java.util.Map<?,?> options,
java.util.Map<java.lang.Object,java.lang.Object> context)
Returns a valid content description if the XML content of the input stream has an element that matches the element names and namespace.
|
protected boolean |
isMatchingNamespace(java.lang.String rootElementNamespace)
Returns whether the given root element's namespace matches the namespace expected for the content type.
|
createXMLResource, getCharset, isXMINameAndNamespace, isXMINamespace, loadprotected java.lang.String contentTypeID
protected java.lang.String[] extensions
protected java.lang.String kind
XMI content has special handling.protected java.lang.String namespace
protected java.util.regex.Pattern namespacePattern
protected java.lang.String[] elementNames
public static final java.lang.String CONTENT_TYPE_ID
constructor's parameter map representing the content type identifier String.contentTypeID,
Constant Field Valuespublic static final java.lang.String EXTENSIONS
constructor's parameter map representing the extensions
which are encoded as a space separate list of suffixes.extensions,
Constant Field Valuespublic static final java.lang.String KIND
constructor's parameter map representing the kind of resource being processed;
only the value xmi is recognized.kind,
Constant Field Valuespublic static final java.lang.String XMI_KIND
kind value indicating XMI content.public static final java.lang.String NAMESPACE
constructor's parameter map representing the namespace.namespace,
Constant Field Valuespublic static final java.lang.String NAMESPACE_PATTERN
constructor's parameter map representing the namespace pattern.namespacePattern,
Constant Field Valuespublic static final java.lang.String ELEMENT_NAMES
constructor's parameter map representing the root element names
which are encoded as a space separated list of names.elementNames,
Constant Field Valuespublic RootXMLContentHandlerImpl(java.util.Map<java.lang.String,java.lang.String> parameters)
parameters - the map of key value pairs.CONTENT_TYPE_ID,
EXTENSIONS,
KIND,
NAMESPACE,
ELEMENT_NAMESpublic RootXMLContentHandlerImpl(java.lang.String contentTypeID,
java.lang.String[] extensions,
java.lang.String kind,
java.lang.String namespace,
java.lang.String[] elementNames)
contentTypeID - the content type identifier for content recognized this this handler.extensions - the extensions handled by this instance;
null or an empty array specifies that this handler applies for all URIs.kind - the kind of content that's expected; XMI_KIND supports special handling.namespace - the expected namespace of the root element or first non-XMI element.elementNames - the expected element names of the root element or the first non-XMI element;
null or an empty array specifies that any root element name is allowed.public RootXMLContentHandlerImpl(java.lang.String contentTypeID,
java.lang.String[] extensions,
java.lang.String kind,
java.util.regex.Pattern namespacePattern,
java.lang.String[] elementNames)
contentTypeID - the content type identifier for content recognized this this handler.extensions - the extensions handled by this instance;
null or an empty array specifies that this handler applies for all URIs.kind - the kind of content that's expected; XMI_KIND supports special handling.namespacePattern - a pattern that will match the expected namespace of the root element or first non-XMI element.elementNames - the expected element names of the root element or the first non-XMI element;
null or an empty array specifies that any root element name is allowed.public boolean canHandle(URI uri)
extensions are null or empty, of if the URI's file extension matches one of the extension's values.public java.util.Map<java.lang.String,java.lang.Object> contentDescription(URI uri,
java.io.InputStream inputStream,
java.util.Map<?,?> options,
java.util.Map<java.lang.Object,java.lang.Object> context)
throws java.io.IOException
java.io.IOExceptionprotected boolean isMatchingNamespace(java.lang.String rootElementNamespace)
Copyright © 2018. Licensed under the Eclipse Public License v1.0. All rights reserved.
Submit a bug or feature