Add to Technorati Favorites

Thursday, 28 June 2007

Step by Step: Making a Podcast, Pt. IV.

At this point in the tutorial, we're pretty much on the home stretch: you've made an episode, and uploaded it to the web. You've also made an XML file, which describes your podcast and links to this mp3 file. Theoretically, we should be at the point where we can start threatening iTunes that you have a new podcast to unleash on the world. However, first we need to make sure that there's no mistakes in your XML file which would cause podasting software to fall over and die.

This is where the similarity between HTML and XML ends. If a mistake is made in a HTML web page, the web browser might display the information a little iffy, but it will probably still display it. If you make a mistake in an XML file, the software will just stop reading your file, and nobody will be able to get your podcast. XML is very unforgiving in this sense, which is why it's important to make sure that your code has no mistakes before you submit it to any podcast directories or iTunes.

So what can go wrong with an XML file? Well, most mistakes will boil down to:
  • Typing error - even one letter out of place can stop your file working if it's in an XML tag.
  • Forgetting to close a tag - this will make anything trying to read your XML file get it's knickers in a twist.
  • Not escaping a character. This is something I'm always doing, and it makes iTunes instantly fall over. I'll explain this properly in a minute.
Just in case you're thinking "Well, I copied and pasted the code exactly, there's no way I could have made any mistakes!" - mistakes have a habit of creeping into XML files without you even noticing, and even if you've not made a mistake this time, there will come a time in the future when you do, so this is good to know about. If you're using something like Dreamweaver, there's much less chance of you making mistakes, as it highlights all the XML tags for you, and this makes things a little easier.

Before you give up on podcasting, thinking that you have to go through your XML with a fine-toothed comb in order to be able to find where the mistakes are, don't worry, help is at hand. Because you've already uploaded your XML to the web, you can now run it through a feed validator. This is a web program which will pick apart your code, and tell you about any errors it finds. You fix them, re-upload the file, and then try again. When you eventually get to the point when you have no errors in your code, you've achieved the amazing, and you're ready to test your podcast in iTunes, and then submit it to the directory.

Head over to the Feed Validator here. You'll notice it looks a lot like Google. All you do is type (or copy and paste) the URL of your XML file into the box and press the Validate button. You'll see a list of errors in your XML (and in most cases, an explanation on how to fix them), then a copy of your code, showing you exactly where the errors are. If you've just copied and pasted the code I gave yesterday, you'll probably have 2 errors which are non-critical (ie. they won't stop your XML from being read, but it's advising that you should do something about it):
  • item should contain a guid element
    iTunes likes to have a Globally Unique Identifier, to differentiate every single episode of every podcast - however, if this tag is not included, iTunes will just create it's own guid from the mp3 filename associated with the episode.
  • Missing recommended iTunes channel element: itunes:explicit
    This is another tag you can add to each episode (or under the <channel> tag, meaning that all episodes will have strong language) to tell iTunes that the recording contains explicit language. This is what it looks like:
    <itunes:explicit>yes</itunes:explicit> - use if your episode does contain strong language
    - use if your episode does not contain strong language
    - use if your episode contains no strong language or anything that might be considered offensive in any way.
Something else that is very important to watch out for when coding your XML is making sure that you have escaped your characters. This is nothing to do with writing a novel about Colditz or anything even that exciting, unfortunately. Basically, in XML there are certain symbols which have special meanings, and if you want them to show up the way you intended, you have to substitute them with little codes. You've seen this already, without realizing it, probably - take a look at this snippet from yesterday's code:

<itunes:category text="Places &amp; Travel"></itunes:category>

The category shows up in iTunes as "Places & Travel", yet in your code, it's "Places &amp;amp;amp;amp;amp;amp; Travel". This is because the ampersand symbol has a special meaning for programs trying to interpret XML, so by substituting the &amp; code, you're telling it that you actually want the ampersand to show up in the text, and not to interpret it as a piece of programming. Here is a list of symbols that need to have these escape codes in place of them:
Character name xml
& ampersand &amp;amp;amp;amp;amp;amp;
< less-than sign &lt;
> greater-than sign &gt;
apostrophe '
" quotation &quot;
Try to be aware of these characters when coding your XML, as even one without the correct code substituted instead will stop iTunes (and most other podcasting software) from being able to read your file. I usually find it helpful to do a find-and-replace on the & symbol before I publish a new episode of my podcast (Ctrl-H in notepad/found under the "edit" menu in most other editors).
Once you've validated your feed, and it's not throwing up any significant errors (remember you'll have to save your file in your editor, then upload it to the same place as before, then put it through the validator to check the new version), it's time to test it in iTunes to see if it works, before we submit your podcast to the directory.
  • Open iTunes
  • Click Advanced (on the menu bar) > "Subscribe to Podcast..."

  • Type the URL of your podcast, and click ok.
  • You'll be taken to the podcast area of iTunes, and iTunes will start trying to get your podcast. All being well, you should see a spinning orange icon next to your podcast title, indicating that it's currently being downloaded:

    If it's not worked, and iTunes has found an error in your XML, or can't find the URL you're pointing it to for the mp3 file, you'll get an exclamation mark next to your podcast:

    In this case, you need to go back to your XML code, find the problem (or problems), correct them, and try this process again. If your code has validated ok, then chances are you've either not escaped a symbol somewhere in your code, or you've put the wrong URL to your mp3 file in your code. Pay special attention to these things.
If you got the spinning orange icon first time, congratulations! You now have a working podcast! Next we'll look at submitting your podcast to the iTunes directory, so you can start getting some listeners!

No comments:

Post a Comment