DOM text

Diez B. Roggisch deets at nospam.web.de
Fri Aug 26 06:13:10 EDT 2005


Richard Lewis wrote:
> 
> I admit I haven't tried very much code yet, but I'm not sure how I'm
> going to handle situations like: the user wants to insert a link in the
> middle of a paragraph. How can I use the DOM to insert a node into the
> middle of some text? Am I right in thinking that the DOM will reference
> a whole text node but nothing smaller?

You have to split the text-node, and add the two resulting noedes 
together with the new link-node (or whatever node you want there, can be 
a whole tree) in the correct order to the parent of the two node. If 
unsure what that means, create two simple documents and parse these to 
dom to see how that works.

Diez



More information about the Python-list mailing list