Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > A question about Stack

Reply
Thread Tools

A question about Stack

 
 
trunggauuoi
Guest
Posts: n/a
 
      10-05-2003
Hi,

I'm trying to use stack to build a HTMLTree for my parser. There is a
HTMLTreeNode class. Each time I encounter a tag or text, I need to create
and initialize a HTMLTreeNode and put it in a htmltree and a stack. The
stack is the list of objects (HTMLTreeNode objects). I want to retrieve the
instance from the stack to use it to append some info to the instance.
However, I can't append anything to the instace that I just got from the
stack. Actually, if I print out the stack, it will look like this:

[<parserExample.HTMLTreeNode instance at 0x00A87030>]
[<parserExample.HTMLTreeNode instance at 0x00A87058>]

If I try to add something to the instance I got, I will receive an error
message saying that the instance has no attributes, which are actually in
the instance when I added it to the stack.
I have no idea how to deal with this.

Any help would be greatly appreciated

Many thanks

Trung




 
Reply With Quote
 
 
 
 
trunggauuoi
Guest
Posts: n/a
 
      10-05-2003
hi again.
I got this figured out. Just a stupid mistake

"trunggauuoi" <> wrote in message
news:%cNfb.499812$cF.176544@rwcrnsc53...
> Hi,
>
> I'm trying to use stack to build a HTMLTree for my parser. There is a
> HTMLTreeNode class. Each time I encounter a tag or text, I need to create
> and initialize a HTMLTreeNode and put it in a htmltree and a stack. The
> stack is the list of objects (HTMLTreeNode objects). I want to retrieve

the
> instance from the stack to use it to append some info to the instance.
> However, I can't append anything to the instace that I just got from the
> stack. Actually, if I print out the stack, it will look like this:
>
> [<parserExample.HTMLTreeNode instance at 0x00A87030>]
> [<parserExample.HTMLTreeNode instance at 0x00A87058>]
>
> If I try to add something to the instance I got, I will receive an error
> message saying that the instance has no attributes, which are actually in
> the instance when I added it to the stack.
> I have no idea how to deal with this.
>
> Any help would be greatly appreciated
>
> Many thanks
>
> Trung
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does std::stack::pop() not throw an exception if the stack is empty? Debajit Adhikary C++ 36 02-10-2011 08:54 PM
C/C++ compilers have one stack for local variables and return addresses and then another stack for array allocations on the stack. Casey Hawthorne C Programming 3 11-01-2009 08:23 PM
stack frame size on linux/solaris of a running application stack Surinder Singh C Programming 1 12-20-2007 01:16 PM
Why stack overflow with such a small stack? Kenneth McDonald Ruby 7 09-01-2007 04:21 AM
"stack level too deep"... because Threads keep their "starting" stack Sam Roberts Ruby 1 02-11-2005 04:25 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57