I deleted the playground and entered the text thusly

ingredientsXML := XMLHTMLParser parseURL: 
'https://ndb.nal.usda.gov/ndb/search/list?sort=ndb&ds=Standard+Reference’. 

“do it” has no complaints

ingredientsXML = nil 

yields “false"

ingredientsXML inspect

has errors: #new sent to nil


.

This makes no sense at all.


L


> On Jan 7, 2020, at 1:55 AM, PBKResearch <pe...@pbkresearch.co.uk> wrote:
> 
> It may be a quirk of how Pharo Playground works. It doesn't need local 
> variable declarations - which is convenient - but putting them in can screw 
> things up. Try your snippet again without the first line. Compare Torsten's 
> code.
> 
> HTH
> 
> Peter Kenny
> 
> -----Original Message-----
> From: Pharo-users <pharo-users-boun...@lists.pharo.org> On Behalf Of Torsten 
> Bergmann
> Sent: 07 January 2020 07:47
> To: pharo-users@lists.pharo.org
> Cc: pharo-users@lists.pharo.org
> Subject: Re: [Pharo-users] [ANN] XMLParserHTML moved to GitHub
> 
> Works without a problem (Pharo 8 on Windows), see attached. So it looks like 
> a local problem.
> 
> Just check the debugger and compare to the squeak version where you run in 
> trouble.
> Maybe the document could not be retrieved on your machine.
> 
> Bye
> T.
> 
>> Gesendet: Dienstag, 07. Januar 2020 um 04:42 Uhr
>> Von: "LawsonEnglish" <lengli...@cox.net>
>> An: pharo-users@lists.pharo.org
>> Betreff: Re: [Pharo-users] [ANN] XMLParserHTML moved to GitHub
>> 
>> Torsten Bergmann wrote
>>> Hi,
>>> 
>>> 
>>> You can load using
>>> 
>>>   Metacello new
>>>     baseline: 'XMLParserHTML';
>>>     repository: 'github://pharo-contributions/XML-XMLParserHTML/src';
>>>     load.
>>> 
>>> 
>>> Bye
>>> T.
>> 
>> Hi,
>> 
>> I'm trying to use the sample code in the pharo screen scraping booklet 
>> — 
>> http://books.pharo.org/booklet-Scraping/pdf/2018-09-02-scrapingbook.pdf — 
>> but while everything appears to load, I'm getting an odd behavior from:
>> 
>> /| ingredientsXML |
>> ingredientsXML := XMLHTMLParser parseURL:
>> 'https://ndb.nal.usda.gov/ndb/search/list?sort=ndb&ds=Standard+Reference'.
>> ingredientsXML inspect/
>> 
>> "#new was sent to nil"
>> 
>> No matter what URL I use, I get the same message.
>> 
>> I'm using Mac OS Catalina so I thought I might have some strange Mac 
>> OS security issue (like it was quietly refusing to allow Pharo to 
>> access the internet), but I tested with squeak and the old
>> 
>> /html :=(HtmlParser parse:
>> 'https://ndb.nal.usda.gov/ndb/search/list?sort=ndb&ds=Standard+Reference'
>> asUrl retrieveContents content)/
>> 
>> and that returns actual html without any problems.
>> 
>> 
>> Suggestions?
>> 
>> 
>> Thanks.
>> 
>> L
>> 
>> 
>> 
>> 
>> --
>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>> 
>> 
> 
> 

Reply via email to