Thanks for the work,

I tried but unfortunately did not manage to reproduce the error outside of
the Android Emulator, different combinations of both features either work
or result in different exceptions.

Also trying with the latest version of Locale.java inside the Android
Emulator also did not work. I still get the same error message.

It seems there is some other difference in XMLBeans here which introduced
this issue.

Please note that the current version of the poi-on-android project is based
on 4.1.2 and there removing the "namespace-prefixes" feature did make it
work. I only get this when upgrading to newer versions of Apache POI. So
something between Apache POI 4.12 and 5.2.0 (and the corresponding XMLBeans
version) changed and introduced this error.

Regards... Dominik

On Wed, Feb 9, 2022 at 12:21 PM PJ Fanning <fannin...@yahoo.com.invalid>
wrote:

> Hi Dominik,
> I committed
> https://github.com/apache/xmlbeans/commit/71e0f1e4da5e76c4470c2532538705b46229e1e4
>
> It seems to work for me locally. I'll revert it if it causes problems.
> Feel free to revert it or change it yourself if you think that this is the
> wrong approach.
>
> I raised https://issues.apache.org/jira/browse/XMLBEANS-598 as a weakness
> of the old and new code. I might have a look at that later this week if the
> XMLBEANS-597 solution works for the existing scenarios.
>
> Regards,
> PJ
>
>
>
>
>
>
> On Wednesday 9 February 2022, 11:43:26 GMT+1, PJ Fanning
> <fannin...@yahoo.com.invalid> wrote:
>
>
>
>
>
> It looks like the current SAX code in XMLBeans Locale class relies on the
> namespace-prefix feature being enabled.
> When it is enabled, startElement method receives all the xmlns entries on
> the element as attributes. You can see in current code how startElement is
> trying to build up a namespace context from these attributes.
>
> If you don't set the namespace-prefix feature, you do not get these
> namespace mappings as attributes. They can still be worked out because the
> startPrefixMapping gets called with the namespace mapping.
>
> So, it looks like we need to rewrite the SAX to never set namespace-prefix
> feature to true and to change how the SAX code created the namespace
> context (by doing it inside the startPrefixMapping instead).
>
>
>
>
>
>
> On Tuesday 8 February 2022, 23:13:35 GMT+1, PJ Fanning
> <fannin...@yahoo.com.invalid> wrote:
>
>
>
>
>
> Aim would be to reproduce the issue in a non-android env and that would
> make it easier to try to find a fix.
>
>
>
>
>
>
> On Tuesday 8 February 2022, 23:10:39 GMT+1, Dominik Stadler <
> dominik.stad...@gmx.at> wrote:
>
>
>
>
>
> Hi,
>
> I will check that, but what would happen if I keep "namespace-prefixes:
> true" and switch the feature "namespaces" to "false"? It will likely lead
> to other trouble, or?
>
> Thanks... Dominik.
>
>
> On Tue, Feb 8, 2022 at 10:44 PM PJ Fanning <fannin...@yahoo.com.invalid>
> wrote:
>
> > Maybe this only works if namespace-prefix handling is enabled on the
> > XMLReader - the thing that doesn't work on Android (
> > https://issues.apache.org/jira/browse/XMLBEANS-597).
> >
> > Could you try this test in a non-android env where XMLBeans doesn't
> > enable namespace-prefix feature? This might cause it to fail in same way
> as
> > on android env.
> >
> >
> >
> >
> >
> >
> > On Tuesday 8 February 2022, 22:32:26 GMT+1, Dominik Stadler <
> > dominik.stad...@gmx.at> wrote:
> >
> >
> >
> >
> >
> > Hi,
> >
> > when I try to update Apache POI from 4.1.2 to 5.2.0 in the sample-project
> > that provides Apache POI for Android Apps (
> > https://github.com/centic9/poi-on-android ), I get a very strange
> > exception.
> >
> > It seems that some of the resources are not found, although they are
> > present properly as far as I can tell. I think there were quite some
> > changes in that area between 4.1.2 and 5.2.0
> >
> > Did any of the XMLBeans gurus encounter something like this or knows what
> > the reason could be?
> >
> > Thanks... Dominik.
> >
> > Stacktrace:
> >
> >    Caused by: org.apache.xmlbeans.SchemaTypeLoaderException: Cannot
> > resolve type for handle _XY_Q=space|R=space@
> > http://www.w3.org/XML/1998/namespace
> > (org.apache.poi.schemas.ooxml.system.ooxml.cttext7f5btype) - code 13
> >        at
> > org.apache.xmlbeans.impl.schema.XsbReader.readHandle(XsbReader.java:483)
> >        at
> > org.apache.xmlbeans.impl.schema.XsbReader.readTypeRef(XsbReader.java:548)
> >        at
> >
> >
> org.apache.xmlbeans.impl.schema.XsbReader.loadAttribute(XsbReader.java:1282)
> >        at
> >
> >
> org.apache.xmlbeans.impl.schema.XsbReader.readAttributeData(XsbReader.java:1275)
> >        at
> >
> >
> org.apache.xmlbeans.impl.schema.XsbReader.finishLoadingType(XsbReader.java:902)
> >        at
> >
> >
> org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.resolveHandle(SchemaTypeSystemImpl.java:938)
> >        at
> >
> >
> org.apache.xmlbeans.SchemaComponent$Ref.getComponent(SchemaComponent.java:113)
> >        at org.apache.xmlbeans.SchemaType$Ref.get(SchemaType.java:1072)
> >        at
> >
> >
> org.apache.xmlbeans.impl.schema.SchemaPropertyImpl.getType(SchemaPropertyImpl.java:85)
> >        at
> >
> >
> org.apache.xmlbeans.impl.schema.SchemaTypeImpl.createElementType(SchemaTypeImpl.java:990)
> >        at
> >
> >
> org.apache.xmlbeans.impl.values.XmlObjectBase.create_element_user(XmlObjectBase.java:914)
> >        at org.apache.xmlbeans.impl.store.Xobj.getUser(Xobj.java:1597)
> >        at org.apache.xmlbeans.impl.store.Cur.getUser(Cur.java:2571)
> >        at org.apache.xmlbeans.impl.store.Cur.getObject(Cur.java:2565)
> >        at
> > org.apache.xmlbeans.impl.store.Cursor._getObject(Cursor.java:817)
> >        at
> >
> >
> org.apache.xmlbeans.impl.store.Cursor$$ExternalSyntheticLambda64.get(Unknown
> > Source:2)
> >        at
> > org.apache.xmlbeans.impl.store.Cursor.syncWrapHelper(Cursor.java:2520)
> >        at
> org.apache.xmlbeans.impl.store.Cursor.syncWrap(Cursor.java:2451)
> >        at
> > org.apache.xmlbeans.impl.store.Cursor.getObject(Cursor.java:2078)
> >        at
> > org.apache.poi.xwpf.usermodel.XWPFParagraph.<init>(XWPFParagraph.java:79)
> >        at
> >
> >
> org.apache.poi.xwpf.usermodel.XWPFDocument.onDocumentRead(XWPFDocument.java:214)
> >        at
> > org.apache.poi.ooxml.POIXMLDocument.load(POIXMLDocument.java:169)
> >        at
> > org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:159)
>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
> > For additional commands, e-mail: dev-h...@poi.apache.org
>
>
>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
> For additional commands, e-mail: dev-h...@poi.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
> For additional commands, e-mail: dev-h...@poi.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
> For additional commands, e-mail: dev-h...@poi.apache.org
>
>

Reply via email to