org.eclipse.emf.ecore.xmi.impl
Class XMLContentHandlerImpl

java.lang.Object
  extended by org.eclipse.emf.ecore.resource.impl.ContentHandlerImpl
      extended by org.eclipse.emf.ecore.xmi.impl.XMLContentHandlerImpl
All Implemented Interfaces:
ContentHandler
Direct Known Subclasses:
RootXMLContentHandlerImpl, XMLContentHandlerImpl.XMI

public class XMLContentHandlerImpl
extends ContentHandlerImpl

A ContentHandler content handler implementation for dealing with XML content.


Nested Class Summary
static class XMLContentHandlerImpl.XMI
           
 
Nested classes/interfaces inherited from class org.eclipse.emf.ecore.resource.impl.ContentHandlerImpl
ContentHandlerImpl.Describer
 
Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.resource.ContentHandler
ContentHandler.ByteOrderMark, ContentHandler.Registry, ContentHandler.Validity
 
Field Summary
 
Fields inherited from interface org.eclipse.emf.ecore.resource.ContentHandler
BYTE_ORDER_MARK_PROPERTY, CHARSET_PROPERTY, CONTENT_TYPE_PROPERTY, INVALID_CONTENT_DESCRIPTION, OPTION_REQUESTED_PROPERTIES, UNSPECIFIED_CONTENT_TYPE, VALIDITY_PROPERTY
 
Constructor Summary
XMLContentHandlerImpl()
           
 
Method Summary
 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)
          This implementation augments the base implementation by computing the character set property.
protected  XMLResource createXMLResource()
          Creates a specialized XML resource for consuming just the root elements as well as the first nested element, if the root element is an XMI root element.
protected  java.lang.String getCharset(URI uri, java.io.InputStream inputStream, java.util.Map<?,?> options, java.util.Map<java.lang.Object,java.lang.Object> context)
          Returns the character set of the input stream; it's computed from the encoding specified in the XML content.
static boolean isXMINameAndNamespace(java.lang.String name, java.lang.String namespace)
          Returns whether the given name and namespace represents a specialize XMI root element tag.
static boolean isXMINamespace(java.lang.String namespace)
          Returns whether the given namespace represents an XMI namespace.
protected  XMLResource load(URI uri, java.io.InputStream inputStream, java.util.Map<?,?> options, java.util.Map<java.lang.Object,java.lang.Object> context)
          Returns the XML resource loaded from the input stream.
 
Methods inherited from class org.eclipse.emf.ecore.resource.impl.ContentHandlerImpl
canHandle, createContentDescription, getByteOrderMark, getRequestedProperties, isRequestedProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLContentHandlerImpl

public XMLContentHandlerImpl()
Method Detail

isXMINameAndNamespace

public static boolean isXMINameAndNamespace(java.lang.String name,
                                            java.lang.String namespace)
Returns whether the given name and namespace represents a specialize XMI root element tag.

Parameters:
name - the element name to consider.
namespace - the element namespace to consider.
Returns:
whether the given name and namespace represents a specialize XMI root element tag.

isXMINamespace

public static boolean isXMINamespace(java.lang.String namespace)
Returns whether the given namespace represents an XMI namespace.

Parameters:
namespace - the element namespace to consider.
Returns:
whether the given namespace represents an XMI namespace.

createXMLResource

protected XMLResource createXMLResource()
Creates a specialized XML resource for consuming just the root elements as well as the first nested element, if the root element is an XMI root element.

Returns:
an XML Resource for the root element and possibly the first nested element.

getCharset

protected java.lang.String getCharset(URI uri,
                                      java.io.InputStream inputStream,
                                      java.util.Map<?,?> options,
                                      java.util.Map<java.lang.Object,java.lang.Object> context)
                               throws java.io.IOException
Returns the character set of the input stream; it's computed from the encoding specified in the XML content.

Parameters:
uri - the URI of the input stream.
inputStream - the input stream of the XML content.
options - any options that might influence the loading the the XML content.
context - a cache for previously computed information.
Returns:
the character set of the input stream.
Throws:
java.io.IOException - if there is a problem loading the XML content.

load

protected XMLResource load(URI uri,
                           java.io.InputStream inputStream,
                           java.util.Map<?,?> options,
                           java.util.Map<java.lang.Object,java.lang.Object> context)
                    throws java.io.IOException
Returns the XML resource loaded from the input stream.

Parameters:
uri - the URI of the input stream.
inputStream - the input stream of the XML content.
options - any options that might influence the loading the the XML content.
context - a cache for previously computed information.
Returns:
the XML resource loaded from the input stream.
Throws:
java.io.IOException - if there is a problem loading the XML content.

contentDescription

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
This implementation augments the base implementation by computing the character set property.

Specified by:
contentDescription in interface ContentHandler
Overrides:
contentDescription in class ContentHandlerImpl
Parameters:
uri - the URI for which to determine the content description.
inputStream - the input stream associated with the given URI.
options - a map of options to direct what kind of description is needed.
context - a map of contextual information that content handlers use to store partially computed results.
Returns:
a map of properties that describe the content of the given URI's corresponding input stream.
Throws:
java.io.IOException - if there is a problem reading the stream.

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.