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
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' SubElement to the
'body' tag and somehow copy
I have the exact same problem, rdf and elementtree
--
http://mail.python.org/mailman/listinfo/python-list
IamIan wrote:
> Thank you very much! That did it.
>
> In the source XML tags have rdf:about attributes with the link
> to the story, and it was here I planned on grabbing the link and
> matching it up with the child text. After seeing the output of
> elmenttree's getiterator() though, it now loo
Thank you very much! That did it.
In the source XML tags have rdf:about attributes with the link
to the story, and it was here I planned on grabbing the link and
matching it up with the child text. After seeing the output of
elmenttree's getiterator() though, it now looks like each item, title,
IamIan wrote:
> This is in Python 2.3.5. I've had success with elementtree and other
> RSS feeds, but I can't get it to work with this format:
>
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
> xmlns:dc="http://purl.org/dc/elements/1.1/";
> xmlns:fr="http://ASPRSS.com/fr.html";
>
This is in Python 2.3.5. I've had success with elementtree and other
RSS feeds, but I can't get it to work with this format:
http://www.w3.org/1999/02/22-rdf-syntax-ns#";
xmlns:dc="http://purl.org/dc/elements/1.1/";
xmlns:fr="http://ASPRSS.com/fr.html";
xmlns:pa="http://ASPRSS.com/pa.html";
xm
<[EMAIL PROTECTED]> wrote:
> Is anyone here familiar with ElementTree by effbot?
>
> With hello how is "hello" stored in the
> element tree? Which node is it under? Similarly, with:
> foo blah bar, how is bar stored? Which node is
> it in?
reposting the reply I just posted to the discussion boa
Hi,
Is anyone here familiar with ElementTree by effbot?
With hello how is "hello" stored in the
element tree? Which node is it under? Similarly, with:
foo blah bar, how is bar stored? Which node is
it in?
Cheers,
Ming
--
http://mail.python.org/mailman/listinfo/python-list
18 matches
Mail list logo