davidlks83 / google-spreadsheet-lib-android

Automatically exported from code.google.com/p/google-spreadsheet-lib-android
0 stars 0 forks source link

List retrieval dysfunctional #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the sample app
2. Read any worksheet as a list
3. There will be as many blank rows in the list as there are rows in the 
spreadsheet (except the header)

I would have expected the list to be populated with something that resembles 
the source worksheet.

After some debugging I realized that the issue is with namespaces. The 
SAXParser (or actually the underlying XMLReader) will strip the namespace 
prefixes from the node names, and pass the complete URI in the uri parameter to 
StartElement. This is expected behaviour, not an Android quirk.

I fixed that by adding the following piece of code to StartElement:

        if (uri.equals("http://schemas.google.com/spreadsheets/2006/extended"))
            node = "gsx:" + node;
        else if (uri.equals("http://schemas.google.com/g/2005"))
            node = "gd:" + node;
        else if (uri.equals("http://a9.com/-/spec/opensearch/1.1/"))
            node = "openSearch:" + node;
        else if (uri.equals("http://www.w3.org/2007/app"))
            node = "app:" + node;
        else if (uri.equals("http://schemas.google.com/spreadsheets/2006"))
            node = "gs:" + node;

The code in DoCustomizationsForSDK isn't needed, so I removed that.

Original issue reported on code.google.com by rune.biv...@gmail.com on 6 Apr 2011 at 8:57