Re: constructin trees in python

2010-11-21 Thread Aaron Sterling
> Thanks a lot peter, that worked as i needed. Where can i find some > good documentation which explains such behavior. The reason for this behavior is the way python stores attributes. Both a class and an instance of a class have a __dict__ attribute which is a dictionary which stores attributes

Re: constructin trees in python

2010-11-20 Thread Maxim Mercury
On Nov 20, 2:03 pm, Peter Otten <__pete...@web.de> wrote: > Maxim Mercury wrote: > > here is the definintion of htmlelement > > > class HTMLElement: > >     tag=None > >     attrs={} > >     data='' > >     childs=[] > > > the issue is the though new elements are pushed in the stack (1), > > whenev

Re: constructin trees in python

2010-11-20 Thread Peter Otten
Maxim Mercury wrote: > here is the definintion of htmlelement > > class HTMLElement: > tag=None > attrs={} > data='' > childs=[] > > the issue is the though new elements are pushed in the stack (1), > whenever i append the child to the stack top all other elements in the > stack

constructin trees in python

2010-11-20 Thread Maxim Mercury
Hi , Iam very much new to python. Iam trying to construct a xml dom tree using the builtin HTMLParser class (on data event callbacks). Iam maintaining the childs as a list of elements and whenver the sax parser encounters a tag i push it to a local stack, my basic logic is below. ** de