Just as we showed what could be done with JSON in the preceding recipe, the Last.fm file also allows you to take data from its services in XML format. In this recipe, we will show you how to do this.
Importing data from an external XML file
Getting ready
To prepare importing top tracks from Last.fm in the XML format, follow these steps:
- Start with the first three steps from the Getting ready section in the Importing data from an external JSON file recipe.
- Then, let's check the structure of the XML endpoint for the top folk tracks (for example, http://ws.audioscrobbler.com/2.0/?method=tag.gettoptracks&tag=disco&api_key=xxx&format=xml, but with a real API key) as follows:
<?xml version="1.0" encoding...