开发者

Open an external XML file

开发者 https://www.devze.com 2023-01-01 11:17 出处:网络
Is it possible to open an ext开发者_运维技巧ernal file in Android (as XmlPullParser)?File f = new File(filePath);

Is it possible to open an ext开发者_运维技巧ernal file in Android (as XmlPullParser)?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消