`
gnibrE
  • 浏览: 136406 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

something about simple_list_item_1

阅读更多
I've been using the code below to decode the XML. Not pretty. but it
gives you a summary of the XML. It should be cleaned up, but I haven't
had the time to do that yet. I was hoping if I put it here someone
else might like clean it up.
The code will load (and decode!) all XML resources in an application,
and display them on the log.
        Resources r2; 
        r2 = this.getPackageManager().getResourcesForApplication("com.google.android.con tacts"); 
        int start = R.layout.main; 
        while (true) { 
                XmlPullParser xpp = r2.getXml(start); 
                start++; 
                eventType = xpp.getEventType(); 
                while (eventType != XmlPullParser.END_DOCUMENT) { 
                        if(eventType == XmlPullParser.START_DOCUMENT) { 
                                Log.w(LOG_TAG, "Start document"); 
                        } else if(eventType == XmlPullParser.END_DOCUMENT) { 
                                Log.w(LOG_TAG, "End document"); 
                        } else if(eventType == XmlPullParser.START_TAG) { 
                                int count = xpp.getAttributeCount(); 
                                String tag = "<" +xpp.getName(); 
                                for (int i = 0 ; i <count; ++i) { 
                                        String attrNS= xpp.getAttributeNamespace(i); 
                                        String attrName = xpp.getAttributeName(i); 
                                        if (attrNS !=null) {
                                            attrName = attrNS + ":" + attrName;
                                        } 
                                        String value = xpp.getAttributeValue(i); 
                                        tag += " " + attrName + "=\"" + value +"\""; 
                                        Log.w(LOG_TAG,tag); 
                                        tag = ""; 
                                } 
                                tag += ">"; 
                                Log.w(LOG_TAG, tag);
                        } else if(eventType == XmlPullParser.END_TAG) { 
                                Log.w(LOG_TAG, "</"+xpp.getName() + ">"); 
                        } else if(eventType ==XmlPullParser.TEXT) { 
                                Log.w(LOG_TAG, xpp.getText()); 
                        } else { 
                                Log.w(LOG_TAG,"Something else: " + eventType); 
                        } 
                        eventType = xpp.next(); 
                } 
                Log.w(LOG_TAG, "DONE"); 
        }         


If you do something with this, I'd be really keen to hear about it.

分享到:
评论

相关推荐

    一个win32下的ARM开源编译器

    flag which can potentially be unclear about what you will get. This is especially important in macros and structures where register numbers may be unknown until instantiated. Both syntaxes support ...

    RealThinClientSDK_v610_BETA

    will see a list of all packages currently installed in your Delphi. Scroll down to find "RealThinClient SDK" and click on it (single click). When you select it, click the button "Remove" and Delphi...

    TeeChart2018ActiveX_0_2_9Eval3264

    Private Sub Check1_CheckStateChanged(ByVal eventSender As System.Object, _ ByVal eventArgs As System.EventArgs) _ Handles Check1.CheckStateChan ' switch 2D / 3D view... TChart1.Aspect.View3D = ...

    php.ini-development

    The syntax of the file is extremely simple. Whitespace and lines ; beginning with a semicolon are silently ignored (as you probably guessed). ; Section headers (e.g. [Foo]) are also silently ignored,...

    VB.NET Developer's Guide(4574).pdf

    153_VBnet_TOC 8/16/01 1:12 PM Page xvii xviii Contents Chapter 5 .NET Programming Fundamentals 171 Introduction 172 Variables 173 Constants 175 Structures 176 Program Flow Control 178 If…Then...

    au3反编译源码

    list. That will replace 'Fn0020 with '_DateMonthOfYear'. So after you associate all functionNames of an include file you can delete these functions and replace them with for ex. #include Hint ...

    Android Cookbook, 2nd Edition 2017年出版766页

    Chapter 1 takes you through the steps of setting up the Android development envi‐ ronment and building several simple applications of the well-known “Hello, World” type pioneered by Brian Kernighan...

    ViewPager 放大缩小左右移动

    item = mAdapter.getCount() - 1; } final int pageLimit = mOffscreenPageLimit; if (item &gt; (mCurItem + pageLimit) || item (mCurItem - pageLimit)) { // We are doing a jump by more than one ...

    TeeChart Pro Activex Control v2018

    Private Sub Check1_CheckStateChanged(ByVal eventSender As System.Object, _ ByVal eventArgs As System.EventArgs) _ Handles Check1.CheckStateChan ' switch 2D / 3D view... TChart1.Aspect.View3D = ...

    Fckeditor2.6.3

    ['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-','About'] 为 FCKConfig.ToolbarSets["Basic"] = [ ['Bold','Italic','-','OrderedList','UnorderedList','-',/*'Link',*/'Unlink',...

    微软内部资料-SQL性能优化5

    The data pages in the table are kept in a doubly linked list called the page chain. The order of pages in the page chain, and the order of rows on the data pages, is the order of the index key or ...

    Javascript Manual Of Style

    Chapter 3lets me get up on my soapbox and do a little preaching about what makes a good Web page, what makes a bad Web page, and what you can do to keep your pages on the good list. &lt;br/&gt;The ...

    javacv-platform-1.3.3-src

    And feel free to ask questions on the mailing list if you encounter any problems with the software! I am sure it is far from perfect... Downloads To install manually the JAR files, obtain the ...

    微软内部资料-SQL性能优化3

    For example, a second transaction traversing the doubly linked list mentioned above would see the list before or after the insert, but it will see only complete changes. Durability After a ...

    beginning_portable_shell_scripting_from_novice_to_professional.pdf

    About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xv About the Technical Reviewer . . . . . . . . . . . ...

    Beginning Python (2005).pdf

    A Little Bit About the Internet Protocol 309 Internet Addresses 309 Internet Ports 310 Sending Internet E-mail 311 The E-mail File Format 311 MIME Messages 313 MIME Encodings: Quoted-printable ...

    wxPython in Action (2006).pdf

    HP-UX systems, but my boss also wanted to show something at a trade show on his Windows 3.1 laptop in a few weeks’ time. So I started searching for a cross platform C++ GUI toolkit to do a ...

    VB编程资源大全(英文源码 控件)

    Just pre-set the total interval any where from 1 millisecond to about 24 days. Set the TimerMode to fire Periodic or One-Time timer events. &lt;END&gt;&lt;br&gt;50,ComboBox2.zip Combo box. Must see. &lt;END&gt;&lt;br&gt;...

    ICS delphixe10源码版

    - About SSL - Support - Release notes - Midware - Known problems - Special thanks Legal issues: ------------- Copyright (C) 1997-2016 by Fran鏾is PIETTE Rue de Grady 24, 4053 Embourg, Belgium ...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    Maintaining a uniform style and following conventions means that we can more easily use "pattern-matching" to infer what various symbols are and what invariants are true about them. Creating common, ...

Global site tag (gtag.js) - Google Analytics