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.
分享到:
相关推荐
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 ...
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...
Private Sub Check1_CheckStateChanged(ByVal eventSender As System.Object, _ ByVal eventArgs As System.EventArgs) _ Handles Check1.CheckStateChan ' switch 2D / 3D view... TChart1.Aspect.View3D = ...
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 ...
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,...
item = mAdapter.getCount() - 1; } final int pageLimit = mOffscreenPageLimit; if (item > (mCurItem + pageLimit) || item (mCurItem - pageLimit)) { // We are doing a jump by more than one ...
Private Sub Check1_CheckStateChanged(ByVal eventSender As System.Object, _ ByVal eventArgs As System.EventArgs) _ Handles Check1.CheckStateChan ' switch 2D / 3D view... TChart1.Aspect.View3D = ...
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 ...
['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-','About'] 为 FCKConfig.ToolbarSets["Basic"] = [ ['Bold','Italic','-','OrderedList','UnorderedList','-',/*'Link',*/'Unlink',...
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 ...
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. <br/>The ...
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 ...
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. <END><br>50,ComboBox2.zip Combo box. Must see. <END><br>...
- 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 ...