public final class XmlExport
extends java.lang.Object
Runtime support is partial at this time; not all modes and features are supported. PRODATASET is not supported at this time.
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ATTR_NS_XSI
XML namespace attribute
|
private static java.lang.String |
ATTR_XSI_NIL
Nil attribute
|
private TemporaryBuffer |
buffer
Temp-table buffer used for export
|
private boolean |
format
Flag indicating whether XML output should be pretty-printed
|
private static java.lang.String |
INDENT
3-space indent
|
private static java.lang.String |
lineSep
Platform-specific line separator
|
private static java.lang.String |
NS_URI
Namespace URI for XML schema
|
private TempTableSchema |
schema
Temp-table schema information
|
private javax.xml.stream.XMLStreamWriter |
writer
XML stream writer
|
Constructor and Description |
---|
XmlExport(TemporaryBuffer buffer,
DataTarget target,
logical formatted,
character encoding,
character schemaLocation,
logical writeXmlSchema,
logical minXmlSchema,
logical writeBeforeImage,
logical omitInitialValues)
Constructor which immediately performs the export.
|
Modifier and Type | Method and Description |
---|---|
private void |
indent(int levels)
Write a soft indent to the XML output stream, if formatting is enabled.
|
private void |
lineBreak()
Write a line break to the XML output stream, if formatting is enabled.
|
private void |
writeColumns(Persistable dmo,
java.lang.Iterable<TempTableSchema.Column> columns)
Write data for the given columns from a single record into the XML output stream.
|
private void |
writeDatum(TempTableSchema.Column column,
BaseDataType datum)
Write a single data value to the XML output stream, according to the instructions stored
in the temp-table schema.
|
private void |
writeRecord(Persistable dmo,
java.lang.String rowName)
Write a temp-table record's data to the XML output stream.
|
private static final java.lang.String INDENT
private static final java.lang.String ATTR_NS_XSI
private static final java.lang.String NS_URI
private static final java.lang.String ATTR_XSI_NIL
private static final java.lang.String lineSep
private final TemporaryBuffer buffer
private final TempTableSchema schema
private final boolean format
private javax.xml.stream.XMLStreamWriter writer
public XmlExport(TemporaryBuffer buffer, DataTarget target, logical formatted, character encoding, character schemaLocation, logical writeXmlSchema, logical minXmlSchema, logical writeBeforeImage, logical omitInitialValues) throws PersistenceException
buffer
- Temp-table buffer in which data is stored.target
- XML data target which normalizes access of various media to an output stream.formatted
- true
if serialized output should be pretty-printed for human-friendly
reading; false
to omit formatting.encoding
- Character encoding (not currently used).schemaLocation
- Path to XML schema (not currently used).writeXmlSchema
- true
to write XML schema information; false
to write only data.
If true
, schema will be written to schemaLocation
, if provided;
if not provided, schema will be embedded in XML output. Not currently honored.minXmlSchema
- true
to write minimal schema information; false
to write verbose
schema information. Ignored if writeXmlSchema
is false
. Not
currently honored.writeBeforeImage
- Not currently honored.omitInitialValues
- If true
, record values which match default initial values will be omitted
from serialized output, else they will be included. Not currently honored.PersistenceException
- if there is an error writing XML data or accessing the database.private void writeRecord(Persistable dmo, java.lang.String rowName)
dmo
- Object containing temp-table record's data.rowName
- Name applied to the element or attribute associated with the row data in the XML
output.private void writeColumns(Persistable dmo, java.lang.Iterable<TempTableSchema.Column> columns) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException, javax.xml.stream.XMLStreamException
dmo
- columns
- java.lang.IllegalAccessException
- if a DMO getter method cannot be accessed using reflection.java.lang.IllegalArgumentException
- if an illegal argument is passed to the DMO getter method for a column.java.lang.reflect.InvocationTargetException
- if there is a problem invoking a getter method on the given DMO.javax.xml.stream.XMLStreamException
- if there is an error writing to the XML stream.private void writeDatum(TempTableSchema.Column column, BaseDataType datum) throws javax.xml.stream.XMLStreamException
column
- Temp-table column schema information.datum
- Datum to be written to XML output.javax.xml.stream.XMLStreamException
- if there is an error writing to the XML stream.private void lineBreak() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
- if there is an error writing to the XML stream.private void indent(int levels) throws javax.xml.stream.XMLStreamException
levels
- Levels of indent (3 spaces per indent level) to apply. Must be non-negative.javax.xml.stream.XMLStreamException
- if there is an error writing to the XML stream.