[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndexNG/converters - StripTagParser.py:1.1.2.1

Andreas Jung andreas@digicool.com
Wed, 20 Mar 2002 18:19:48 -0500


Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TextIndexNG/converters
In directory cvs.zope.org:/tmp/cvs-serv15168

Added Files:
      Tag: ajung-textindexng-branch
	StripTagParser.py 
Log Message:
added


=== Added File Zope/lib/python/Products/PluginIndexes/TextIndexNG/converters/StripTagParser.py ===
from sgmllib import SGMLParser

# Code taken from Dieter Maurer's CatalogSupport Module
# http://www.handshake.de/~dieter/pyprojects/zope
# Thank you!

class StripTagParser(SGMLParser):
  '''SGML Parser removing any tags and translating HTML entities.'''

  from htmlentitydefs import entitydefs

  data= None

  def handle_data(self,data):
    if self.data is None: self.data=[]
    self.data.append(data)

  def __str__(self):
    if self.data is None: return ''
    return ''.join(self.data)