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

Reply via email to