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:
- org.esau.ptarmigan.impl.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 $
| Fields inherited from class org.esau.ptarmigan.impl.filter.PlaylistFilter |
NS_PREFIX, NS_URI, TAG_ENTRY, TAG_ENTRY_DURATION, TAG_ENTRY_TITLE, TAG_ENTRY_URL, TAG_PLAYLIST, TAG_PROPS, TAG_PROPS_AUTHOR, TAG_PROPS_COPYRIGHT, TAG_PROPS_DURATION_TOTAL, TAG_PROPS_ENTRY_COUNT, TAG_PROPS_SUMMARY, TAG_PROPS_TITLE |
| Methods inherited from class org.esau.ptarmigan.impl.filter.PlaylistFilter |
endPlaylist, getIncludeEntries, getInEntry, getIsPropsDone, getNamespacePrefix, getNamespaceURI, resetData, setAuthor, setBaseDir, setCopyright, setEntryCount, setEntryDuration, setEntryPath, setEntryPath, setEntryTitle, setIncludeEntries, setInEntry, setSummary, setTitle, startPlaylist, writeEntry, writeProperties |
| Methods inherited from class org.esau.ptarmigan.impl.filter.BaseFilter |
characters, getByteStream, getChars, getMediaProperties, parse, setMediaProperties, write, write, write, write, write, write, write, write, write, write, write, writeDate, writeDate, writeDate, writeDate, writeInteger, writeInteger, writeInteger, writeInteger, writeInteger, writeString, writeString, writeString, writeString, writeString |
| 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 |
ASX
static final java.lang.String ASX
- from the asx 'structure'
- See Also:
- Constant Field Values
ASX_TITLE
static final java.lang.String ASX_TITLE
- See Also:
- Constant Field Values
ASX_AUTHOR
static final java.lang.String ASX_AUTHOR
- See Also:
- Constant Field Values
ASX_COPYRIGHT
static final java.lang.String ASX_COPYRIGHT
- See Also:
- Constant Field Values
ASX_ABSTRACT
static final java.lang.String ASX_ABSTRACT
- See Also:
- Constant Field Values
ASX_ENTRY
static final java.lang.String ASX_ENTRY
- See Also:
- Constant Field Values
ASX_ENTRY_REF
static final java.lang.String ASX_ENTRY_REF
- See Also:
- Constant Field Values
ASX_ENTRY_REF_HREF
static final java.lang.String ASX_ENTRY_REF_HREF
- See Also:
- Constant Field Values
ASX_ENTRY_ABSTRACT
static final java.lang.String ASX_ENTRY_ABSTRACT
- See Also:
- Constant Field Values
log
static org.apache.commons.logging.Log log
- logging object
ASXFilter
public ASXFilter()
throws org.xml.sax.SAXException
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 "
- Specified by:
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.
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.