MCPcopy Create free account
hub / github.com/ActiveState/code / test

Function test

recipes/Python/84516_Using_SAX2_LexicalHandler/recipe-84516.py:55–75  ·  view source on GitHub ↗
(xmlfile)

Source from the content-addressed store, hash-verified

53
54
55def test(xmlfile):
56 parser = sax2exts.make_parser([
57 'pirxx',
58 'xml.sax.drivers2.drv_xmlproc',
59 'xml.sax.drivers2.drv_pyexpat',
60 ])
61 print >>sys.stderr, "*** Using", parser
62
63 try:
64 parser.setFeature(handler.feature_namespaces, 1)
65 except (SAXNotRecognizedException, SAXNotSupportedException):
66 pass
67 try:
68 parser.setFeature(handler.feature_validation, 0)
69 except (SAXNotRecognizedException, SAXNotSupportedException):
70 pass
71
72 saxhandler = EchoGenerator()
73 parser.setContentHandler(saxhandler)
74 parser.setProperty(handler.property_lexical_handler, saxhandler)
75 parser.parse(xmlfile)
76
77
78if __name__ == "__main__":

Callers 1

recipe-84516.pyFile · 0.70

Calls 3

EchoGeneratorClass · 0.85
setPropertyMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected