用于在Wordpress中导入内容的XML格式

I need to create a XML with the content of an old site to import in Wordpress with oficial Wordpress Importer Plugin. Based on XML exported by Wordpress, I can create a compatible export export of my content. This export is like this example:

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" ...>
<!-- xml header based on Wordpress export -->

<?php foreach($posts as $post): ?>
    <item>
        <title><?php echo $post['title']; ?></title>            
        <pubDate><?php echo date('r', strtotime($post['date'])); ?></pubDate>
        <dc:creator>admin</dc:creator>          
        <description></description>
        <content:encoded><![CDATA[<?php echo $post['content']; ?>]]></content:encoded>
        <excerpt:encoded><![CDATA[<?php echo $post['excerpt']; ?>]]></excerpt:encoded>          
        <wp:post_date><?php echo $post['date']; ?></wp:post_date>
        <wp:post_date_gmt><?php echo $post['date']; ?></wp:post_date_gmt>
        <wp:comment_status>open</wp:comment_status>
        <wp:ping_status>open</wp:ping_status>           
        <wp:status>publish</wp:status>
        <wp:post_parent>0</wp:post_parent>
        <wp:menu_order>0</wp:menu_order>
        <wp:post_type>post</wp:post_type>
        <wp:post_password></wp:post_password>
        <wp:is_sticky>0</wp:is_sticky>
        <category><![CDATA[<?php echo $post['category']; ?>]]></category>
        <category domain="category" nicename="<?php echo StringToSlug::gen($post['category']); ?>"><![CDATA[<?php echo $post['category']; ?>]]></category>
        <wp:postmeta>
            <wp:meta_key>_edit_last</wp:meta_key>
            <wp:meta_value><![CDATA[1]]></wp:meta_value>
        </wp:postmeta>

    </item>
<?php endif; ?>

Wordpress imports this well. Now I want to add a thumbnail to each post. I only find examples with the id of the image post ID, like these example:

<wp:postmeta>
    <wp:meta_key>_thumbnail_id</wp:meta_key>
    <wp:meta_value><![CDATA[43]]></wp:meta_value>
</wp:postmeta>

Of course this do not work for me, because the content does not belong to another Wordpress site. How can I handle that? Is there any other way to import post thumbnail? Or there is another way to import posts for another non-Wordpress (nor non-Blogger/Drupal/Joomla) content?

lets say you have the following in your post's import code:

<wp:postmeta>
    <wp:meta_key>_thumbnail_id</wp:meta_key>
    <wp:meta_value><![CDATA[43]]></wp:meta_value>
</wp:postmeta>

that usually means that this record of type post is referencing another record of type attachment, so lets say you have a post with id# 5 you need to add another item somewhere with <wp:post_type>attachment</wp:post_type> and a <wp:post_parent>5</wp:post_parent> like this:

<item>
    <title>imagefile1</title>
    <link>http://www.mysite.org/yourpostpermalink/attachment/imagefile1/</link>
    <pubDate>Fri, 06 Dec 2013 10:24:03 +0000</pubDate>
    <dc:creator>you</dc:creator>
    <guid isPermaLink="false">http://www.mysite.com/wp-content/uploads/imagefile1.png</guid>
    <description></description>
    <content:encoded><![CDATA[]]></content:encoded>
    <excerpt:encoded><![CDATA[]]></excerpt:encoded>
    <wp:post_id>43</wp:post_id>
    <wp:post_date>2013-12-06 11:24:03</wp:post_date>
    <wp:post_date_gmt>2013-12-06 11:24:03</wp:post_date_gmt>
    <wp:comment_status>closed</wp:comment_status>
    <wp:ping_status>open</wp:ping_status>
    <wp:post_name>imagefile1</wp:post_name>
    <wp:status>inherit</wp:status>
    <wp:post_parent>5</wp:post_parent>
    <wp:menu_order>0</wp:menu_order>
    <wp:post_type>attachment</wp:post_type>
    <wp:post_password></wp:post_password>
    <wp:is_sticky>0</wp:is_sticky>
    <wp:attachment_url>https://www.mysite.com/wp-content/uploads/imagefile1.png</wp:attachment_url>
    <wp:postmeta>
        <wp:meta_key>_wp_attached_file</wp:meta_key>
        <wp:meta_value><![CDATA[imagefile1.png]]></wp:meta_value>
    </wp:postmeta>

</item>

i hope this helps