WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Where can I download the schema (or DTD) for the layout of the WordPress import/export file format?

share|improve this question

As far as I know no one ever [publicly] documented it and all questions about that are met with "it's like RSS, want documentation - do it yourself".

share|improve this answer
    
@Rarst- Thanks,but that's odd, I'll do an export this weekend and take a look. I just thought it would be smarter to start with the schema... and all good developers seem to create a schema for the XML. – NealWalters Jan 21 '11 at 17:41
    
@NealWalters yeeeah... having excellent documentation is not exactly what WordPress is known for. :\ Things that are completely undocumented thankfully aren't abundant, but aren't unique occurrence either. – Rarst Jan 21 '11 at 17:47
up vote 1 down vote accepted

It seems to be an RSS Feed http://en.wikipedia.org/wiki/RSS extended with some of WordPress's own extensions. Unfortunately, it applies only to posts and pages. I was thinking about using it to migrate data from PHP-Fusion to WordPress, but it would only be a partial solution.

I tried some of the naemspaces below in the browser to see if they would give me a schema or DTD, but they did not.

Here's an example:

<rss version="2.0"
    xmlns:excerpt="http://wordpress.org/export/1.0/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.0/"
>

<channel>
    <title>MrHebrew.com</title>
    <link>http://mrhebrew.com</link>
    <description>My Site Descr</description>
    <pubDate>Wed, 05 Jan 2011 05:54:07 +0000</pubDate>
    <generator>http://wordpress.org/?v=3.0.3</generator>
    <language>en</language>
    <wp:wxr_version>1.0</wp:wxr_version>
    <wp:base_site_url>http://mrhebrew.com</wp:base_site_url>
    <wp:base_blog_url>http://mrhebrew.com</wp:base_blog_url>
        <wp:category><wp:category_nicename>adam-and-eve</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Adam and Eve]]></wp:cat_name></wp:category>
        <wp:category><wp:category_nicename>book-of-joshua</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Book of Joshua]]></wp:cat_name></wp:category>
        <wp:tag><wp:tag_slug>jeremiah</wp:tag_slug><wp:tag_name><![CDATA[Jeremiah]]></wp:tag_name></wp:tag>
        <wp:tag><wp:tag_slug>joshua</wp:tag_slug><wp:tag_name><![CDATA[Joshua]]></wp:tag_name></wp:tag>
        <wp:tag><wp:tag_slug>judges</wp:tag_slug><wp:tag_name><![CDATA[Judges]]></wp:tag_name></wp:tag>
        <wp:tag><wp:tag_slug>king-saul</wp:tag_slug><wp:tag_name><![CDATA[King Saul]]></wp:tag_name></wp:tag>
        <item>
        <title>Another Possible Punctuation Changes Meaning Entirely</title>
        <link>http://mrhebrew.com/?p=136</link>
        <pubDate>Wed, 05 Jan 2011 05:52:49 +0000</pubDate>
        <dc:creator><![CDATA[Administrator]]></dc:creator>

        <category><![CDATA[Isaiah]]></category>

        <category domain="category" nicename="isaiah"><![CDATA[Isaiah]]></category>

        <category><![CDATA[Punctuation]]></category>

        <category domain="category" nicename="punctuation"><![CDATA[Punctuation]]></category>

        <category domain="tag"><![CDATA[punctuation]]></category>

        <category domain="tag" nicename="punctuation-2"><![CDATA[punctuation]]></category>

        <category domain="tag"><![CDATA[question-mark]]></category>

        <category domain="tag" nicename="question-mark"><![CDATA[question-mark]]></category>

        <guid isPermaLink="false">http://mrhebrew.com/?p=136</guid>
        <description></description>
        <content:encoded><![CDATA[
text of blog here 
]]></content:encoded>
        <excerpt:encoded><![CDATA[]]></excerpt:encoded>
        <wp:post_id>136</wp:post_id>
        <wp:post_date>2011-01-05 05:52:49</wp:post_date>
        <wp:post_date_gmt>2011-01-05 05:52:49</wp:post_date_gmt>
        <wp:comment_status>open</wp:comment_status>
        <wp:ping_status>open</wp:ping_status>
        <wp:post_name>another-possible-punctuation-changes-meaning-entirely</wp:post_name>
        <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>
                                <wp:postmeta>
        <wp:meta_key>_edit_lock</wp:meta_key>
        <wp:meta_value><![CDATA[1294206847]]></wp:meta_value>
        </wp:postmeta>
                <wp:postmeta>
        <wp:meta_key>_edit_last</wp:meta_key>
        <wp:meta_value><![CDATA[1]]></wp:meta_value>
        </wp:postmeta>
                <wp:postmeta>
        <wp:meta_key>_encloseme</wp:meta_key>
        <wp:meta_value><![CDATA[1]]></wp:meta_value>
        </wp:postmeta>
                <wp:postmeta>
        <wp:meta_key>_wp_old_slug</wp:meta_key>
        <wp:meta_value><![CDATA[]]></wp:meta_value>
        </wp:postmeta>
                <wp:postmeta>
        <wp:meta_key>_pingme</wp:meta_key>
        <wp:meta_value><![CDATA[1]]></wp:meta_value>
        </wp:postmeta>
                <wp:postmeta>
        <wp:meta_key>_wp_old_slug</wp:meta_key>
        <wp:meta_value><![CDATA[another-possible-punctuation-changs-meaning-entirely]]></wp:meta_value>
        </wp:postmeta>
                                <wp:comment>
        <wp:comment_id>267</wp:comment_id>
        <wp:comment_author><![CDATA[sex tubes]]></wp:comment_author>
        <wp:comment_author_email>tu23me66ner@gmail.com</wp:comment_author_email>
        <wp:comment_author_url>http://41tube.com</wp:comment_author_url>
        <wp:comment_author_IP>89.149.244.89</wp:comment_author_IP>
        <wp:comment_date>2011-01-08 20:26:32</wp:comment_date>
        <wp:comment_date_gmt>2011-01-08 20:26:32</wp:comment_date_gmt>
        <wp:comment_content><![CDATA[I can see the logic in your argument but I think you've painted your strokes]]></wp:comment_content>
        <wp:comment_approved>spam</wp:comment_approved>
        <wp:comment_type></wp:comment_type>
        <wp:comment_parent>0</wp:comment_parent>
        <wp:comment_user_id>0</wp:comment_user_id>
        </wp:comment>
            </item>
    </channel>
</rss>
share|improve this answer

Here you can find an example with most important tags of a DTD used for example by InDesign for testing purposes. By reading the WordPress XML exported (WP v3.2.1), it is easy to choose and add the right tags in the right place.

<?xml version="1.0" encoding="UTF-8" ?>
    <!ELEMENT rss ( channel ) >

    <!ELEMENT channel ( item+ ) >

    <!ELEMENT item ( title, link, pubDate, dc:creator, content:encoded ) >

    <!ELEMENT title ( #PCDATA ) >

    <!ELEMENT link ( #PCDATA ) >

    <!ELEMENT pubDate ( #PCDATA ) >

    <!ELEMENT dc:creator (#PCDATA ) >

    <!ELEMENT content:encoded ( #PCDATA ) >

A reference link for DTD

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.