public final class XmlImport
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 | Class and Description |
---|---|
private static class |
XmlImport.ExtentTracker
Helper object which tracks current and maximum index values for extent fields.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ATTR_NIL
Nil attribute name
|
private static java.lang.String |
ELEM_SCHEMA
XSD schema element name
|
private XmlImport.ExtentTracker |
extentTracker
Helper which tracks current index values for extent fields
|
private Buffer |
proxy
Buffer proxy
|
private SerializeOptions.Read |
readMode
Read mode to determine how records are stored and how non-unique records are handled
|
private TempTableSchema |
schema
Temp-table schema information
|
private static java.lang.String |
TEXT_TRUE
String constant for 'true'
|
private SerializeOptions.Verify |
verifySchemaMode
Verify schema mode
|
Constructor and Description |
---|
XmlImport(TemporaryBuffer buffer,
DataSource source,
SerializeOptions.Read readMode,
java.lang.String schemaLocation,
boolean overrideDefaultMapping,
java.lang.String fieldTypeMapping,
SerializeOptions.Verify verifySchemaMode)
Constructor which immediately performs the import.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
checkNil(TempTableSchema.Column column,
javax.xml.stream.XMLStreamReader reader)
Check whether the current temp-table value read from XML content is null.
|
private TempTableSchema.Column |
getColumn(java.lang.String name)
Get schema information for the column associated with the given name.
|
private void |
readContent(javax.xml.stream.XMLStreamReader reader,
java.lang.String rowName)
Read XML content from reader and import records into the temp-table.
|
private void |
readData(DataSource source)
Read XML data from the input source and store it in the temp-table.
|
private void |
readRecord(javax.xml.stream.XMLStreamReader reader)
Read XML content from the stream corresponding with a single data record and store it in
the temp-table.
|
private void |
readSchema(javax.xml.stream.XMLStreamReader reader)
Read XSD schema data from the XML content.
|
private java.lang.String |
readText(javax.xml.stream.XMLStreamReader reader)
Read text content from within an element or a CDATA section.
|
private void |
setField(TempTableSchema.Column column,
java.lang.String name,
java.lang.String value)
Set the value of a single field in the temp-table record currently being read from the XML
content.
|
private static final java.lang.String ELEM_SCHEMA
private static final java.lang.String ATTR_NIL
private static final java.lang.String TEXT_TRUE
private final SerializeOptions.Read readMode
private final SerializeOptions.Verify verifySchemaMode
private final Buffer proxy
private final TempTableSchema schema
private final XmlImport.ExtentTracker extentTracker
public XmlImport(TemporaryBuffer buffer, DataSource source, SerializeOptions.Read readMode, java.lang.String schemaLocation, boolean overrideDefaultMapping, java.lang.String fieldTypeMapping, SerializeOptions.Verify verifySchemaMode) throws PersistenceException
buffer
- Temp-table buffer in which data is stored.source
- XML data source which normalizes access of various media to an input stream.readMode
- Read mode to determine how records are stored and how non-unique records are
handled. Not currently honored, except temp-table records are deleted if mode
is EMPTY.schemaLocation
- Path to XML schema (not currently used).overrideDefaultMapping
- Not currently used.fieldTypeMapping
- Not currently used.verifySchemaMode
- Not currently used.PersistenceException
- if there is any error reading or storing XML data.private void readData(DataSource source) throws PersistenceException
source
- Data input source.PersistenceException
- if there is any error reading or storing XML data.private void readContent(javax.xml.stream.XMLStreamReader reader, java.lang.String rowName) throws javax.xml.stream.XMLStreamException, PersistenceException
reader
- XML stream reader.rowName
- Element name for temp-table record data in XML content.javax.xml.stream.XMLStreamException
- if there is an error reading XML content from the stream.PersistenceException
- if there is an error storing data in the temp-table.private void readSchema(javax.xml.stream.XMLStreamReader reader) throws javax.xml.stream.XMLStreamException
The current implementation simply skips this section of the content, if present.
reader
- XML stream reader.javax.xml.stream.XMLStreamException
- if there is an error reading XML content from the stream.private void readRecord(javax.xml.stream.XMLStreamReader reader) throws javax.xml.stream.XMLStreamException, PersistenceException
reader
- XML stream reader.javax.xml.stream.XMLStreamException
- if there is an error reading XML content from the stream.PersistenceException
- if there is an error storing data in the temp-table.private java.lang.String readText(javax.xml.stream.XMLStreamReader reader) throws javax.xml.stream.XMLStreamException
reader
- XML stream reader.javax.xml.stream.XMLStreamException
- if there is an error reading XML content from the stream.private TempTableSchema.Column getColumn(java.lang.String name)
name
- Element or attribute name associated with serialized XML data for a temp-table
column.ErrorConditionException
- if name
is not associated with a column.private boolean checkNil(TempTableSchema.Column column, javax.xml.stream.XMLStreamReader reader)
column
- Schema information for the associated column.reader
- XML stream reader.true
if the XML content is nil; else false
.ErrorConditionException
- if value is nil and column does not allow null values.private void setField(TempTableSchema.Column column, java.lang.String name, java.lang.String value) throws PersistenceException
column
- Schema information for the associated column.name
- Element or attribute name associated with serialized XML data for a temp-table
column.value
- Data value read from XML content. Set to null
to represent unknown value.PersistenceException
- if there is an error storing data in the temp-table.