Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

porting to Android: why am I getting "Can't create default XMLReader; is system property org.xml.sax.driver set?"?

I am porting some Java code that worked fine on my desktop to Android. I have the following code segment:

import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
// ...
XMLReader p = XMLReaderFactory.createXMLReader();

At the last line I get the following exception:

Can't create default XMLReader; is system property org.xml.sax.driver set?

When I was testing the code on desktop, it was working fine. Why am I getting this exception on Android and how can I fix it? Thx!

like image 384
I Z Avatar asked Apr 15 '12 19:04

I Z


Video Answer


1 Answers

My solution was including the following code in my MainActivity:

System.setProperty("org.xml.sax.driver","org.xmlpull.v1.sax2.Driver");
like image 107
artkoenig Avatar answered Oct 21 '22 18:10

artkoenig