Error: Failed to import tag/post

After a long day of tweaking, I found there were several problems:

  1. The whitespace in the XML matters.

The importer throws errors when each item’s child elements are not in the same line. Any whitespace between them will cause an indentation error and fail that row’s import. This doesn’t seem to matter on the actual post or page items themselves, but it does on the categories and tags.

  1. Tag-descriptions cannot contain carriage return/line feeds. Replace these with ‘<br />’.

  2. HTML encode ALL non alpha-numeric characters. Currency signs, cedillas/accents/umlauts, single quotes, apostrophes, hyphens and many more will all break the importer. Some are OK, but I’m not sure exactly which, so won’t bother qualifying this statement, just encode the whole damn thing.

Those are the devilishly hard to spot errors that wasted so much of my time, I hope it saves you some!