我想上傳使用谷歌文檔API的XML文檔。但我得到的非法參數異常谷歌文檔API - 上傳XML文檔
代碼除外上傳的文檔是
File file = new File("/Users/Sana/Downloads/Sana_Upload_test.xml");
DocumentEntry newDocument = new DocumentEntry();
newDocument.setFile(file, "xml");
newDocument.setTitle(new PlainTextConstruct("Sana.xml"));
client.insert(new URL("https://docs.google.com/feeds/default/private/full/"), newDocument);
,我得到的是
Exception in thread "main" java.lang.IllegalArgumentException: Invalid media type:xml
at com.google.gdata.util.ContentType.<init>(ContentType.java:323)
at com.google.gdata.data.docs.DocumentListEntry.setFile(DocumentListEntry.java:298)
at Documents.main(Documents.java:74)
我知道的任何類型的文件是上傳的異常只適用於總理帳戶,但我的問題是要確定是否有任何解決此問題的方法?
感謝, 薩納。
這是我的XML文件轉換爲.doc格式,這是我不想要的。 – Sana 2011-03-08 18:54:43
是的。我知道。如果您有Google App的首要帳戶,則可以使用URL選項的「?convert = false」進行上傳。但是我很抱歉我無法嘗試。 – 2011-03-09 02:39:31
不幸的是,我沒有一個首要的帳戶。 :-( – Sana 2011-03-09 05:57:57