home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 April / PCWorld_2001-04_cd.bin / Software / TemaCD / webclean / !!!python!!! / BeOpen-Python-2.0.exe / TEST_XMLLIB.PY < prev    next >
Encoding:
Python Source  |  2000-09-28  |  548 b   |  26 lines

  1. '''Test module to thest the xmllib module.
  2.    Sjoerd Mullender
  3. '''
  4.  
  5. from test_support import verbose
  6.  
  7. testdoc = """\
  8. <?xml version="1.0" encoding="UTF-8" standalone='yes' ?>
  9. <!-- comments aren't allowed before the <?xml?> tag,
  10.      but they are allowed before the <!DOCTYPE> tag -->
  11. <!DOCTYPE greeting [
  12.   <!ELEMENT greeting (#PCDATA)>
  13. ]>
  14. <greeting>Hello, world!</greeting>
  15. """
  16.  
  17. import xmllib
  18. if verbose:
  19.     parser = xmllib.TestXMLParser()
  20. else:
  21.     parser = xmllib.XMLParser()
  22.  
  23. for c in testdoc:
  24.     parser.feed(c)
  25. parser.close()
  26.