FileDocCategorySizeDatePackage
XmlCellEntryGDataSerializer.javaAPI DocAndroid 1.5 API2938Wed May 06 22:41:16 BST 2009com.google.wireless.gdata.spreadsheets.serializer.xml

XmlCellEntryGDataSerializer

public class XmlCellEntryGDataSerializer extends com.google.wireless.gdata.serializer.xml.XmlEntryGDataSerializer
A serializer for handling GData Spreadsheets Cell entries.

Fields Summary
public static final String
NAMESPACE_GS
The namespace to use for the GData Cell attributes
public static final String
NAMESPACE_GS_URI
The URI of the GData Cell namespace
Constructors Summary
public XmlCellEntryGDataSerializer(com.google.wireless.gdata.parser.xml.XmlParserFactory xmlFactory, com.google.wireless.gdata.data.Entry entry)
Creates a new XmlCellEntryGDataSerializer.

param
entry the entry to be serialized


                     
      
              
        super(xmlFactory, entry);
    
Methods Summary
protected voiddeclareExtraEntryNamespaces(org.xmlpull.v1.XmlSerializer serializer)
Sets up the GData Cell namespace.

param
serializer the serializer to use

        serializer.setPrefix(NAMESPACE_GS, NAMESPACE_GS_URI);
    
protected voidserializeExtraEntryContents(org.xmlpull.v1.XmlSerializer serializer, int format)

        CellEntry entry = (CellEntry) getEntry();
        int row = entry.getRow();
        int col = entry.getCol();
        String value = entry.getValue();
        String inputValue = entry.getInputValue();
        if (row < 0 || col < 0) {
            throw new ParseException("Negative row or column value");
        }

        // cells require row & col attrs, and allow inputValue and
        // numericValue
        serializer.startTag(NAMESPACE_GS_URI, "cell");
        serializer.attribute(null /* ns */, "row", "" + row);
        serializer.attribute(null /* ns */, "col", "" + col);
        if (inputValue != null) {
            serializer.attribute(null /* ns */, "inputValue", inputValue);
        }
        if (entry.hasNumericValue()) {
            serializer.attribute(null /* ns */, "numericValue", entry
                    .getNumericValue());
        }

        // set the child text...
        value = StringUtils.isEmpty(value) ? "" : value;
        serializer.text(value);
        serializer.endTag(NAMESPACE_GS_URI, "cell");