Read XML QoS on Android

3 posts / 0 new
Last post
Offline
Last seen: 5 years 5 months ago
Joined: 09/17/2018
Posts: 7
Read XML QoS on Android

I'm developing a Qt-based Android application with DDS.

Things are starting to come togethere nicely, but as one of the final hurdles, I need to load the QoS files from XML.

It is possible to pack these into the APK, but in that case it seems that reading them requires the Java resource manager. It's also possible to use the Qt resource system, which would allow reading them into a string easily.

However, DDS only supports file:// and str:// which is a bit annoying. file:// is obviously not going to work for resources that are packed inside a binary.

So the only option seems to be str://, but the documentation is very sparse. It appears the format is str://"xml", which I think would mean I need to escape strings inside the XML? This seems like a really odd feature that is not intended for reading larger XML files.

I found some references in the old API to construct these string url's from an array. Is there a helper function in the modern C++ API for reading XML from a string?

Offline
Last seen: 1 month 6 days ago
Joined: 11/14/2017
Posts: 29

I had a chat with the primary developer of the RTI shapes demo application for Android about this:

"For Shapes Demo what we did was to copy the XML file that is inside the APK (the file is included in the assets folder) into a folder in the Android device, and then load the XML file to the factory_qos, so it may be possible to do something like that. But if I'm not wrong it should be possible to load the XML file from the APK directly without copying its content to the device, this is something that I've not tried (there was no need to do this for Shapes Demo) but I think it should be possible."

Is this similar to what you've tried already?

Offline
Last seen: 5 years 5 months ago
Joined: 09/17/2018
Posts: 7

Yes, I ended up just copying the XML to /sdcard and read it from there. A bit clumsy, but it works.

An API to load XML from a string, or a plugin system for extending support ot include for example reading from Qt resources directly.