• I’m fiddling with WordPress trying to decide if I want to switch to it. My blog is at Powerblogs, so there’s not a trivial way to transfer posts, etc.

    I wrote a perl script to convert my present blogroll to an OPML file so I could upload it, but the upload consistently fails. The error message is

    XML error: Invalid document end at line 1

    I’ve read extensively at opml.org, studied several example opml files and read the code in wp-admin/link-import.php.

    I can’t for the life of me figure out what’s wrong.

    Here’s the perl script

    #!/usr/bin/perl
    my $file="blogroll_list_0.html";
    my $output="blogroll.opml";
    my ($one, $two, $three, $four, $five, $six, $seven, $eight);
    print "<?xml version="1.0"?>n";
    print "  <opml version="1.0">n";
    print "    <head>n";
    print "      <title>"Blogroll"</title>n";
    print "      <dateCreated>Thu, 15 Feb 2007 03:24:18 GMT</dateCreated>n";
    print "    </head>n";
    print "    <body>n";
    print "      <outline type="category" title="Blogroll">n";
    open(FILE,$file) or die "Can't open $filen";
    while(<FILE>) {
      ($one, $two, $three, $four, $five, $six, $seven, $eight) = split(/[<>=]/,$_,8);
      print "        <outline text="$seven" type="link" xmlUrl="" htmlUrl=$six updated="" />n";
    }
    close(FILE);
    print "    </outline>n";
    print "  </body>n";
    print "</opml>n";

    Here’s a small part of the file (I have 274 blogs in my blogroll.)

    <?xml version="1.0"?>
      <opml version="1.0">
        <head>
          <title>"Blogroll"</title>
          <dateCreated>Thu, 15 Feb 2007 03:24:18 GMT</dateCreated>
        </head>
        <body>
          <outline type="category" title="Blogroll">
            <outline text="J Barne's Coffee Shop" type="link" xmlUrl="" htmlUrl="http://jbarnescoffee.blogspot.com/" updated="" />
            <outline text="Jennifer's History and Stuff" type="link" xmlUrl="" htmlUrl="http://jenlars.mu.nu/" updated="" />
            <outline text="Jeremiah Stoddard" type="link" xmlUrl="" htmlUrl="http://www.jeremiahstoddard.com/" updated="" />
    ..............
    <outline text="A Youth's View from the Right" type="link" xmlUrl="" htmlUrl="http://tokenyoungconservative.blogspot.com/" updated="" />
            <outline text="Zenpundit" type="link" xmlUrl="" htmlUrl="http://zenpundit.blogspot.com/" updated="" />
        </outline>
      </body>
    </opml>

    So what the heck am I doing wrong?

Viewing 2 replies - 1 through 2 (of 2 total)
  • There’s a bug in the most recent code concerning the OPML importer. The uploader doesn’t work but the URL importer does.

    http://trac.wordpress.org/ticket/3712

    You don’t mention what format your current blogroll is in. If it’s just html, I usually recommend using this converter. Seems to work fine:

    http://www.smartpeer.net/jiescripts/html2opml.php

    You just have to put the resulting file up somewhere on teh web and point wp to it.

    Hope this helps,
    -drmike

    Thread Starter antimedia

    (@antimedia)

    Thanks for the tip. Don’t know why, but it never even occurred to me to put the file on my website and import it that way. The perl script I wrote formats the opml file correctly, but I’ll take a look at the one you linked to as well.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Problems with OPML blogroll upload’ is closed to new replies.