Reputation: 5360
Is it possible to open an external file in Android (as XmlPullParser)?
Upvotes: 2
Views: 1752
Reputation: 5360
File f = new File(filePath);
reader = new FileReader(f);
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
xpp = factory.newPullParser();
xpp.setInput(reader);
That's how do I.
Upvotes: 2
Reputation: 1006539
See android.util.Xml
and its newPullParser()
method.
As the documentation for it indicates, XPP is not faster than SAX. Hence, unless you are a big fan of the XPP programming model, I would use SAX, just because it is more commonly used in Java.
Upvotes: 1