next up previous contents
Next: Specifying additional metainformation Up: Enhanced ``enclosures'' support in Previous: Differencies from existing ``enclosures''   Contents

Examples

The following is an example of a simple enclosure for one MPEG audio file for RSS 2.0 feed:


<enc:Enclosure 
    enc:url="http://www.crocodile.org/sounds/matrosi.mp3" 
    enc:length="1939570" 
    enc:type="audio/mpeg" />

The following example shows two unrelated audio enclosures. They will be played in order they appear.


<enc:Enclosures kind="mixed">
   <enc:Enclosure 
       enc:url="http://www.crocodile.org/sounds/matrosi.mp3" 
       enc:length="1939570" 
       enc:type="audio/mpeg" />
       enc:Content-ID="foo1@bar.net" />
   <enc:Enclosure 
       enc:url="http://www.crocodile.org/sounds/ya_segodnya_smeus_nad_soboi.mp3"
       enc:length="1691400" 
       enc:Content-ID="foo2@bar.net"
       enc:type="audio/mpeg" />
</enc:Enclosures>

An example of composite enclosure for audio files in several alternate formats (with ``MP3'' being default and most preferable and ``WAV'' least preferable). Some of files are offered via BitTorrent protocol for download. One file is distributed from two servers, one in US and one in Ukraine. Please note that most preffered format is ``mp3'' downloaded via BitTorrent.


<enc:Enclosures kind="alternative">
   <enc:Enclosure 
       enc:url="http://www.crocodile.org/sounds/matrosi.mp3.torrent" 
       enc:transport="application/x-bittorrent"
       enc:length="1939570" 
       enc:type="audio/mpeg" />
   <enc:Enclosure 
       enc:url="http://www.crocodile.org/sounds/matrosi.mp3" 
       enc:length="1939570" 
       enc:type="audio/mpeg" />
   <enc:Enclosure 
       enc:url="http://www.crocodile.org/sounds/matrosi.wav" 
       enc:length="8551650" 
       enc:quality="0.8"
       enc:location="San Francisco, California, USA"
       enc:type="audio/x-wav" />
   <enc:Enclosure 
       enc:url="http://www.crocodile.org.ua/sounds/matrosi.wav" 
       enc:length="8551650" 
       enc:quality="0.8"
       enc:location="Kiev, Ukraine"
       enc:type="audio/x-wav" />
   <enc:Enclosure 
       enc:url="http://www.crocodile.org/sounds/matrosi.ra" 
       enc:length="387116" 
       enc:quality="0.9"
       enc:type="audio/x-realaudio" />
</enc:Enclosures>

The following example, in addition to providing an audio file in multiple alternative formats, also specifies an image (artist photo) which should be shown simultaneously with audio playback:


<enc:Enclosures kind="parallel">
   <enc:Enclosures kind="alternative">
       <enc:Enclosure 
          enc:url="http://www.crocodile.org/sounds/matrosi.mp3.torrent" 
          enc:transport="application/x-bittorrent"
          enc:length="1939570" 
          enc:type="audio/mpeg" />
      <enc:Enclosure 
          enc:url="http://www.crocodile.org/sounds/matrosi.mp3" 
          enc:length="1939570" 
          enc:type="audio/mpeg" />
      <enc:Enclosure 
          enc:url="http://www.crocodile.org/sounds/matrosi.wav" 
          enc:length="8551650" 
          enc:quality="0.8"
          enc:location="San Francisco, California, USA"
          enc:type="audio/x-wav" />
      <enc:Enclosure 
          enc:url="http://www.crocodile.org.ua/sounds/matrosi.wav" 
          enc:length="8551650" 
          enc:quality="0.8"
          enc:location="Kiev, Ukraine"
          enc:type="audio/x-wav" />
      <enc:Enclosure 
          enc:url="http://www.crocodile.org/sounds/matrosi.ra" 
          enc:length="387116" 
          enc:type="audio/x-realaudio" />
   </enc:Enclosures>
   <enc:Enclosure 
       enc:url="http://www.crocodile.org/vertinsky/Portrait.jpeg" 
       enc:length="21713" 
       enc:type="image/jpeg" />
</enc:Enclosures>

Example of RSS 1.0 feed with the same enclosure using RDF/XML syntax:


<?xml version="1.0"  encoding="iso-8859-1"?>
<!DOCTYPE rdf:RDF [<!ENTITY ex "http://crocodile.org/ns/rss/1.0/enc/ex/">]>
<rdf:RDF xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
  xmlns:dcterms="http://purl.org/dc/terms/"
  xmlns:enc1="http://crocodile.org/ns/rss/1.0/enclosures">

  <channel rdf:about="&ex;news.rdf">
    <title>FOO news</title>
    <link>&ex;news.rdf</link>
    <description>Foo company news.</description>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="&ex;#2003-03-05-13:42:00" />
      </rdf:Seq>
    </items>
  </channel>

  <item rdf:about="&ex;#2003-03-05-13:42:00">
    <title>Vertinsky Music</title>
    <enc1:enclosures rdf:resource="&ex;#enclosures_top" />
  </item>

  <enc1:Enclosures rdf:about="&ex;#enclosures_top">
    <enc1:children>
      <enc1:Parallel>
        <rdf:li rdf:resource="&ex;#Portrait.jpeg" />
        <rdf:li rdf:resource="&ex;#enclosures_music" />
      </enc1:Parallel>
    </enc1:children>
  </enc1:Enclosures>

  <enc1:Enclosures rdf:about="&ex;#enclosures_music">
    <enc1:children>
      <rdf:Alt>
        <rdf:li rdf:resource="&ex;#matrosi.mp3.torrent" />
        <rdf:li rdf:resource="&ex;#matrosi.mp3" />
        <rdf:li rdf:resource="&ex;#matrosi.ra" />
        <rdf:li rdf:resource="&ex;#matrosi.wav-us" />
        <rdf:li rdf:resource="&ex;#matrosi.wav-ua" />
      </rdf:Alt>
    </enc1:children>
  </enc1:Enclosures>

  <enc1:Enclosure 
       rdf:about="&ex;#Portrait.jpeg"
       enc1:url="http://www.crocodile.org/vertinsky/Portrait.jpeg"
       enc1:length="21713"
       enc1:type="image/jpeg"/>

  <enc1:Enclosure 
       rdf:about="&ex;#matrosi.mp3"
       enc1:url="http://www.crocodile.org/sounds/matrosi.mp3"
       enc1:length="1939570"
       enc1:type="audio/mpeg"/>

  <enc1:Enclosure 
       rdf:about="&ex;#matrosi.mp3.torrent"
       enc1:url="http://www.crocodile.org/sounds/matrosi.mp3.torrent"
       enc1:length="1939570"
       enc1:type="audio/mpeg"
       enc1:transport="application/x-bittorrent"/>

  <enc1:Enclosure 
       rdf:about="&ex;#matrosi.ra"
       enc1:url="http://www.crocodile.org/sounds/matrosi.ra"
       enc1:length="387116"
       enc1:quality="0.9"
       enc1:type="audio/x-realaudio"/>

   <enc1:Enclosure 
       rdf:about="&ex;#matrosi.wav-us"
       enc1:url="http://www.crocodile.org/sounds/matrosi.wav" 
       enc1:length="8551650" 
       enc1:quality="0.8"
       enc1:type="audio/x-wav">
       <enc1:location>
            <dcterms:Point>
                 <rdfs:label>San Francisco</rdfs:label>
                 <rdf:value>
                        name=San Francisco, CA, USA; east=-122.4167; north=37.7667
                 </rdf:value>
            </dcterms:Point>
       </enc1:location>
   </enc1:Enclosure>

   <enc1:Enclosure 
       rdf:about="&ex;#matrosi.wav-ua"
       enc1:url="http://www.crocodile.org.ua/sounds/matrosi.wav" 
       enc1:length="8551650" 
       enc1:quality="0.8"
       enc1:type="audio/x-wav">
       <enc1:location>
            <dcterms:Point>
                 <rdfs:label>Kiev</rdfs:label>
                 <rdf:value>
                        name=Kiev, Ukraine; east=30.5167; north=50.4333
                 </rdf:value>
            </dcterms:Point>
       </enc1:location>
   </enc1:Enclosure>

</rdf:RDF>



Vadim Zaliva 2004-12-15