Tim Arnold wrote:
> 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
Tim Arnold wrote:
> Thanks for the great answers--I learned a lot. I'm looking forward to the ET
> 1.3 version.
Note that there is a difference in behaviour, though. lxml.etree forces
Elements to be uniquely positioned in a tree, so the code I posted relies on
the "side effect" of automatically r
Fredrik Lundh wrote:
> (this recent lxml habit of using lxml-specific versions of things that
> are trivial to do with the standard API is a bit disappointing. kind of
> defeats the purpose of having a standard API...)
ElementTree is not the only standard API that lxml is following. Another one
i
Stefan Behnel wrote:
> ET 1.3 will also support the extend() function, BTW.
div.extend(seq) can be trivially rewritten as
div[len(div):] = seq
and in this case, you know that len(div) is 0, so you can simply do:
div[:] = seq
(this recent lxml habit of using lxml-specific versions of
Thanks for the great answers--I learned a lot. I'm looking forward to the ET
1.3 version. I'm currently working on some older HP10.20ux machines and
haven't been able to compile lxml all the way through yet.
thanks again,
--Tim Arnold
--
http://mail.python.org/mailman/listinfo/python-list
Tim Arnold wrote:
> 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:
>
>
>original contents...
>
>
Give lxml.etree (or lxml.html) a try:
tree = etree.parse("http://
En Sat, 22 Sep 2007 00:19:59 -0300, Mark T <[EMAIL PROTECTED]> escribi�:
> "Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> En Fri, 21 Sep 2007 11:49:53 -0300, Tim Arnold <[EMAIL PROTECTED]>
>> escribi�:
>>
>>> Hi, I'm using elementtree and elementtidy to work w
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> En Fri, 21 Sep 2007 11:49:53 -0300, Tim Arnold <[EMAIL PROTECTED]>
> escribi�:
>
>> Hi, I'm using elementtree and elementtidy to work with some HTML files.
>> For
>> some of these files I need to enclose the body
En Fri, 21 Sep 2007 11:49:53 -0300, Tim Arnold <[EMAIL PROTECTED]>
escribi�:
> 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:
>
>
>original contents...
>
>
>
> I f
Tim Arnold wrote:
> 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:
>
>
>original contents...
>
>
>
> I figure there must be a way to do it by creating a 'div' SubEleme
10 matches
Mail list logo