radio2blosxom

#!/usr/bin/perl

# Radio2Blosxom
# Author: Sam Ruby < rubys@apache.org>
# Version: 0+1i
# Home: http://intertwingly.net/stories/2002/08/11/radio2blosxom.html

# Usage:
#
#   From Radio Tools->Developers->Quick Script:
#
#      file.writeWholeFile( "c:\\exportedWeblog.xml",
#                            table.tableToXml( radio.weblog.init() ) )
#
#   From the blosxom $datadir:
#
#      perl radio2blosxom.pl exportedWeblog.xml

use XML::Parser;
use HTTP::Date;

$p = new XML::Parser(Handlers => {Start => &handle_start,
                                  Char  => &handle_char,
                                  End   => &handle_end});

$p->parsefile($ARGV[0]) || die;

@context = ();

sub handle_start {
  my ($expat, $tag, %attr) = @_;
  push @context, $attr{name} || $tag;
  $title = $attr{value} if $tag eq 'string' and $attr{name} eq 'title';
  $data = "";
}

sub handle_char {
  $data .= @_[1];
}

sub handle_end {
  $tag = pop @context;
  return if $context[1] ne "posts";

  $timestamp = str2time($data) if $tag eq "dateCreated";
  $body=$data if $tag eq "body";

  if ($#context == 1) {
    $tag =~ s/^0*//;
    open BLOG, ">$tag.txt";
    print BLOG "$title\n$body";
    close BLOG;
    utime $timestamp, $timestamp, "$tag.txt";
    $title = "";
  }
}

Essays

Noun vs Verb

Topology

Evolution of the Weblog APIs

Cohesion

SOAP by Example

A Gentle Introduction to Namespaces

Really Simple Syndication

Expect More

REST + SOAP

Beyond Backlinks

Google's Genius

Neuro Transmitters

Headers and Hrefs

A Gentle Introduction to SOAP

Coping with Change

Manufactured Serendipity

Dealing with Diversity

A Busy Developers Guide to WSDL 1.1

Axis/Radio Interop, Actual and Potential

To Infinity and Beyond: the Quest for SOAP Interoperability

What Object Does SOAP Access?

Favorites

In Praise of Evolvable Systems

Metacrap

The Law of Leaky Abstractions

The Eight Fallacies of Distributed Computing

Permanet, Nearlynet, and Wireless Data

Warnock's Dilemma

Sunir's corollaries

Search

Valid XHTML 1.1!