Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.uima.cas.impl
Class XmiCasSerializer

    java.lang.Object
      org.apache.uima.cas.impl.XmiCasSerializer

    public class XmiCasSerializer

extends Object

XMI CAS serializer. Used to write out a CAS in an XML Metadata Interchange (XMI) format. Create a serializer from a type system, then encode individual CASes by writing to a SAX content handler. This class is thread safe.

Field Summary
`static String` | `DEFAULT_NAMESPACE_URI` Namespace URI to use for UIMA types that have no namespace (the "default pacakge" in Java)
`static String` | `ID_ATTR_NAME`
`static String` | `INDEXED_ATTR_NAME`
`static int` | `TYPE_CLASS_FLOATLIST`
`static int` | `TYPE_CLASS_FSLIST`
`static int` | `TYPE_CLASS_INTLIST`
`static int` | `TYPE_CLASS_STRINGLIST`
`static String` | `XMI_NS_PREFIX`
`static String` | `XMI_NS_URI`
`static org.apache.uima.internal.util.XmlElementName` | `XMI_TAG`
`static String` | `XMI_TAG_LOCAL_NAME`
`static String` | `XMI_TAG_QNAME`
`static String` | `XMI_VERSION_LOCAL_NAME`
`static String` | `XMI_VERSION_QNAME`
`static String` | `XMI_VERSION_VALUE`
`static String` | `XMLNS_NS_URI`
`static String` | `XSI_NS_URI`

Constructor Summary
`XmiCasSerializer(TypeSystem ts)` Creates a new XmiCasSerializer.
`XmiCasSerializer(TypeSystem ts, Map nsUriToSchemaLocationMap)` Creates a new XmiCasSerializer.
`XmiCasSerializer(TypeSystem ts, UimaContext uimaContext)` Deprecated. Use `XmiCasSerializer(TypeSystem)` instead. The UimaContext reference is never used by this implementation.
`XmiCasSerializer(TypeSystem ts, UimaContext uimaContext, Map nsUriToSchemaLocationMap)` Deprecated. Use `XmiCasSerializer(TypeSystem, Map)` instead. The UimaContext reference is never used by this implementation.

Method Summary
`int` | `getNumChildren()` Gets the number of children of the current element.
`void` | `serialize(CAS cas, ContentHandler contentHandler)` Write the CAS data to a SAX content handler.
`void` | `serialize(CAS cas, ContentHandler contentHandler, ErrorHandler errorHandler)` Write the CAS data to a SAX content handler.
`void` | `serialize(CAS cas, ContentHandler contentHandler, ErrorHandler errorHandler, XmiSerializationSharedData sharedData)` Write the CAS data to a SAX content handler.
`static void` | `serialize(CAS aCAS, OutputStream aStream)` Serializes a CAS to an XMI stream.
`static void` | `serialize(CAS aCAS, TypeSystem aTargetTypeSystem, OutputStream aStream)` Serializes a CAS to an XMI stream.
`static void` | `serialize(CAS aCAS, TypeSystem aTargetTypeSystem, OutputStream aStream, boolean aPrettyPrint, XmiSerializationSharedData aSharedData)` Serializes a CAS to an XMI stream.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TYPE_CLASS_INTLIST

    public static final int TYPE_CLASS_INTLIST

See Also:
  Constant Field Values

### TYPE_CLASS_FLOATLIST

    public static final int TYPE_CLASS_FLOATLIST

See Also:
  Constant Field Values

### TYPE_CLASS_STRINGLIST

    public static final int TYPE_CLASS_STRINGLIST

See Also:
  Constant Field Values

### TYPE_CLASS_FSLIST

    public static final int TYPE_CLASS_FSLIST

See Also:
  Constant Field Values

### XMLNS_NS_URI

    public static final String XMLNS_NS_URI

See Also:
  Constant Field Values

### XMI_NS_URI

    public static final String XMI_NS_URI

See Also:
  Constant Field Values

### XSI_NS_URI

    public static final String XSI_NS_URI

See Also:
  Constant Field Values

### XMI_NS_PREFIX

    public static final String XMI_NS_PREFIX

See Also:
  Constant Field Values

### XMI_TAG_LOCAL_NAME

    public static final String XMI_TAG_LOCAL_NAME

See Also:
  Constant Field Values

### XMI_TAG_QNAME

    public static final String XMI_TAG_QNAME

See Also:
  Constant Field Values

### XMI_TAG

    public static final org.apache.uima.internal.util.XmlElementName XMI_TAG

### INDEXED_ATTR_NAME

    public static final String INDEXED_ATTR_NAME

See Also:
  Constant Field Values

### ID_ATTR_NAME

    public static final String ID_ATTR_NAME

See Also:
  Constant Field Values

### XMI_VERSION_LOCAL_NAME

    public static final String XMI_VERSION_LOCAL_NAME

See Also:
  Constant Field Values

### XMI_VERSION_QNAME

    public static final String XMI_VERSION_QNAME

See Also:
  Constant Field Values

### XMI_VERSION_VALUE

    public static final String XMI_VERSION_VALUE

See Also:
  Constant Field Values

### DEFAULT_NAMESPACE_URI

    public static final String DEFAULT_NAMESPACE_URI

  Namespace URI to use for UIMA types that have no namespace (the "default pacakge" in Java)

  See Also:
    Constant Field Values

Constructor Detail

### XmiCasSerializer

    public XmiCasSerializer(TypeSystem ts,
                            Map nsUriToSchemaLocationMap)

  Creates a new XmiCasSerializer.

  Parameters:
    `ts` - the TypeSystem of CASes that will be serialized. If any CAS that is later passed to the `serialize` method that contains types and features that are not in this typesystem, the serialization will not contain instances of those types or values for those features. So this can be used to filter the results of serialization.
    `nsUriToSchemaLocation` - Map if supplied, this map is used to generate a "schemaLocation" attribute in the XMI output. This argument must be a map from namespace URIs to the schema location for that namespace URI.

### XmiCasSerializer

    public XmiCasSerializer(TypeSystem ts)

  Creates a new XmiCasSerializer.

  Parameters:
    `ts` - the TypeSystem of CASes that will be serialized. If any CAS that is later passed to the `serialize` method that contains types and features that are not in this typesystem, the serialization will not contain instances of those types or values for those features. So this can be used to filter the results of serialization. A null value indicates that all types and features will be serialized.

### XmiCasSerializer

    public XmiCasSerializer(TypeSystem ts,
                            UimaContext uimaContext,
                            Map nsUriToSchemaLocationMap)

  Deprecated. Use `XmiCasSerializer(TypeSystem, Map)` instead. The UimaContext reference is never used by this implementation.

  Creates a new XmiCasSerializer.

  Parameters:
    `ts` - the TypeSystem of CASes that will be serialized. If any CAS that is later passed to the `serialize` method that contains types and features that are not in this typesystem, the serialization will not contain instances of those types or values for those features. So this can be used to filter the results of serialization.
    `uimaContext` - not used
    `nsUriToSchemaLocation` - Map if supplied, this map is used to generate a "schemaLocation" attribute in the XMI output. This argument must be a map from namespace URIs to the schema location for that namespace URI.

### XmiCasSerializer

    public XmiCasSerializer(TypeSystem ts,
                            UimaContext uimaContext)

  Deprecated. Use `XmiCasSerializer(TypeSystem)` instead. The UimaContext reference is never used by this implementation.

  Creates a new XmiCasSerializer.

  Parameters:
    `ts` - the TypeSystem of CASes that will be serialized. If any CAS that is later passed to the `serialize` method that contains types and features that are not in this typesystem, the serialization will not contain instances of those types or values for those features. So this can be used to filter the results of serialization.
    `uimaContext` - not used

Method Detail

### getNumChildren

    public int getNumChildren()

  Gets the number of children of the current element. This is guranteed to be set correctly at the time when startElement is called. Needed for streaming Vinci serialization.

  NOTE: this method will not work if there are simultaneously executing calls to XmiCasSerializer.serialize. Use it only with a dedicated XmiCasSerializer instance that is not shared betwen threads.

  Returns:
    the number of children of the current element

### serialize

    public void serialize(CAS cas,
                          ContentHandler contentHandler)
                   throws SAXException

  Write the CAS data to a SAX content handler.

  Parameters:
    `cas` - The CAS to be serialized.
    `contentHandler` - The SAX content handler the data is written to. should be inserted into the XCAS output
  Throws:
    `IOException`
    `SAXException`

### serialize

    public void serialize(CAS cas,
                          ContentHandler contentHandler,
                          ErrorHandler errorHandler)
                   throws SAXException

  Write the CAS data to a SAX content handler.

  Parameters:
    `cas` - The CAS to be serialized.
    `contentHandler` - The SAX content handler the data is written to. should be inserted into the XCAS output
  Throws:
    `IOException`
    `SAXException`

### serialize

    public void serialize(CAS cas,
                          ContentHandler contentHandler,
                          ErrorHandler errorHandler,
                          XmiSerializationSharedData sharedData)
                   throws SAXException

  Write the CAS data to a SAX content handler.

  Parameters:
    `cas` - The CAS to be serialized.
    `contentHandler` - The SAX content handler the data is written to. should be inserted into the XCAS output
    `sharedData` - data structure used to allow the XmiCasSerializer and XmiCasDeserializer to share information.
  Throws:
    `IOException`
    `SAXException`

### serialize

    public static void serialize(CAS aCAS,
                                 OutputStream aStream)
                          throws SAXException

  Serializes a CAS to an XMI stream.

  Parameters:
    `aCAS` - CAS to serialize.
    `aStream` - output stream to which to write the XMI document
  Throws:
    `SAXException` - if a problem occurs during XMI serialization
    `IOException` - if an I/O failure occurs

### serialize

    public static void serialize(CAS aCAS,
                                 TypeSystem aTargetTypeSystem,
                                 OutputStream aStream)
                          throws SAXException

  Serializes a CAS to an XMI stream. Allows a TypeSystem to be specified, to which the produced XMI will conform. Any types or features not in the target type system will not be serialized.

  Parameters:
    `aCAS` - CAS to serialize.
    `aTargetTypeSystem` - type system to which the produced XMI will conform. Any types or features not in the target type system will not be serialized. A null value indicates that all types and features will be serialized.
    `aStream` - output stream to which to write the XMI document
  Throws:
    `SAXException` - if a problem occurs during XMI serialization
    `IOException` - if an I/O failure occurs

### serialize

    public static void serialize(CAS aCAS,
                                 TypeSystem aTargetTypeSystem,
                                 OutputStream aStream,
                                 boolean aPrettyPrint,
                                 XmiSerializationSharedData aSharedData)
                          throws SAXException

  Serializes a CAS to an XMI stream. This version of this method allows many options to be configured.

  Parameters:
    `aCAS` - CAS to serialize.
    `aTargetTypeSystem` - type system to which the produced XMI will conform. Any types or features not in the target type system will not be serialized. A null value indicates that all types and features will be serialized.
    `aStream` - output stream to which to write the XMI document
    `aPrettyPrint` - if true the XML output will be formatted with newlines and indenting. If false it will be unformatted.
    `aSharedData` - an optional container for data that is shared between the `XmiCasSerializer` and the `XmiCasDeserializer`. See the JavaDocs for `XmiSerializationSharedData` for details.
  Throws:
    `SAXException` - if a problem occurs during XMI serialization
    `IOException` - if an I/O failure occurs

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2007 The Apache Software Foundation. All Rights Reserved.