File: test_sax.py

package info (click to toggle)
python-xml 0.4.19981014-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 2,124 kB
  • ctags: 3,099
  • sloc: ansic: 9,075; python: 8,150; xml: 7,940; makefile: 84; sh: 41
file content (18 lines) | stat: -rw-r--r-- 425 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

# A demo SAX application using the xmllib.py driver, a command-line
# interface and the ESIS outputter.

from xml.sax import saxexts, saxlib, saxutils

import sys,StringIO

in_sysID="quotes.xml"

for klass in [saxutils.Canonizer, saxutils.ESISDocHandler]:
    output = StringIO.StringIO()
    dh = klass(output)
    p=saxexts.make_parser()
    p.setDocumentHandler(dh)
    p.parse(in_sysID)
    print output.getvalue()