I want to use XStream 1.3.1 in an Android 1.0 application. The DomDriver works fine but the XppDriver does not work at all.
I am submitting a patch that enables XStream's XppDriver to function on Android 1.0
With this patch, XStream will look for the org.xmlpull.v1.XmlPullParserFactory class. If the class exists, XStream will use the Factory to create the XmlPullParser instance.
- relates to
MWAR-184 FATAL ERROR - XPP3 pull parser library not present. Specify another driver.
On Thu, Jan 29, 2009 at 1:03 AM, Sean Sullivan wrote:
> The Android platform has a built-in XmlPullParser. However, Android
> does not include the
> org.xmlpull.mxp1.MXParser implementation class. Google provides some
> other (undocumented)
> implementation of the XmlPullParser interface.
> According to the Android SDK documentation, Android developers should
> use XmlPullParserFactory to
> instantiate a XmlPullParser object.
> My XStream patch enables XStream's XppDriver to operate correctly on
> Android. The patch uses
> XmlPullParserFactory to create the XmlPullParser object.
> Creating the MXParser class directly
> new MXParser()
> will not work on the Android platform. IMHO, the best approach is to
> use the XmlPullParserFactory
> to create the XmlPullParser object.
On Fri, Jan 30, 2009 at 3:27 AM, Jörg Schaible wrote:
> Hi Joe,
> On Mittwoch, 28. Januar 2009, Joe Walnes wrote:
>> I think Jörg was suggesting going the other way,
> no I didn't, but I was simply not aware of the role of XmlPullParserFactory. I
> always thought of Xpp3 as an own (properietary) library on its own, successor
> of kXML and predecessor of StAX.
>> and always calling
>> XmlPullParserFactory to create the parser (for both Android and
>> standard Java). This would simplify things and reduce the amount of
>> reflection required.
>> I think that would work nicely.
> Definitely then.
>> Thanks for the patch Sean.
>> Interesting coincidence of the day... I asked my friends on the
>> Android team which implementation of XmlPullParser was being used, and
>> they chose the open source kxml implementation (designed for mobile),
>> not knowing that the guy who wrote it (Stephan) works on the Google
>> mobile team in London, which is also the team I work on. Small world.
> - Jörg
XStream team: what is the status on this issue?
I would like to be able to use XStream's XppDriver in my Android applications.
see the linked issue, I've definitely have to use a different approach and avoid this Class.forName calls at all. Have a look on the dev list, where I've started a discussion how to proceed with the XPP stuff in general (http://article.gmane.org/gmane.comp.java.xstream.devel/1270). Also I am currently waiting for
MAVENUPLOAD-2416 to commit some local changes.
the XppDriver uses now the XmlPullParserFactory to get a parser instance. Additionally we have now an Xpp3Driver as well as a KXml2Driver. I've uploaded a new SNAPSHOT so you can easily test this out. Note, this is now 1.4-SNAPHSOT.
When trying to use JMeter from Jython I previously go the before-mentioned:
Error in NonGUIDriver java.lang.IllegalArgumentException: XPP3 pull parser library not present. Specify another driver. For example: new XStream(new DomDriver())
(using XStream 1.3.1)
However, switching to svn trunk, or trunk@1674 gives me this instead:
An error occurred: org/xmlpull/v1/XmlPullParserException
Is there anything I can do to make this work?
@Pieter: Can you please ask on the user's list and also provide more information (e.g. complete stack trace)?
One small improvement on my patch:
Instead of Class.forName("xxxx"), XStream should use the Thread's context class loader:
ClassLoader cl = Thread.currentThread().getContextClassLoader();