I’‘m trying to get Smack to work with KXML (http://xmlpull.org/v1/doc/api/index.html), but I run into the problem that I can’'t instantiate an XmlPullParserFactory. Originally Smack uses:
XmlPullParserFactory factory = XmlPullParserFactory.newInstance(“org.xmlpull.mxp1.MXParserFactory”, null);
but KXML doesn’'t have an ‘‘MXParserFactory’’ so I use the following instead:
XmlPullParserFactory factory = XmlPullParserFactory.newInstance(“org.xmlpull.v1.XmlPullParserFactory”, this.getClass());
I assume that the XmlPullParserFactory is a fitting factory. The error this produces is:
Exception: org/xmlpull/v1/XmlPullParserException
org.xmlpull.v1.XmlPullParserException: No valid parser classes found in parameter classNames to newInstance() that contained ‘‘org.xmlpull.v1.XmlPullParserFactory’’
at org.xmlpull.v1.XmlPullParserFactory.newPullParser(+76)
at org.jivesoftware.smack.PacketReader.(+107)
at org.jivesoftware.smack.XMPPConnection.init(+98)
at org.jivesoftware.smack.XMPPConnection.(+305)
at org.jivesoftware.smack.XMPPConnection.(+8)
XMLPull’'s API states the following:
“name of parser class factory to use and its class used for loading (no classloader - on J2ME no access to context class loaders) must be passed explicitly. If no name of parser factory was passed (or is null) it will try to find name by searching in CLASSPATH for META-INF/services/org.xmlpull.v1.XmlPullParserFactory”
So it seems that the VM can’‘t find ‘‘org.xmlpull.v1.XmlPullParserFactory’’, although it IS in the classpath. I have no idea how I can avoid this error. I’‘ve tried setting a different Class as context but that didn’'t solve the problem.
Any suggestions?
Cheers,
Berco