Hello,

I again misposted my message to a member of the list, instead of the list
itself. That is because I overuse the reply button and I don't recheck the
address I am writing to.

Sorry Fredrik.

---------- Forwarded message ----------
From: Bogdan Bivolaru <[EMAIL PROTECTED]>
Date: Sun, Aug 17, 2008 at 10:38 PM
Subject: Confused by text and tail concepts of ElementTree
To: Fredrik Lundh <[EMAIL PROTECTED]>


Hello,

I'm a little confused by the tail in the ElementTree Infoset:
http://effbot.org/zone/element-infoset.htm

An example from that page: <ELEM key="value">text<SUBELEM />tail</ELEM>

So this is the question:
element.text = "text"
element.tail = None
element[:] = [<Element SUBELEM>]
subelement.tag = "SUBELEM"
subelement.tail = "tail"

if element.text and subelement.tail are both children of element, why is the
tail actually attached to the subelement and not the element, as it's
sibling?

I expected that anything that refers an element is enclosed in the tags of
said element, instead I learn that a tag can contain reference to content
that is outside it's tags::
"<a/>aaa"

Doesn't this violate the concept of a tree of a single root element?
Is it valid to reference root.tail?

In the particular case below:
<ELEM key="value">text<SUBELEM />tail1<SUBELEM />tail2</ELEM>
from what I understood I can access:
text by "element.text"
tail1 by "element.children[0].tail"
tail2 by "element.children[1].tail"




-- 
"The best way to predict the future is to invent it.", 1971, Alan Kay:
http://www.smalltalk.org/alankay.html



-- 
"The best way to predict the future is to invent it.", 1971, Alan Kay:
http://www.smalltalk.org/alankay.html
_______________________________________________
XML-SIG maillist  -  XML-SIG@python.org
http://mail.python.org/mailman/listinfo/xml-sig

Reply via email to