Re: JDOM and Android

Joe Bowbeer <[email protected]> Mon, 16 Apr 2012 21:00:36 -0700
Newsgroups gmane.comp.java.jdom.general
Message-ID <CAHzJPEpFDpmkrSunyUBF56OjKSboL5X65azBwDRb8RyHh1renA@mail.gmail.com>
You'll need to put the data in assets

http://stackoverflow.com/questions/4820816/how-to-get-uri-from-an-asset-file

http://stackoverflow.com/questions/4789325/android-path-to-asset-txt-file

and use getResources().getAssets().open()

Or you could put the data in res/raw and use
getResources().openRawResource()

.. but res/raw does not support a nested file structure.

Or maybe you could do something crazy with a custom class loader:

http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html

--Joe


On Mon, Apr 16, 2012 at 8:08 PM, Rolf Lear <[email protected]> wrote:

> Hi all.
>
> I am having some limited success with the Android testing. I have run in
> to an issue through which could really use some input from experienced
> Android developers.
>
> Are there any on JDOM-interest with some time to spare?
>
> My issue right now is that the JUnit tests are mostly passing, but a
> number of them rely on using ClassLoader.getSystemResource(**"path/to/file.xml")
> to load resources as a URL.
>
> It is improtant to keep it as a URL because many of these tests rely on
> internal DTD's and XSD's, which, in turn mean that when they are processed
> the input file's URL will be used as a base for a relative location of the
> DTD/XSD.
>
> In other words, I need to keep access to these files as a URL....
>
> But, ClassLoader.getSystemResource(**...)  is returning null on Android.
>
> I think it is related to http://code.google.com/p/**
> android/issues/detail?id=10076<http://code.google.com/p/android/issues/detail?id=10076>
>
> But, I can't find a good way to work around the issue....
>
> So, If there's some experienced Android developer who can shed some light
> in to this particular dark place, I would appreciate it.
>
> For the record, I have a full test-suite available for any Android
> developers who happen to use eclipse. It fully compiled, loads, and I am
> running a 'Test' Project on a 4.0.3 emulator.
>
> I can, in theory, help you bootstrap the environment in your eclipse
> pretty easily... if needed.
>
> Rolf
>

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]