我正在尝试使用 google docs api 上传 xml 文档。但我得到了非法参数异常的异常(exception)
上传文档的代码是
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)是
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)
我知道上传任何类型的文档仅适用于高级帐户,但我的问题是找出是否有解决此问题的方法?
谢谢, 萨娜。
最佳答案
我有更好的方法在这里上传任何文档 http://code.google.com/a/eclipselabs.org/p/googledocs-rse/这很快。如果有人还有其他内容,请在此发布。
关于java - Google docs api -- 上传 XML 文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5229584/