Hi - I have some content that want to seed my Blog with. I am using the Blogger java APIs to create the posts. I have about 250 posts that I want to create. I could do that and the blog posts were getting created until after about 50 successful posts to blogger (through the java APIs) I hit the rate limit. So I decided that I will generate an XML file in the import format and upload all the posts in one shot.
In my situation, I only have some content that I want to create as posts in my blog. I am not migrating another blog to blogger. I also dont have any comments related to my posts. I simply want to create a large number of posts to seed my blog initially.
However, I am facing several difficulties in this route.
The code snippet to create the xml file that I am using to create the import file is as below
Entry myEntry = new Entry();
// setup all the attributed of Entry such as title, content, publish date, categories, etc
FileOutputStream fos = new FileOutputStream(atomFileName, false); //assume "atomFIleName" is set to "MyBlogPosts.xml".
Writer w = new OutputStreamWriter(fos, "UTF-8");
XmlWriter writer = new XmlWriter(w);
myEntry.generateAtom(writer, myService.getExtensionProfile());
//myEntry.generateRss(writer, myService.getExtensionProfile());
writer.flush();
w.write(System.getProperty("line.separator"));
w.flush();
This generates MyBlogPosts.xml whose content is as below
<atom:entry xmlns:atom='
http://www.w3.org/2005/Atom' xmlns:media='
http://search.yahoo.com/mrss/' xmlns:thr='
http://purl.org/syndication/thread/1.0'><atom:published>2012-04-27T14:10:04.265+05:30</atom:published><atom:category scheme='
http://www.blogger.com/atom/ns#' term='Yearly'/><atom:category scheme='
http://www.blogger.com/atom/ns#' term='Without Constraints'/><atom:category scheme='
http://www.blogger.com/atom/ns#' term='Performance'/><atom:title type='text'>Yearly Report: 01-Jan-2012 to 27-Apr-2012</atom:title><atom:content type='html'>Hello World</atom:content><atom:author><atom:name>Nifty Analytics</atom:name><atom:email>
m...@gmail.com</atom:email></atom:author></atom:entry>
The same xml when pretty printed is below
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:thr="http://purl.org/syndication/thread/1.0">
<atom:published>2012-04-27T14:10:04.265+05:30</atom:published>
<atom:category scheme="http://www.blogger.com/atom/ns#" term="Yearly"/>
<atom:category scheme="http://www.blogger.com/atom/ns#" term="Without Constraints"/>
<atom:category scheme="http://www.blogger.com/atom/ns#" term="Performance"/>
<atom:title type="text">Yearly Report: 01-Jan-2012 to 27-Apr-2012</atom:title>
<atom:content type="html">Hello World</atom:content>
<atom:author>
<atom:name>Nifty Analytics</atom:name>
<atom:email>m...@gmail.com</atom:email>
</atom:author>
</atom:entry>However, when I go to Settings->Other->Import Blog, select MyBlogPosts.xml, enter the captcha and click import, I get the error
"Finished: Sorry, the import failed due to a server error. The error code is bX-lyly16"
I tested this in IE9, Firefox 12 and Chrome 18.0.1025.162 m and I get the same error.
As I was repeating this experiment several times, using Firefox, sometimes, even when I clicked "Settings->Other->Import Blog" without even selecting a file name to import, I am getting the bX-lyly16 error.
Can somebody help me with some pointers here, so that I can import my content into the blog?
Assuming I can eventually do the import successfully for one post, how do I generate the XML file such that it contains all the posts? Can I simply have multiple lines (one per post) in the same file and the import be successful?
i.e
change
FileOutputStream fos = new FileOutputStream(atomFileName, false);
to
FileOutputStream fos = new FileOutputStream(atomFileName, true); // set append to file as true, since this code snippet is called in a loop for each post to the blog.
Any help is greatly appreciated.
Thanks
Nagesh