blogger convert to dasblog


 


See:


http://onemanshouting.com/tech/HowIPortedMyContentFromBloggerToDasBlog.aspx


1.  Change Blogger.com settings, under “Formatting” tell it to show 999 days on the front page.  DO NOT PUBLISH


2.  Modify your blogger template to:


<?xml encoding=”utf-8″ ?>
<entries>
<Blogger>
<bi_url><![CDATA[<$BlogItemURL$>]]></bi_url>
<bi_title><![CDATA[<$BlogItemTitle$>]]></bi_title>
<bi_body><![CDATA[<$BlogItemBody$>]]></bi_body>
<bi_author><![CDATA[<$BlogItemAuthorNickname$>]]></bi_author>
<bi_date><![CDATA[<$BlogItemDateTime$>]]></bi_date>
</Blogger>
</entries>


3.  DO NOT PUBLISH, instead hit the “Preview” button


4.  In the resulting screen, you’ll see a bunch of unformatted text.  Select “View Source” and then copy everything from the opening <? xml ?> tag down to the closing <entries> tag.  Paste that text into notepad and save as archive.xml.  On the edit screen, hit the “Discard Edits” button.  Go back and restore the settings from step 1.


 


 


Modified C# code:


 


using System;
using System.Globalization;
using System.Collections.Generic;
using System.Text;
using System.Data;
using newtelligence.DasBlog.Runtime;
using System.Threading;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
x();

}
static void x()
{
DataSet ds = new DataSet(“archive”);
ds.ReadXml(@”C:\content\a\refacut.xml”);

string title = “”;
string body = “”;
string link = “”;
string date = “”;
string auth = “”;

DateTime dt_post;

newtelligence.DasBlog.Runtime.IBlogDataService das_ds = newtelligence.DasBlog.Runtime.BlogDataServiceFactory.GetService(@”c:\content”, null);
CultureInfo c=new CultureInfo(“en-US”);
Thread.CurrentThread.CurrentCulture = c;
Thread.CurrentThread.CurrentUICulture = c;
for(int i=0;i<ds.Tables[0].Rows.Count;i++)
{
DataRow r =ds.Tables[0].Rows[i];
link = (string)ds.Tables[“bi_url”].Rows[i][0];
title = (string)ds.Tables[“bi_title”].Rows[i][0];
body = (string)ds.Tables[“bi_body”].Rows[i][0];

date = (string)ds.Tables[“bi_date”].Rows[i][0];
auth = (string)ds.Tables[“bi_author”].Rows[i][0];
string[] expectedFormats = { @”M\/dd\/yyyy hh:mm:ss tt”};
//date = date.Replace(” PM”, “”);
dt_post = DateTime.ParseExact(date, expectedFormats,c, DateTimeStyles.AllowWhiteSpaces);
Entry post = new Entry();
post.Author = auth;

post.Content = body;
post.Description = “”;
post.Title = title;
post.CreatedLocalTime = dt_post;
post.CreatedUtc = dt_post.ToUniversalTime();
post.ModifiedLocalTime = dt_post;
post.ModifiedUtc = dt_post.ToUniversalTime();
post.EntryId = Guid.NewGuid().ToString();
das_ds.SaveEntry(post);

}
}
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *