Phil Troy wrote:
> Dear Aleksander
>
> Hi!
>
> I bypassed the problem of the missing XmlPullParserFactory class by
> creating the relevant packages and creating classes within them as
> needed so that I now have the following projects/classes:
>
> - org.xmlpull.v1
> - XmlPullParser.java
> - XmlPullParserException
> - XmlPullParserFactory
> - XmlSerializer
>
> - org.xmlpull.mxp1
> - MxParser.java
>
> But now, when I run the following statement it throws an exception on
> the following line of code
>
> XmlPullParserFactory factory =
>
XmlPullParserFactory.newInstance(System.getProperty(XmlPullParserFactory.PROPERT\
Y_NAME),
> null);
>
> I presume that it is because I am not properly setting the class to
> MxParser.java - if that is the problem, can you please tell me how to
> do that? I did look at the
>
> Class XmlPullParserFactory documentation, and did see the reference to
>
> Thread.getContextClassLoader().getClass() but I don't know how to get
> that to work.
>
calling System.getProperty(XmlPullParserFactory.PROPERTY_NAME) allwos
you to override parser impl class with system property. in case if it is
null then factory loads parse class impl name from special file in
META-INF directory and if you donot have this file it fails
you can by pass it by simply calling:
XmlPullParserFactory.newInstance("org.xmlpull.mxp1.MXParser",null)
or simply
XmlPullParser pp = new org.xmlpull.mxp1.MXParser()
anyway you should not need to do anything like this if you used
xpp3-1.1.4c.jar - in such case factory should just work so i suspect
there must be something eerie in your CLASSPATH project. it may be wort
to create new workspace and bran new project in eclipse and see how
things work in such case.
best,
alek