Friday, November 26, 2010

A Simple Flowchart for XML Parsing

I forget things easily. So I'd like to keep a note for my recent study about XML Document parsing and framing. Framing is easier as it is a controllable data source I provide. So I will focus on the parsing part of it.

I hereby is showing a flow chart I just drew for the XML parsing procedure. I guess I must have made some errors in it and it is not qualified to be good enough. However, like I said, this is a note I am trying to keep. If you know what can be improved, please don't hesitate.


Some notes that everyone should know:
  1. The most frustrating thing I found is there is *NO* single package that can provide me parsing, framing, validating, data-binding code generation in C language while this is the language we used in most embedded systems.
  2. Some of the steps in this flowchart be merged into one single step.
  3. There are commercial products available with all the needed functions. Even with HTTP client/server in case you need to use XML over Web.
  4. Links on Wikipedia about data-binding: http://en.wikipedia.org/wiki/XML_data_binding.
  5. The most comprehensive list of resources about XML data binding: http://www.rpbourret.com/xml/XMLDataBinding.htm

ps. Drawn with Dia 0.97.1 Windows version.

Saturday, November 13, 2010

Android ListActivity Problem

I met these error messages last night and found the cause was I did not read document thorough. :)

11-12 14:33:19.976: WARN/ActivityManager(73): Launch timeout has expired, giving up wake lock!
11-12 14:33:20.164: WARN/ActivityManager(73): Activity idle timeout for HistoryRecord{44f542b8 com.demo.wally/.listview}

ListActivity is another kind of Activity that has a built-in ListView. I called the method: setContentView, under a ListActivity context, so I was destined for this problem.

In this ListActivity, a fullscreen ListView is used. To customize my own screen, I need to either take advantage of possible ListView options or create another view with ListView in it and use a normal Activity to create data adapters, and so on.

Friday, November 12, 2010

XML File Indentation

I copied contents from a PDF file (I can't find its original version with proper indentation) and pasted into an XML file. The resulting file is flat with no indentation at all. After trying to fix it using vim and other text editors. I decide to give it a try to find a formatter. And I found one:


Useful to me a least.

Thursday, November 11, 2010

Cookie Flag: HttpOnly

Today when I am trying to understand how cookies work in libcurl (). I found some cookies from Google has a strange flag behind it: HttpOnly.

I know this is a common sense to every web developer. As an embedded system engineer that never dealt with any web programming in last 9 years, I think I am eligible to not knowing it...

Anyway, it is shown by an example source code of libcurl as:

[1]: .google.com.tw TRUE / FALSE 1352547231 PREF ID=id_removed:FF=0:TM=1289474431:LM=1289475431:S=oLGFV.....
[2]: #HttpOnly_.google.com.tw TRUE / FALSE 1305286631 NID 40=T9tf9Y.....

This #HttpOnly_ confused me. After some research, I found that because malicious Javascript code may be able to access other website's cookies and transfer them to its site. This is a cookie theft as described in Wikipedia (http://en.wikipedia.org/wiki/HTTP_cookie#Cookie_theft).

This flag blocks cookies flagged as HttpOnly being accessed by any scripts from originating website and hence prevents injected malicious code from sending important cookies to another site.