effbot ElementTree question

D

dayzman

Hi,

Is anyone here familiar with ElementTree by effbot?

With <html><body>hello</body></html> how is "hello" stored in the
element tree? Which node is it under? Similarly, with:
foo <a href = "blah"> blah </a> bar, how is bar stored? Which node is
it in?

Cheers,
Ming
 
F

Fredrik Lundh

Is anyone here familiar with ElementTree by effbot?

With <html><body>hello</body></html> how is "hello" stored in the
element tree? Which node is it under? Similarly, with:
foo <a href = "blah"> blah </a> bar, how is bar stored? Which node is
it in?

reposting the reply I just posted to the discussion board where you
asked the same question:

in the body case, the "hello" text ends up in the 'text' attribute of the "body"
node (in HTML/CSS terminology, this is known as an "anonymous block").

in the other case, the trailing text is stored in the 'tail' attribute of the
preceeding element ("a" in this case); see:

http://effbot.org/zone/element-infoset.htm#mixed-content

for details on how ElementTree deals with mixed content.

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top