[Patches] 2 fixes to xmllib

Sjoerd Mullender sjoerd@oratrix.nl
Wed, 21 Jun 2000 17:28:27 +0200


These two fixes were approved by me.

Peter Kropf:
There's a problem with the xmllib module when used with JPython. Specifically,
the JPython re module has trouble with the () characters in strings passed into
re.compile.

Spiros Papadimitriou:
I just downloaded xmllib.py ver. 0.3 from python.org and there
seems to be a slight typo:  Line 654 ("tag = self.stack[-1][0]"
in parse_endtag),  is indented one level more than it should be.
I just thought I'd let you know...

Index: xmllib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xmllib.py,v
retrieving revision 1.17
diff -u -r1.17 xmllib.py
--- xmllib.py	2000/02/04 15:39:30	1.17
+++ xmllib.py	2000/06/21 15:22:26
@@ -27,7 +27,7 @@
 attrfind = re.compile(
     _S + '(?P<name>' + _Name + ')'
     '(' + _opS + '=' + _opS +
-    '(?P<value>'+_QStr+'|[-a-zA-Z0-9.:+*%?!()_#=~]+))?')
+    '(?P<value>'+_QStr+'|[-a-zA-Z0-9.:+*%?!\(\)_#=~]+))?')
 starttagopen = re.compile('<' + _Name)
 starttagend = re.compile(_opS + '(?P<slash>/?)>')
 starttagmatch = re.compile('<(?P<tagname>'+_Name+')'
@@ -43,8 +43,8 @@
 # SYSTEM SystemLiteral
 # PUBLIC PubidLiteral SystemLiteral
 _SystemLiteral = '(?P<%s>'+_QStr+')'
-_PublicLiteral = '(?P<%s>"[-\'()+,./:=?;!*#@$_%% \n\ra-zA-Z0-9]*"|' \
-                        "'[-()+,./:=?;!*#@$_%% \n\ra-zA-Z0-9]*')"
+_PublicLiteral = '(?P<%s>"[-\'\(\)+,./:=?;!*#@$_%% \n\ra-zA-Z0-9]*"|' \
+                        "'[-\(\)+,./:=?;!*#@$_%% \n\ra-zA-Z0-9]*')"
 _ExternalId = '(?:SYSTEM|' \
                  'PUBLIC'+_S+_PublicLiteral%'pubid'+ \
               ')'+_S+_SystemLiteral%'syslit'
@@ -652,7 +652,7 @@
                 return i+1
             if not self.__accept_missing_endtag_name:
                 self.syntax_error('no name specified in end tag')
-                tag = self.stack[-1][0]
+            tag = self.stack[-1][0]
             k = i+2
         else:
             tag = res.group(0)

I confirm that, to the best of my knowledge and belief, this
contribution is free of any claims of third parties under
copyright, patent or other rights or interests ("claims").  To
the extent that I have any such claims, I hereby grant to CNRI a
nonexclusive, irrevocable, royalty-free, worldwide license to
reproduce, distribute, perform and/or display publicly, prepare
derivative versions, and otherwise use this contribution as part
of the Python software and its related documentation, or any
derivative versions thereof, at no cost to CNRI or its licensed
users, and to authorize others to do so.

I acknowledge that CNRI may, at its sole discretion, decide
whether or not to incorporate this contribution in the Python
software and its related documentation.  I further grant CNRI
permission to use my name and other identifying information
provided to CNRI by me for use in connection with the Python
software and its related documentation.

-- Sjoerd Mullender <sjoerd.mullender@oratrix.com>