Class XmlSaxDataContext

  • All Implemented Interfaces:
    org.apache.metamodel.convert.HasReadTypeConverters, org.apache.metamodel.DataContext

    public class XmlSaxDataContext
    extends org.apache.metamodel.QueryPostprocessDataContext
    XML datacontext which uses SAX parsing for fast and memory effecient reading of XML files. The DataContext requires the user to specify a set of (simplified) XPaths to define which elements are row delimitors and which elements or attributes are value/column definitions.
    • Constructor Detail

      • XmlSaxDataContext

        public XmlSaxDataContext​(Supplier<InputSource> inputSourceRef,
                                 Collection<XmlSaxTableDef> tableDefs)
        Constructs an XML DataContext based on SAX parsing.
        Parameters:
        inputSourceRef - a factory reference for the input source to read the XML from. The ref will be repeatedly called for each access to the file!
        tableDefs - a collection of table definitions, which provide instructions as to the xpaths to apply to the document.
        See Also:
        XmlSaxTableDef
      • XmlSaxDataContext

        public XmlSaxDataContext​(org.apache.metamodel.util.Resource resource,
                                 XmlSaxTableDef... tableDefs)
      • XmlSaxDataContext

        public XmlSaxDataContext​(org.apache.metamodel.util.Resource resource,
                                 Collection<XmlSaxTableDef> tableDefs)
      • XmlSaxDataContext

        public XmlSaxDataContext​(File file,
                                 XmlSaxTableDef... tableDefs)
    • Method Detail

      • getMainSchema

        protected org.apache.metamodel.schema.Schema getMainSchema()
                                                            throws org.apache.metamodel.MetaModelException
        Specified by:
        getMainSchema in class org.apache.metamodel.QueryPostprocessDataContext
        Throws:
        org.apache.metamodel.MetaModelException
      • getMainSchemaName

        protected String getMainSchemaName()
                                    throws org.apache.metamodel.MetaModelException
        Specified by:
        getMainSchemaName in class org.apache.metamodel.QueryPostprocessDataContext
        Throws:
        org.apache.metamodel.MetaModelException
      • materializeMainSchemaTable

        protected org.apache.metamodel.data.DataSet materializeMainSchemaTable​(org.apache.metamodel.schema.Table table,
                                                                               List<org.apache.metamodel.schema.Column> columns,
                                                                               int maxRows)
        Specified by:
        materializeMainSchemaTable in class org.apache.metamodel.QueryPostprocessDataContext