<br><br><div><span class="gmail_quote">On 9/25/07, <b class="gmail_sendername">J. Cliff Dyer</b> <<a href="mailto:jcd@sdf.lonestar.org">jcd@sdf.lonestar.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
-----BEGIN PGP SIGNED MESSAGE-----<br>Hash: SHA1<br><br>Robert Dailey top posted:<br>> Hmm, ElementTree.tostring() also adds a space between the last<br>> character of the element name and the />. Not sure why it is doing
<br>> this.<br>><br>> Something like <root/> will become <root /> after the tostring().<br><br><br>The space was common practice in pseudo-XHTML code when people still<br>had to routinely support browsers like Netscape 4, which had no clue
<br>about XML.  It basically makes a uniquely XML construct into valid<br>HTML.  Basically, the space makes unaware parsers treat the / as the<br>next attribute.  Being an attribute with unknown meaning, the standard<br>practice is to ignore it, and hence, it is parsed properly in both
<br>XHTML parsers and plain HTML parsers.  I guess the practice just<br>caught on beyond the XHTML world.<br><br>I don't know if there's a flag to get rid of it, but you can always<br>dig into the code....<br><br>
Cheers,<br>Cliff<br><br>-----BEGIN PGP SIGNATURE-----<br>Version: GnuPG v1.4.7 (MingW32)<br><br>iD8DBQFG+ZXyGI3CK/MIt30RAkvhAJ0TAz4Y5ngDEVo9wnRwPhESh+D64QCcDjdM<br>JKT6H37LgX1Fk7665+Mqwh0=<br>=GcvK<br>-----END PGP SIGNATURE-----
<br><br></blockquote></div><br>Right now I just run a trivial regular expression on the result of tostring() to remove the spaces.<br>