Android pull解析器示例

【Android pull解析器示例】得意犹堪夸世俗,诏黄新湿字如鸦。这篇文章主要讲述Android pull解析器示例相关的知识,希望能为你提供帮助。

  1. private void ParseConfigFile( ) throws XmlPullParserException, IOException
  2. {
  3. XmlResourceParser parser = getResources( ) .getXml( R.xml.config) ;
  4. parser.next( ) ;
  5. int eventType = parser.getEventType( ) ;
  6. while ( eventType != XmlPullParser.END_DOCUMENT)
  7. {
  8. if( eventType == XmlPullParser.START_DOCUMENT)
  9. {
  10. //stringBuffer.append(" --- Start XML ---" );
  11. }
  12. else if( eventType == XmlPullParser.START_TAG)
  13. {
  14. //stringBuffer.append(" START_TAG: " +xpp.getName());
  15. }
  16. else if( eventType == XmlPullParser.END_TAG)
  17. {
  18. //stringBuffer.append(" END_TAG: " +xpp.getName());
  19. }
  20. else if( eventType == XmlPullParser.TEXT)
  21. {
  22. //stringBuffer.append(" TEXT: " +xpp.getText());
  23. }
  24. eventType = parser.next( ) ;
  25. }
  26. parser.close( ) ;
  27. }


    推荐阅读