XML

Summary

This lesson took a dramatic turn toward the practical and the entertaining by showing you how XML is used in an extremely popular real-world application. More specifically, you learned how an iTunes music library is coded as an XML document that can be manipulated without too much difficulty. You worked through the specific XML format used by iTunes as well how to create an XSLT stylesheet that drills into that format and extracts information about individual tracks. This tutorial even showed you how to construct hyperlinks to the iTunes music store so that you can provide links between your music library and iTunes for people to buy the songs listed in your library. All of this learning culminated in a complete example that allows you to make your iTunes music library available on the Web for other people to view and use as a basis for shopping for iTunes music.

Q&A

Can I use any version of iTunes to access the music library as XML?

No. Early versions of iTunes stored the music library as specially formatted text without XML tags. Your best bet is to download the latest version of iTunes from Apple at http://www.apple.com/itunes/download/.

Can I use what I learned in this tutorial about iTunes and XML to create podcasts?

Not exactly. Although iTunes podcasts do rely on XML in order to be published properly, they use a different XML format that is based on RSS (Really Simple Syndication). So, there is really no correlation between the XML code used to store an iTunes music library and the XML code used to syndicate a podcast. RSS is discussed in detail in Syndicating The Web With RSS News Feeds.

How do I keep my music library current if I want to publish it on the Web?

Because the itunesview.xsl stylesheet is entirely external, all you must do to update your music library online is to grab (copy or export) the latest XML music library file from iTunes and paste in the line of code that links the stylesheet to it. Publish this file over the previous version and your library is updated and ready to roll!

by BrainBellupdated
Advertisement: