public class XmiCasSerializer extends Object
Modifier and Type | Field and Description |
---|---|
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 |
SYSTEM_LINE_FEED |
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 and Description |
---|
XmiCasSerializer(TypeSystem ts)
Creates a new XmiCasSerializer.
|
XmiCasSerializer(TypeSystem ts,
Map<String,String> nsUriToSchemaLocationMap)
Creates a new XmiCasSerializer.
|
XmiCasSerializer(TypeSystem ts,
Map<String,String> nsUriToSchemaLocationMap,
boolean isFormattedOutput)
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<String,String> nsUriToSchemaLocationMap)
Deprecated.
Use
XmiCasSerializer(TypeSystem, Map) instead. The UimaContext reference
is never used by this implementation. |
Modifier and Type | Method and Description |
---|---|
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.
|
void |
serialize(CAS cas,
ContentHandler contentHandler,
ErrorHandler errorHandler,
XmiSerializationSharedData sharedData,
Marker marker)
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.
|
static void |
serialize(CAS aCAS,
TypeSystem aTargetTypeSystem,
OutputStream aStream,
boolean aPrettyPrint,
XmiSerializationSharedData aSharedData,
Marker aMarker)
Serializes a Delta CAS to an XMI stream.
|
XmiCasSerializer |
setErrorHandler(ErrorHandler eh)
set an error handler to receive information about errors
|
XmiCasSerializer |
setFilterTypes(org.apache.uima.cas.impl.TypeSystemImpl ts)
pass in a type system to use for filtering what gets serialized;
only those types and features which are defined this type system are included.
|
XmiCasSerializer |
setPrettyPrint(boolean pp)
set or reset the pretty print flag (default is false)
|
public static final String XMLNS_NS_URI
public static final String XMI_NS_URI
public static final String XSI_NS_URI
public static final String XMI_NS_PREFIX
public static final String ID_ATTR_NAME
public static final String XMI_TAG_LOCAL_NAME
public static final String XMI_TAG_QNAME
public static final org.apache.uima.internal.util.XmlElementName XMI_TAG
public static final String XMI_VERSION_LOCAL_NAME
public static final String XMI_VERSION_QNAME
public static final String XMI_VERSION_VALUE
public static final String DEFAULT_NAMESPACE_URI
public static final String SYSTEM_LINE_FEED
public XmiCasSerializer(TypeSystem ts)
ts
- An optional typeSystem (or null) to filter the types 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.public XmiCasSerializer(TypeSystem ts, Map<String,String> nsUriToSchemaLocationMap)
ts
- An optional typeSystem (or null) to filter the types 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.nsUriToSchemaLocationMap
- 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.public XmiCasSerializer(TypeSystem ts, Map<String,String> nsUriToSchemaLocationMap, boolean isFormattedOutput)
ts
- An optional typeSystem (or null) to filter the types 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.nsUriToSchemaLocationMap
- 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.isFormattedOutput
- true makes serialization pretty print@Deprecated public XmiCasSerializer(TypeSystem ts, UimaContext uimaContext, Map<String,String> nsUriToSchemaLocationMap)
XmiCasSerializer(TypeSystem, Map)
instead. The UimaContext reference
is never used by this implementation.ts
- An optional typeSystem (or null) to filter the types 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 usednsUriToSchemaLocationMap
- 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.@Deprecated public XmiCasSerializer(TypeSystem ts, UimaContext uimaContext)
XmiCasSerializer(TypeSystem)
instead. The UimaContext reference is
never used by this implementation.ts
- An optional typeSystem (or null) to filter the types 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 usedpublic static void serialize(CAS aCAS, OutputStream aStream) throws SAXException
aCAS
- CAS to serialize.aStream
- output stream to which to write the XMI documentSAXException
- if a problem occurs during XMI serializationpublic static void serialize(CAS aCAS, TypeSystem aTargetTypeSystem, OutputStream aStream) throws SAXException
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 documentSAXException
- if a problem occurs during XMI serializationpublic static void serialize(CAS aCAS, TypeSystem aTargetTypeSystem, OutputStream aStream, boolean aPrettyPrint, XmiSerializationSharedData aSharedData) throws SAXException
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 documentaPrettyPrint
- 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.SAXException
- if a problem occurs during XMI serializationpublic static void serialize(CAS aCAS, TypeSystem aTargetTypeSystem, OutputStream aStream, boolean aPrettyPrint, XmiSerializationSharedData aSharedData, Marker aMarker) throws SAXException
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 documentaPrettyPrint
- 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.aMarker
- an optional object that is used to filter and serialize a Delta CAS containing only
those FSs and Views created after Marker was set and preexisting FSs and views that were modified.
See the JavaDocs for Marker
for details.SAXException
- if a problem occurs during XMI serializationpublic void serialize(CAS cas, ContentHandler contentHandler) throws SAXException
cas
- The CAS to be serialized.contentHandler
- The SAX content handler the data is written to.SAXException
- if there was a SAX exceptionpublic void serialize(CAS cas, ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException
cas
- The CAS to be serialized.contentHandler
- The SAX content handler the data is written to.errorHandler
- the SAX Error Handler to useSAXException
- if there was a SAX exceptionpublic void serialize(CAS cas, ContentHandler contentHandler, ErrorHandler errorHandler, XmiSerializationSharedData sharedData) throws SAXException
cas
- The CAS to be serialized.contentHandler
- The SAX content handler the data is written to.sharedData
- data structure used to allow the XmiCasSerializer and XmiCasDeserializer to share
information.errorHandler
- the SAX Error Handler to useSAXException
- if there was a SAX exceptionpublic void serialize(CAS cas, ContentHandler contentHandler, ErrorHandler errorHandler, XmiSerializationSharedData sharedData, Marker marker) throws SAXException
cas
- The CAS to be serialized.contentHandler
- The SAX content handler the data is written to.errorHandler
- the SAX Error Handler to usesharedData
- data structure used to allow the XmiCasSerializer and XmiCasDeserializer to share
information.marker
- an object used to filter the FSs and Views to determine if these were created after
the mark was set. Used to serialize a Delta CAS consisting of only new FSs and views and
preexisting FSs and Views that have been modified.SAXException
- if there was a SAX exceptionpublic XmiCasSerializer setPrettyPrint(boolean pp)
pp
- true to do pretty printing of outputpublic XmiCasSerializer setFilterTypes(org.apache.uima.cas.impl.TypeSystemImpl ts)
ts
- the filterpublic XmiCasSerializer setErrorHandler(ErrorHandler eh)
eh
- the error handlerCopyright © 2006–2017 The Apache Software Foundation. All rights reserved.