Edgewall Software

Changes between Version 2 and Version 3 of MarkupStream


Ignore:
Timestamp:
Jul 9, 2006, 1:09:06 AM (18 years ago)
Author:
cmlenz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MarkupStream

    v2 v3  
    8989}}}
    9090
     91Often, streams cannot be reused: in the above example, the sub-stream is based on a generator. Once it has been serialized, it will have been fully consumed, and cannot be rendered again. To work around this, you can wrap such a “read-once” stream in a `list`:
     92
     93{{{
     94>>> from markup import Stream
     95>>> substream = Stream(list(stream.select('a')))
     96>>> substream
     97<markup.core.Stream object at 0x7118b0>
     98>>> print substream
     99<a href="http://example.org/">a link</a>
     100>>> print substream.select('@href')
     101http://example.org/
     102>>> print substream.select('text()')
     103a link
     104}}}
     105
    91106----
    92107See also: MarkupGuide