summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_xmllib.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-01-29 14:55:24 (GMT)
committerGuido van Rossum <guido@python.org>1998-01-29 14:55:24 (GMT)
commit02505e48508deac4ae835ee833e0a05788c580d0 (patch)
treea09b54a85345b9169fff589db26d6e93e4a5be19 /Lib/test/test_xmllib.py
parent44f5c75f430c92384137c4bef0c0a69dce02ee0b (diff)
downloadcpython-02505e48508deac4ae835ee833e0a05788c580d0.zip
cpython-02505e48508deac4ae835ee833e0a05788c580d0.tar.gz
cpython-02505e48508deac4ae835ee833e0a05788c580d0.tar.bz2
New version of xmllib from Sjoerd.
The main incompatibility is that the error reporting method is now called as parser.syntax_error(msg) instead of parser.syntax_error(lineno, msg) This new version also has some code to deal with the <?xml?> and <!DOCTYPE> tags at the start of an XML document. The documentation has been updated, and a small test module has been created.
Diffstat (limited to 'Lib/test/test_xmllib.py')
-rw-r--r--Lib/test/test_xmllib.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/test_xmllib.py b/Lib/test/test_xmllib.py
new file mode 100644
index 0000000..eb868a3
--- /dev/null
+++ b/Lib/test/test_xmllib.py
@@ -0,0 +1,25 @@
+'''Test module to thest the xmllib module.
+ Sjoerd Mullender
+'''
+
+from test_support import verbose
+
+testdoc = """\
+<?xml version="1.0" encoding="UTF-8" standalone='yes' ?>
+<!-- comments aren't allowed before the <?xml?> tag,
+ but they are allowed before the <!DOCTYPE> tag -->
+<!DOCTYPE greeting [
+ <!ELEMENT greeting (#PCDATA)>
+]>
+<greeting>Hello, world!</greeting>
+"""
+
+import xmllib
+if verbose:
+ parser = xmllib.TestXMLParser()
+else:
+ parser = xmllib.XMLParser()
+
+for c in testdoc:
+ parser.feed(c)
+parser.close()