|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.metamodel.AbstractDataContext
org.apache.metamodel.QueryPostprocessDataContext
org.apache.metamodel.xml.XmlDomDataContext
public class XmlDomDataContext
A DataContext strategy that reads XML content and maps it to a table-based model similar to the rest of MetaModel. Tables are created by examining the data in the XML file, NOT by reading XML Schemas (xsd/dtd's). This enables compliancy with ALL xml formats but also raises a risk that two XML files with the same format wont nescesarily yield the same table model if some optional attributes or tags are omitted in one of the files. The parsing method applied in this datacontext is DOM based, which means that at upon parsing (only a single point in time), the whole file will be read and it's tree structure kept in memory. Therefore this DataContext is NOT appropriate for large XML files (10's, 100's or 1000's of megabytes).
XmlSaxDataContext| Field Summary | |
|---|---|
static String |
NATIVE_TYPE_ATTRIBUTE
|
static String |
NATIVE_TYPE_FOREIGN_KEY
|
static String |
NATIVE_TYPE_PRIMARY_KEY
|
static String |
NATIVE_TYPE_TEXT
|
| Fields inherited from class org.apache.metamodel.QueryPostprocessDataContext |
|---|
INFORMATION_SCHEMA_NAME |
| Constructor Summary | |
|---|---|
XmlDomDataContext(File file)
Creates an XML DataContext strategy based on a file. |
|
XmlDomDataContext(File file,
boolean autoFlattenTables)
|
|
XmlDomDataContext(InputSource inputSource,
String schemaName,
boolean autoFlattenTables)
|
|
XmlDomDataContext(Resource resource,
boolean autoFlattenTables)
Creates an XML DataContext strategy based on a file. |
|
XmlDomDataContext(String schemaName,
Document document,
boolean autoFlattenTables)
Creates an XML DataContext strategy based on an already parsed Document. |
|
XmlDomDataContext(URL url,
boolean autoFlattenTables)
|
|
| Method Summary | |
|---|---|
XmlDomDataContext |
autoFlattenTables()
Automatically flattens tables that only contain a single data carrying column. |
XmlDomDataContext |
flattenTables(Relationship relationship)
|
static Attr[] |
getAttributes(Element element)
|
static Element[] |
getChildElements(Element element)
|
protected Schema |
getMainSchema()
|
protected String |
getMainSchemaName()
|
static String |
getTextContent(Element element)
|
static boolean |
hasSiblings(Element element)
|
boolean |
isAutoFlattenTables()
|
static boolean |
isRootElement(Element element)
|
XmlDomDataContext |
loadSchema()
Loads the schema if it hasn't been loaded before |
DataSet |
materializeMainSchemaTable(Table table,
Column[] columns,
int maxRows)
|
XmlDomDataContext |
reloadSchema()
Forces a fresh load of the schema, even though it has already been loaded |
void |
setAutoFlattenTables(boolean autoFlattenTables)
|
| Methods inherited from class org.apache.metamodel.AbstractDataContext |
|---|
compileQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, isQualifiedPathDelim, parseQuery, query, refreshSchemas |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String NATIVE_TYPE_PRIMARY_KEY
public static final String NATIVE_TYPE_FOREIGN_KEY
public static final String NATIVE_TYPE_ATTRIBUTE
public static final String NATIVE_TYPE_TEXT
| Constructor Detail |
|---|
public XmlDomDataContext(String schemaName,
Document document,
boolean autoFlattenTables)
schemaName - document - autoFlattenTables -
public XmlDomDataContext(Resource resource,
boolean autoFlattenTables)
throws IllegalArgumentException
file - the file to parseautoFlattenTables - a parameter indicating whether or not tags with only text
content or a single attribute should be flattened with it's
parent table
IllegalArgumentException - if the file does not exist
public XmlDomDataContext(File file,
boolean autoFlattenTables)
public XmlDomDataContext(InputSource inputSource,
String schemaName,
boolean autoFlattenTables)
public XmlDomDataContext(URL url,
boolean autoFlattenTables)
throws IllegalArgumentException
IllegalArgumentExceptionpublic XmlDomDataContext(File file)
file - the file to parse| Method Detail |
|---|
public boolean isAutoFlattenTables()
public void setAutoFlattenTables(boolean autoFlattenTables)
public DataSet materializeMainSchemaTable(Table table,
Column[] columns,
int maxRows)
materializeMainSchemaTable in class QueryPostprocessDataContext
protected String getMainSchemaName()
throws MetaModelException
getMainSchemaName in class QueryPostprocessDataContextMetaModelException
protected Schema getMainSchema()
throws MetaModelException
getMainSchema in class QueryPostprocessDataContextMetaModelExceptionpublic XmlDomDataContext reloadSchema()
public XmlDomDataContext loadSchema()
public static String getTextContent(Element element)
public static Attr[] getAttributes(Element element)
public static boolean hasSiblings(Element element)
public static Element[] getChildElements(Element element)
public static boolean isRootElement(Element element)
public XmlDomDataContext flattenTables(Relationship relationship)
public XmlDomDataContext autoFlattenTables()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||