FileDocCategorySizeDatePackage
XmlWorksheetsGDataParser.javaAPI DocAndroid 1.5 API3641Wed May 06 22:41:16 BST 2009com.google.wireless.gdata.spreadsheets.parser.xml

XmlWorksheetsGDataParser

public class XmlWorksheetsGDataParser extends com.google.wireless.gdata.parser.xml.XmlGDataParser
Parser helper for non-Atom data in a GData Spreadsheets Worksheets meta-feed.

Fields Summary
protected static final String
CELLS_FEED_REL
The rel ID used by the server to identify the cells feed for a worksheet
protected static final String
LIST_FEED_REL
The rel ID used by the server to identify the list feed for a worksheet
Constructors Summary
public XmlWorksheetsGDataParser(InputStream is, XmlPullParser xmlParser)
Creates a new XmlWorksheetsGDataParser.

param
is the stream from which to read the data
param
xmlParser the XmlPullParser to use to parse the raw XML
throws
ParseException if the super-class throws one


                                          
        
              
        super(is, xmlParser);
    
Methods Summary
protected com.google.wireless.gdata.data.EntrycreateEntry()

        return new WorksheetEntry();
    
protected com.google.wireless.gdata.data.FeedcreateFeed()

        return new WorksheetFeed();
    
protected voidhandleExtraElementInEntry(com.google.wireless.gdata.data.Entry entry)

        XmlPullParser parser = getParser();
        if (!(entry instanceof WorksheetEntry)) {
            throw new IllegalArgumentException("Expected WorksheetEntry!");
        }
        WorksheetEntry worksheet = (WorksheetEntry) entry;

        // the only custom elements are rowCount and colCount
        String name = parser.getName();
        if ("rowCount".equals(name)) {
            worksheet.setRowCount(StringUtils.parseInt(XmlUtils
                    .extractChildText(parser), 0));
        } else if ("colCount".equals(name)) {
            worksheet.setColCount(StringUtils.parseInt(XmlUtils
                    .extractChildText(parser), 0));
        }
    
protected voidhandleExtraLinkInEntry(java.lang.String rel, java.lang.String type, java.lang.String href, com.google.wireless.gdata.data.Entry entry)

        if (LIST_FEED_REL.equals(rel) && "application/atom+xml".equals(type)) {
            WorksheetEntry sheet = (WorksheetEntry) entry;
            sheet.setListFeedUri(href);
        } else if (CELLS_FEED_REL.equals(rel)
                && "application/atom+xml".equals(type)) {
            WorksheetEntry sheet = (WorksheetEntry) entry;
            sheet.setCellFeedUri(href);
        }