struct::tree with htmlparse inside the tclOO

struct::tree with htmlparse inside the tclOO

Post by Qatana » Fri, 05 Mar 2010 00:14:31


Hi I need help in making a tree as member of a variable: heres a
summary of my code

oo::class c {
method connect {
my variable my_tree

set html_source [ http::data $token ]
struct::tree my_tree
htmlparse::2tree $html_source tree
}
}

I get this error message

invalid command name "my_tree"

"$tree set root type root"
(procedure "htmlparse::2tree" line 17)
invoked from within
"htmlparse::2tree $html_source my_tree"


any ideas?
 
 
 

struct::tree with htmlparse inside the tclOO

Post by Qatana » Fri, 05 Mar 2010 00:22:26


> my variab>e >y_tree
>
> set html_source [ h>tp::data $token ]
> > struct::tree my_tree
> >tmlparse>:2>ree >ht>l_source tree
> } >> >> }
>
> I get this error messag>
> invalid command name "my_>ree"
>
> "$tree set root type root"
> > (procedure "htmlparse::>tree" line 17)
> invoked from within >> >htmlparse::2tree $html_source my_tree"
>
> any ideas? >
i was able to fix this. I just replaced
> >tmlparse::2tree $html_source tree

to

> htmlparse::2tree $html_source "[self namespace]::tree"

 
 
 

struct::tree with htmlparse inside the tclOO

Post by Andreas Ku » Fri, 05 Mar 2010 13:54:54

Qatanah < XXXX@XXXXX.COM > writes:


We apparently an issue with scoping, the tree is not where you thought
it is. One possible fix:

set thetree [struct::tree my_tree]
htmlparse::2tree $html_source $thetree

The result of struct::tree is the fully qualified name of the object,
sdaved into a variable, it can then be used regardless of location
relative to your current scope.


--
So long,
Andreas Kupries < XXXX@XXXXX.COM >
< http://www.yqcomputer.com/ ;
Developer @ < http://www.yqcomputer.com/ ;
-------------------------------------------------------------------------------
 
 
 

struct::tree with htmlparse inside the tclOO

Post by Qatana » Sat, 06 Mar 2010 10:22:43


> > et html_source [ http::data>$>oken ]
> > truct>:>ree my_tree
> > tmlparse::2tre> >html_s>u>ce t>ee> > >
> > }
>
> > I ge> t>i> error message
>
> > invalid co>ma>d name "my_tree"
>
> We apparently an issue with scoping, the tree is n>t where you thought
> it i>. >ne possible fix:
>
> set th>tree [struct::tree my_tree]
> ht>lp>rse::2tree $html_source $thetree
>
> The result of struct::tree is the>fully qualified name of the object,
> sdaved into a variable, it can>then be used regardless of locatio>
> > "$tree set root type root"
> > >p>ocedure "htmlparse::2tre>">line 17)
> > invoked from within
> >>"h>m>parse::2tree >ht>l_sou>ce my_tree"> >
> > any ideas?
>
> --< > So long>
> > gt;
> Developer @ < http://www.yqcomputer.com/ >
> -------------------------------------------------------------------------------

thanks!