[ python-Bugs-1424171 ] patch for etree cdata and attr quoting

SourceForge.net noreply at sourceforge.net
Wed Feb 8 18:00:56 CET 2006


Bugs item #1424171, was opened at 2006-02-04 13:23
Message generated for change (Comment added) made by chrism
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1424171&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: XML
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Chris McDonough (chrism)
Assigned to: Fredrik Lundh (effbot)
Summary: patch for etree cdata and attr quoting

Initial Comment:
Attached is a patch for ElementTree (based on a checkout from the SVN 
trunk's xmlcore.etree) that seems to perform better escaping of cdata and 
attribute values.  Instead of replacing, for example "&quote;" with 
"&quote;" or "&" with "&", it tries to avoid requoting 
ampersands in things that look like entities.

Sorry, I haven't tested this with anything except Python 2.4, I'm not quite 
sure what to do about _encode_entity, and I haven't patched any tests or 
written a new one for this change.  Consider this more of a RFC than a 
patch ready-for-submission as a result.

----------------------------------------------------------------------

>Comment By: Chris McDonough (chrism)
Date: 2006-02-08 12:00

Message:
Logged In: YES 
user_id=32974

Doh, of course.  Sorry, I suspect I'll need to go to remedial XML class.  Ignore 
this.


----------------------------------------------------------------------

Comment By: Fredrik Lundh (effbot)
Date: 2006-02-06 16:55

Message:
Logged In: YES 
user_id=38376

I'm not sure I follow.  ET works on the infoset side of
things, where everything is decoded into Unicode strings (or
compatible ASCII strings).  If you set an attribute to
"&" in the infoset, it *must* be encoded on the way out.  
If you want an ampersand, use "&".

----------------------------------------------------------------------

Comment By: Chris McDonough (chrism)
Date: 2006-02-04 15:23

Message:
Logged In: YES 
user_id=32974

Egads, I did this time.

----------------------------------------------------------------------

Comment By: Georg Brandl (birkenfeld)
Date: 2006-02-04 13:29

Message:
Logged In: YES 
user_id=1188172

OP: You did check the box?

----------------------------------------------------------------------

Comment By: Chris McDonough (chrism)
Date: 2006-02-04 13:26

Message:
Logged In: YES 
user_id=32974

Sorry, the tracker doesn't seem to want to allow me to upload the file.  See 
http://www.plope.com/static/misc/betterescape.patch for the patch.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1424171&group_id=5470


More information about the Python-bugs-list mailing list