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

XmlSpreadsheetsGDataParserFactory

public class XmlSpreadsheetsGDataParserFactory extends Object implements com.google.wireless.gdata.client.GDataParserFactory
A GDataParserFactory capable of handling Spreadsheets.

Fields Summary
private com.google.wireless.gdata.parser.xml.XmlParserFactory
xmlFactory
The XmlParserFactory to use to actually process XML streams.
Constructors Summary
public XmlSpreadsheetsGDataParserFactory(com.google.wireless.gdata.parser.xml.XmlParserFactory xmlFactory)

        this.xmlFactory = xmlFactory;
    
private XmlSpreadsheetsGDataParserFactory()
Intentionally private.

    
Methods Summary
public com.google.wireless.gdata.parser.GDataParsercreateParser(java.io.InputStream is)

        // attempt a default
        return createParser(SpreadsheetEntry.class, is);
    
public com.google.wireless.gdata.parser.GDataParsercreateParser(java.lang.Class entryClass, java.io.InputStream is)

        try {
            XmlPullParser xmlParser = xmlFactory.createParser();
            if (entryClass == SpreadsheetEntry.class) {
                return new XmlSpreadsheetsGDataParser(is, xmlParser);
            } else if (entryClass == WorksheetEntry.class) {
                return new XmlWorksheetsGDataParser(is, xmlParser);
            } else if (entryClass == CellEntry.class) {
                return new XmlCellsGDataParser(is, xmlParser);
            } else if (entryClass == ListEntry.class) {
                return new XmlListGDataParser(is, xmlParser);
            } else {
                throw new ParseException("Unrecognized feed requested.");
            }
        } catch (XmlPullParserException e) {
            throw new ParseException("Failed to create parser", e);
        }
    
public com.google.wireless.gdata.serializer.GDataSerializercreateSerializer(com.google.wireless.gdata.data.Entry entry)

        if (entry instanceof ListEntry) {
            return new XmlListEntryGDataSerializer(xmlFactory, entry);
        } else if (entry instanceof CellEntry) {
            return new XmlCellEntryGDataSerializer(xmlFactory, entry);
        } else {
            throw new IllegalArgumentException(
                    "Expected a ListEntry or CellEntry");
        }