elementtree question

Tim Arnold tim.arnold at sas.com
Fri Sep 21 10:49:53 EDT 2007


Hi, I'm using elementtree and elementtidy to work with some HTML files. For 
some of these files I need to enclose the body content in a new div tag, 
like this:
<body>
  <div class="remapped">
   original contents...
  </div>
</body>

I figure there must be a way to do it by creating a 'div' SubElement to the 
'body' tag and somehow copying the rest of the tree under that SubElement, 
but it's beyond my comprehension.

How can I accomplish this?
(I know I could put the class on the body tag itself, but that won't satisfy 
the powers-that-be).

thanks,
--Tim Arnold





More information about the Python-list mailing list