}
}
// -----------------------------------------------------
// start XML generation
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0"
    xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:wp="http://wordpress.org/export/1.2/"
></rss>
XML;
$rss = new SimpleXMLExtended($xml);
$namespaces = $rss->getDocNamespaces(true);
// load the Newblur exported JSON file
$file = file_get_contents("starred_stories.json");
$json = json_decode($file, true);
// Wordpress will choke if our post names aren't unique, so we track
// them separately
$post_names = array();
$channel = $rss->addChild("channel");
$channel->addChild("generator", basename(__FILE__));
$channel->addChild("wxr_version", "1.2", $namespaces["wp"]);
// base_site_url is MUST. WordPress Importer warns if this does not exist
$channel->addChild("base_site_url", "http://asiajin.com/blog", $namespaces["wp"]);
foreach ($json["stories"] as $item) {
    $rssItem = $channel->addChild("item");
    $content = null;
    if (array_key_exists('story_content', $item)) {