On Sat, 4 Sep 2010 11:55:11 -0500
"Edward K. Ream" <[email protected]> wrote:

> On Sat, Sep 4, 2010 at 10:22 AM, Terry Brown <[email protected]> wrote:
>   
> > I could accept making a dictionary of @id to node mappings, because I don't 
> > think xml.etree.ElementTree can search on @id content (am I missing 
> > something?).  But then, given an element 'e', I wanted to access its 
> > parent.  How do you do that in xml.etree.ElementTree?  I could find no way. 
> >    
> 
> You have got to be kidding me :-)  How about finding children?  If we
> can do that, we can create a tree by hand.  

Sure, the first attempt recursed the tree and created a dict of @id->element 
mapping.  That same process could create an @id -> parent mapping.  That would 
probably be most of what you need to remove lxml.  It's too bad there's no 
decent xpath in standard python yet.  For this SVG

<flowRoot id="flowRoot18">
  <flowRegion id="rect3911">
    <rect id="rect3911" width="165." height="93." x="123." y="114."/>
  </flowRegion>
  <flowPara id="co_text_holder">Some text</flowPara>
</flowRoot>

you need to find the parent of the flowPara to read the size for adjusting the 
frame.  In XPath that's

  doc.xpath("//*...@id='co_text_holder']/..")[0]  # take first item of one item 
list

w/o xpath, it's somehow search for the element with @id='co_text_holder', and 
then somehow find its parent.

But sadly it would be easier to write inkcall without lxml than it would be to 
fix lxml installation on windows problems.  Assuming that just asking on the 
lxml list wouldn't solve the problem, I assume it wouldn't, seeing we followed 
the official docs.

Of course, I only use windows occasionally for games :-} so it didn't occur to 
me that inkcall would be run on it.

And to be fair to lxml it does install relatively easily in Windows for python 
2.6

I'll drop a note on their list.

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to