summaryrefslogtreecommitdiff
path: root/pynzb/lxml_nzb.py
blob: 790671d115575aa5ed8617405544c36d6f9865d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from pynzb.base import BaseETreeNZBParser, NZBFile, NZBSegment

try:
    from lxml import etree
except ImportError:
    raise ImportError("You must have lxml installed before you can use the " +
        "lxml NZB parser.")

try:
    from cStringIO import StringIO
except ImportError:
    from StringIO import StringIO

class LXMLNZBParser(BaseETreeNZBParser):
    def get_etree_iter(self, xml, et=etree):
        return iter(et.iterparse(StringIO(xml), events=("start", "end")))