nz.ac.waikato.mcennis.rat.parser.xmlHandler
Class LastFMUserTopArtists

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by nz.ac.waikato.mcennis.rat.parser.xmlHandler.Handler
          extended by nz.ac.waikato.mcennis.rat.parser.xmlHandler.LastFMUserTopArtists
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class LastFMUserTopArtists
extends Handler

Parse the Profile XML file from LastFM. See audioscrobbler.net for a description of the file format. Usually obtained from the CrawlLastFM data aquisition module. Contains the set of the top 50 artists listened to by this user along with playcounts.


Field Summary
 
Fields inherited from class nz.ac.waikato.mcennis.rat.parser.xmlHandler.Handler
properties, site
 
Constructor Summary
LastFMUserTopArtists()
           
 
Method Summary
static void blockArtist(java.lang.String artistName)
          Prevent any artist of the given name from being parsed
 void characters(char[] ch, int start, int length)
           
 Handler duplicate()
          Create a complete duplicate of this class
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
           
 ParsedObject get()
          Return the underlying parsed object
 boolean isParseArtist()
           
 boolean isParseUserArtist()
           
 void set(ParsedObject o)
          Set the underlying parsed object for parsing
 void setArtistParsers(java.lang.String[] artistParsers)
          Set the array of parser names to process ArtistTag files as they are downloaded.
 void setCrawler(Crawler crawler)
          Set the crawler to be used for spidering new pages
 void setDocumentLocator(org.xml.sax.Locator locator)
           
 void setParseArtist(boolean parseArtist)
           
 void setParser(ToFileParser parser)
          Set where the given parser will store files when they are parsed
 void setParseUserArtist(boolean parseUserArtist)
           
 void setUserArtistTagParsers(java.lang.String[] userArtistTagParsers)
          Set the array of parser names to process UserArtistTag files as they are downloaded.
 void startDocument()
           
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
           
 
Methods inherited from class nz.ac.waikato.mcennis.rat.parser.xmlHandler.Handler
check, check, error, fatalError, getName, getParameter, getParameter, init, setName, setProperties, warning
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LastFMUserTopArtists

public LastFMUserTopArtists()
Method Detail

setParser

public void setParser(ToFileParser parser)
Set where the given parser will store files when they are parsed

Parameters:
parser - ToFileParser to store files parsed by this parser

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

isParseArtist

public boolean isParseArtist()

setParseArtist

public void setParseArtist(boolean parseArtist)

isParseUserArtist

public boolean isParseUserArtist()

setParseUserArtist

public void setParseUserArtist(boolean parseUserArtist)

blockArtist

public static void blockArtist(java.lang.String artistName)
Prevent any artist of the given name from being parsed

Parameters:
artistName - name of artist to block from being downloaded

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

get

public ParsedObject get()
Description copied from class: Handler
Return the underlying parsed object

Specified by:
get in class Handler
Returns:
parsed object

set

public void set(ParsedObject o)
Description copied from class: Handler
Set the underlying parsed object for parsing

Specified by:
set in class Handler
Parameters:
o - underlying parsed object

duplicate

public Handler duplicate()
Description copied from class: Handler
Create a complete duplicate of this class

Specified by:
duplicate in class Handler
Returns:
deep copy of the original.

setArtistParsers

public void setArtistParsers(java.lang.String[] artistParsers)
Set the array of parser names to process ArtistTag files as they are downloaded. See crawler.crawl()

Parameters:
artistParsers - array of parser names

setUserArtistTagParsers

public void setUserArtistTagParsers(java.lang.String[] userArtistTagParsers)
Set the array of parser names to process UserArtistTag files as they are downloaded. See crawler.crawl()

Parameters:
userArtistTagParsers -

setCrawler

public void setCrawler(Crawler crawler)
Description copied from class: Handler
Set the crawler to be used for spidering new pages

Overrides:
setCrawler in class Handler
Parameters:
crawler - crawler to be parsing.

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Overrides:
setDocumentLocator in class org.xml.sax.helpers.DefaultHandler

Get Relational Analysis Toolkit at SourceForge.net. Fast, secure and Free Open Source software downloads