Retrive radio station list
Posted on June 6, 2011First of all we need to get an list of radiostation. There is a lot of services that already collect this information for us. For me it’s :
http://www.moskva.fm/stations for Moscow radio station
and
http://www.piter.fm/stations for Saint Petersburg radio station
Let’s parse them into this format (schema below)
<?xml version="1.0" encoding="UTF-8"?> <!-- edited with XMLSpy v2008 sp1 (http://www.altova.com) by LolitaRB (EMBRACE) --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="StationList"> <xs:complexType> <xs:sequence> <xs:element name="Station" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="name" type="xs:string"/> <xs:element name="url" type="xs:anyURI"/> <xs:element name="freq" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
In each url the number is station id. For example http://www.moskva.fm/play/4001/translation 4001 it’s ID
As result we gat an list of station in XML format next you can see part of it:
<StationList>
<Station>
<name>Relax FM</name>
<url>http://www.moskva.fm/play/4014/translation</url>
<freq>90.8 FM</freq>
</Station>
<Station>
<name>DFM</name>
<url>http://www.moskva.fm/play/2002/translation</url>
<freq>101.2 FM</freq>
</Station>
<!-- ... !-->
</StationList>
In the next post i’ll show you how to generate a class from xsd schema
