org.esau.ptarmigan.impl.filter
Class ASXFilter

java.lang.Object
  |
  +--org.xml.sax.helpers.XMLFilterImpl
        |
        +--org.esau.ptarmigan.impl.filter.BaseFilter
              |
              +--org.esau.ptarmigan.impl.filter.PlaylistFilter
                    |
                    +--org.esau.ptarmigan.impl.filter.XMLPlaylistFilter
                          |
                          +--org.esau.ptarmigan.impl.filter.ASXFilter
All Implemented Interfaces:
CharacterStreamSource, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.XMLFilter, org.xml.sax.XMLReader

public final class ASXFilter
extends XMLPlaylistFilter

ASXFilter -- transforms ASX playlist to ptarmigan playlist

Example source:

   <ASX version="3.0">
       <ABSTRACT>This is a sample asx file used as playlist</ABSTRACT>
       <TITLE>Windows Media Playlist Demo</TITLE>
       <AUTHOR>Reed Esau</AUTHOR>
       <COPYRIGHT>2002 Reed Esau</COPYRIGHT>
       <ENTRY>
               <REF href="File1.asf" />
               <ABSTRACT>Link to a local file on the same folder</ABSTRACT>
       </ENTRY>
       <ENTRY>
               <REF href="mms://media.phm.lu/File2.asf" />
               <ABSTRACT>a file streamed from a media server on the network</ABSTRACT>
       </ENTRY>
       <ENTRY>
               <REF href="File3.mp3" />
               <ABSTRACT>ASX can support any file type supported by WMP</ABSTRACT>
       </ENTRY>
       <ENTRY>
               <REF href="File4.avi" />
               <ABSTRACT>you can even mix audio files and video files in the same ASX</ABSTRACT>
       </ENTRY>
   </ASX>
 
The equivalent XSLT would appear thus:
   <xsl:template match="/ASX">
       <pl:playlist>
           <pl:properties>
               <pl:title><xsl:value-of select='TITLE'/></pl:title>
               <pl:author><xsl:value-of select='AUTHOR'/></pl:author>
               <pl:copyright><xsl:value-of select='COPYRIGHT'/></pl:copyright>
               <pl:summary><xsl:value-of select='ABSTRACT'/></pl:summary>
               <pl:entry-count><xsl:value-of select='count(ENTRY)'/></pl:entry-count>
           </pl:properties>
           <xsl:if test="$include_entries = 'true'">
               <xsl:apply-templates select="ENTRY"/>
           </xsl:if>
       </pl:playlist>
   </xsl:template>

   <xsl:template match="ENTRY">
       <pl:entry>
           <pl:path><xsl:value-of select='REF/@href'/></pl:path>
           <pl:title><xsl:value-of select='ABSTRACT'/></pl:title>
       </pl:entry>
   </xsl:template>
 
TODO: recursively scan all playlists found.

Version:
$Revision: 1.2 $ $Date: 2002/09/16 04:05:07 $
Author:
Reed Esau

Constructor Summary
ASXFilter()
           
 
Method Summary
 void endElement(java.lang.String uri, java.lang.String local_name, java.lang.String qName)
          Filter an end element event.
 boolean isMatch(java.lang.String sniff_chars)
          is the text file an XML file with that dodgy ASX marker? Note: ASX files may not start with "
 void startElement(java.lang.String uri, java.lang.String local_name, java.lang.String qName, org.xml.sax.Attributes atts)
          Filter a start element event.
 
Methods inherited from class org.esau.ptarmigan.impl.filter.XMLPlaylistFilter
endDocument, startDocument
 
Methods inherited from class org.esau.ptarmigan.impl.filter.PlaylistFilter
getIncludeEntries, resetData, setBaseDir, setIncludeEntries
 
Methods inherited from class org.esau.ptarmigan.impl.filter.BaseFilter
characters, getMediaProperties, parse, setMediaProperties
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ASXFilter

public ASXFilter()
          throws org.xml.sax.SAXException
Method Detail

isMatch

public boolean isMatch(java.lang.String sniff_chars)
is the text file an XML file with that dodgy ASX marker? Note: ASX files may not start with "
Overrides:
isMatch in class PlaylistFilter

startElement

public void startElement(java.lang.String uri,
                         java.lang.String local_name,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Filter a start element event.
Overrides:
startElement in class org.xml.sax.helpers.XMLFilterImpl

endElement

public void endElement(java.lang.String uri,
                       java.lang.String local_name,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Filter an end element event.
Overrides:
endElement in class org.xml.sax.helpers.XMLFilterImpl


Copyright © 2002 Reed Esau, All Rights Reserved.