Help with a non blocking call

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with a non blocking call

Günther Schmidt
Hi,

I'm trying this for the first time:

1 doc := (IXMLDOMDocument new)
2 loadURL: self url , id printString;
3 yourself.
4 root := doc documentElement.
5 ^(root selectNodes: './/catalog') collect: [:e | e attributes at: 'id']


and my program seems to fork on line 1-3, it's probably one of them non-blocking call thingies.

How can I make it wait until the call is finished?

Günther


Reply | Threaded
Open this post in threaded view
|

Re: Help with a non blocking call

Chris Uppal-3
Günther,
>
> I'm trying this for the first time:
>
> 1 doc := (IXMLDOMDocument new)
> 2 loadURL: self url , id printString;
> 3 yourself.
> 4 root := doc documentElement.
> 5 ^(root selectNodes: './/catalog') collect: [:e | e attributes at: 'id']

I haven't tried this myself but a quick look at the MS documentation suggests
that loadURL: is asynchronous by default (which is sensible).  So it looks as
if you should either wait until the #readyState propery has become 4 (=
"completed", the other states are 1 - "loading", 2 - "loaded", and 3 -
"interactive"), possibly using the #onreadystatechange: notification (sorry, I
have no idea how to do that myself), or set the #async propery to false before
doing the download.

    -- chris