monitorjbl / excel-streaming-reader

An easy-to-use implementation of a streaming Excel reader using Apache POI
Apache License 2.0
943 stars 342 forks source link

`org.xml.sax.SAXNotRecognizedException: http://xml.org/sax/properties/ on Android #268

Open Tomasan7 opened 5 months ago

Tomasan7 commented 5 months ago

When trying to use this library on android, I keep getting org.xml.sax.SAXNotRecognizedException: http://xml.org/sax/properties/declaration-handler. When I was trying poi-ooxml it did work. But I need the streaming, A have also tried fastexcel which after adding runtimeOnly("javax.xml.stream:stax-api:1.0-2") also worked.

Some details:

used xlsx-streamer version: 2.2.0
Android sdks:
  minSdk = 26
  targetSdk = 34
  compileSdk = 34
Android version: 14

This is the entire stacktrace:

java.lang.RuntimeException: http://xml.org/sax/properties/declaration-handler
    at org.apache.xmlbeans.impl.store.Locale$SaxLoader.<init>(Locale.java:3397)
    at org.apache.xmlbeans.impl.store.Locale$XmlReaderSaxLoader.<init>(Locale.java:3087)
    at org.apache.xmlbeans.impl.store.Locale.getSaxLoader(Locale.java:3072)
    at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1272)
    at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1259)
    at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
    at org.openxmlformats.schemas.spreadsheetml.x2006.main.SstDocument$Factory.parse(Unknown Source:6)
    at org.apache.poi.xssf.model.SharedStringsTable.readFrom(SharedStringsTable.java:123)
    at org.apache.poi.xssf.model.SharedStringsTable.<init>(SharedStringsTable.java:111)
    at org.apache.poi.xssf.eventusermodel.XSSFReader.getSharedStringsTable(XSSFReader.java:115)
    at com.monitorjbl.xlsx.impl.StreamingWorkbookReader.init(StreamingWorkbookReader.java:122)
    at com.monitorjbl.xlsx.impl.StreamingWorkbookReader.init(StreamingWorkbookReader.java:91)
    at com.monitorjbl.xlsx.StreamingReader$Builder.open(StreamingReader.java:251)
    at me.tomasan7.jecnamobile.substable.PoiStreamingExcelParser.parseXlsx(PoiStreamingExcelParser.kt:17)
    at me.tomasan7.jecnamobile.substable.SubsTableViewModel$load$1.invokeSuspend(SubsTableViewModel.kt:67)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:205)
    at android.os.Looper.loop(Looper.java:294)
    at android.app.ActivityThread.main(ActivityThread.java:8248)
        at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
    Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@91b4cbc, Dispatchers.Main.immediate]
Caused by: org.xml.sax.SAXNotRecognizedException: http://xml.org/sax/properties/declaration-handler
    at org.apache.harmony.xml.ExpatReader.setProperty(ExpatReader.java:170)
    at org.apache.xmlbeans.impl.store.Locale$SaxLoader.<init>(Locale.java:3391)
    ... 24 more