A question about Stack

T

trunggauuoi

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top