I found several references in the mailinglist archive about Xerces, but it is still not clear to me if it is possible use Xerces succesfully in Android. Could you please provide me this information?
If the answer is Yes, could you please give me some tips or references on how use Xerces instead of default Android XML parser?
Thanks in advance for your support
kind regards Barbara
In computing, Xerces is Apache's collection of software libraries for parsing, validating, serializing and manipulating XML. The library implements a number of standard APIs for XML parsing, including DOM, SAX and SAX2. The implementation is available in the Java, C++ and Perl programming languages.
The Xerces-C++ source code is stored in the Apache Git repository. The repository is public and everyone has read access.
Xerces extends the core library javax
which leads to this problem in Android (mentioned by @Avi Cherry).
You can overcome this problem by repackaging the needed classes with a tool like JarJar. This has been done in the Xerces-for-Android, wherein the package mf
is placed above the "normal" Xerces packages.
You can check out Androjena; it's a porting of Jena to the Android platform, and it uses Android's built-in XML parsers instead of Xerces. Hope this helps, bye!
While you -can- include Xerces in your project, you need to add the --core-library command-line option to the dex tool. But you shouldn't do this, because when the javax/xml/parsers/DocumentBuilder.class class (for example) IS finally supported by an SDK version, your application will likely break. Instead, you should probably use the jarjar utility to re-package xerces into a self-contained library with unique package names.
Note that the error message that 'dex' gives you if you include a java or javax package WITHOUT the --core-library option, involves the phrase:
the path you are on will ultimately lead to pain, suffering, grief, and lamentation.
The same error message also suggests that you use JarJar to repackage the library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With