Tong, I’m glad this works for you.

Dave, reading back I see that we’re giving conflicting advice on pointers 
for MyTokenizer. While my view is that the dereferences are not necessary 
here, perhaps you have other reasons to have a pointer in this case?

Thanks,
Matt

On Wednesday, January 3, 2018 at 7:25:15 PM UTC-6, Tong Sun wrote:
>
> Thanks Matt -- I thought it wouldn't work, but having thinking it over, 
> and over, now I finally make it working.
>
> Thanks a lot
>
> On Wed, Jan 3, 2018 at 9:46 AM, <matthe...@gmail.com <javascript:>> wrote:
>
>> Ah, this kind of function signature may be better:
>>
>> func WalkBody(t *html.Tokenizer, w TokenVisitor) {
>>
>> Then you would use the regular *html.Tokenizer methods to do the walk and 
>> pass each token to the TokenVisitor to be parsed for output depending on 
>> which TokenVisitor was picked.
>>
>> Matt
>>
>> On Wednesday, January 3, 2018 at 8:30:14 AM UTC-6, Tong Sun wrote:
>>>
>>>
>>>
>>> On Wed, Jan 3, 2018 at 9:07 AM, <matthe...@gmail.com> wrote:
>>>
>>>>
>>>>> Why do you need varying types if you are just using html.Tokenizer 
>>>> methods? What is the difference between each type?
>>>>
>>>
>>>
>>> The difference is the VisitToken(), using the same function of 
>>> `WalkBody()`, but achieving different results. 
>>>
>>> For example, the current output from 
>>> https://github.com/suntong/lang/blob/master/lang/Go/src/xml/htmlParserTokens2.go
>>>  is 
>>> one way of abstracting the html structure, and I also planning to produce 
>>> text output that close to XML Outline View from Oxygen XML Editor, or 
>>> convert HTML to .md. 
>>>
>>> All of above involve walking the HTML the same way, but producing 
>>> results differently. 
>>>
>>>
>>>
>>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "golang-nuts" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/golang-nuts/FRE_A6cNzW8/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> golang-nuts...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to