android-(XmlPullParserFactory)factory.newPullParser(); vs Xml.newPullParser();

时间:2019-02-19 19:22:26

标签: android xmlpullparser

为什么有两种方法来实例化新的XmlPullParser对象?第一, https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#newPullParser()

XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
XmlPullParser xpp = factory.newPullParser();

这仅设置出厂时存在的功能吗?其次, https://developer.android.com/reference/android/util/Xml#newPullParser()

XmlPullParser xpp = xpp = Xml.newPullParser(); 

唯一的区别是,返回的对象将具有两个功能吗?来自android.util.Xml.java:

KXmlParser parser = new KXmlParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_DOCDECL, true);
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);

还是我错过了什么?谢谢

0 个答案:

没有答案