Class TextSerializer
object --+
|
TextSerializer
Produces plain text from an event stream.
Only text events are included in the output. Unlike the other serializer,
special XML characters are not escaped:
>>> from genshi.builder import tag
>>> elem = tag.div(tag.a('<Hello!>', href='foo'), tag.br)
>>> print elem
<div><a href="foo"><Hello!></a><br/></div>
>>> print ''.join(TextSerializer()(elem.generate()))
<Hello!>
If text events contain literal markup (instances of the Markup class),
tags or entities are stripped from the output:
>>> elem = tag.div(Markup('<a href="foo">Hello!</a><br/>'))
>>> print elem
<div><a href="foo">Hello!</a><br/></div>
>>> print ''.join(TextSerializer()(elem.generate()))
Hello!
|
|
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__init__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__str__
|
Inherited from object :
__class__
|