]> granicus.if.org Git - python/commitdiff
Sjoerd patches the previous patch:
authorGuido van Rossum <guido@python.org>
Tue, 8 Dec 1998 13:25:00 +0000 (13:25 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 8 Dec 1998 13:25:00 +0000 (13:25 +0000)
In literal mode, also don't do anything about entity and character
references, or about closing CDATA elements.

Lib/xmllib.py

index 4e62ae5486ebf0a77f1bd7a0e3b9543d9f3f2124..bea210b6fc24cdfa214686f8cf56de3bf7a197eb 100644 (file)
@@ -264,6 +264,11 @@ class XMLParser:
                     i = k
                     continue
             elif rawdata[i] == '&':
+                if self.literal:
+                    data = rawdata[i]
+                    self.handle_data(data)
+                    i = i+1
+                    continue
                 res = charref.match(rawdata, i)
                 if res is not None:
                     i = res.end(0)
@@ -292,6 +297,11 @@ class XMLParser:
                     self.lineno = self.lineno + string.count(res.group(0), '\n')
                     continue
             elif rawdata[i] == ']':
+                if self.literal:
+                    data = rawdata[i]
+                    self.handle_data(data)
+                    i = i+1
+                    continue
                 if n-i < 3:
                     break
                 if cdataclose.match(rawdata, i):