Re: DOM text

2005-08-30 Thread Richard Lewis
On Tue, 30 Aug 2005 12:05:38 +0100, "Richard Lewis" <[EMAIL PROTECTED]> said: > > On Tue, 30 Aug 2005 11:17:25 +0100, "Richard Lewis" > <[EMAIL PROTECTED]> said: > > > > Here is the *complete* code for my SectionCursor class: > > In case anyone's interested, I've just noticed a logical error in

Re: DOM text

2005-08-30 Thread Richard Lewis
On Tue, 30 Aug 2005 11:17:25 +0100, "Richard Lewis" <[EMAIL PROTECTED]> said: > > Here is the *complete* code for my SectionCursor class: In case anyone's interested, I've just noticed a logical error in the next_node() method: = def next_node(self): if self.cur

Re: DOM text

2005-08-30 Thread Richard Lewis
On Fri, 26 Aug 2005 11:43:18 +0100, "Richard Lewis" <[EMAIL PROTECTED]> said: > > I'm implementing a Cursor class now which keeps track of the current > parent Element, text node and character position so that I can easily (I > hope ;-) work out where the splitting and inserting needs to occur. W

Re: DOM text

2005-08-26 Thread Richard Lewis
On Fri, 26 Aug 2005 13:59:09 +0200, "Fredrik Lundh" <[EMAIL PROTECTED]> said: > Robert Kern wrote: > > > You might find that the more Pythonic XML modules are better suited to > > handling mixed content. I've been using lxml and ElementTree quite > > successfully. > > fwiw, here's an ET snippet

Re: DOM text

2005-08-26 Thread Fredrik Lundh
Robert Kern wrote: > You might find that the more Pythonic XML modules are better suited to > handling mixed content. I've been using lxml and ElementTree quite > successfully. fwiw, here's an ET snippet that inserts an anchor element inside a paragraph element: # from lxml.etree import * # or #

Re: DOM text

2005-08-26 Thread Robert Kern
Richard Lewis wrote: > Hello Pythoners, > > I'm currently writing some Python to manipulate a semi-structured XML > document. I'm using DOM (minidom) and I've got working code for > transforming the document to HTML files and for adding the 'structured' > elements which populate the higher regions

Re: DOM text

2005-08-26 Thread Richard Lewis
On Fri, 26 Aug 2005 12:13:10 +0200, "Diez B. Roggisch" <[EMAIL PROTECTED]> said: > 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

Re: DOM text

2005-08-26 Thread Diez B. Roggisch
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 DO