Re: elementtree question

2007-09-26 Thread Fredrik Lundh
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

Re: elementtree question

2007-09-26 Thread Stefan Behnel
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

Re: elementtree question

2007-09-26 Thread Stefan Behnel
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

Re: elementtree question

2007-09-26 Thread Fredrik Lundh
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

Re: elementtree question

2007-09-24 Thread Tim Arnold
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

Re: elementtree question

2007-09-24 Thread Stefan Behnel
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://

Re: elementtree question

2007-09-24 Thread Gabriel Genellina
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

Re: elementtree question

2007-09-21 Thread Mark T
"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

Re: elementtree question

2007-09-21 Thread Gabriel Genellina
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

Re: elementtree question

2007-09-21 Thread Ivo
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

elementtree question

2007-09-21 Thread Tim Arnold
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

Simple elementtree question

2007-09-18 Thread Peters Bart (GEN)
I have the exact same problem, rdf and elementtree -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple elementtree question

2007-08-31 Thread Stefan Behnel
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

Re: Simple elementtree question

2007-08-30 Thread IamIan
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,

Re: Simple elementtree question

2007-08-30 Thread Stefan Behnel
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"; >

Simple elementtree question

2007-08-30 Thread IamIan
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

Re: effbot ElementTree question

2004-12-14 Thread Fredrik Lundh
<[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

effbot ElementTree question

2004-12-14 Thread dayzman
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