Using NSXMLDocument methods, I attempted to parse a web page to create a list of pharmacies’ addresses, phones and faxes. In an effort to XML parse the following page, my attempts at initializing the NSXML document with the contents of the url failed.
use framework "Foundation"
set theURL to current application's |NSURL|'s URLWithString:"https://www.goodrx.com/pharmacy-near-me/cvs-pharmacy/ca/Daly-City"
set {theDoc, theError} to current application's NSXMLDocument's alloc()'s initWithContentsOfURL:theURL options:0 |error|:(reference)
This erred with
The data that I was attempting to gather from that url page is contained in an html block that I have punctuated for the purposes of clarity with new lines
In this example, I would like to capture the nodes containing data such as:
• address: 375 Gellert Blvd, Daly City
• phone: (650) 994-0752
• fax: (650) 994-2619
And of course, I would like to derive via xml the next set of data of the subsequent pharmacy’s address, phone and fax, identified in this web page.
My questions are:
- What possible methods can I use to circumvent the NSXMLParserErrorDomain error?
- What possible methods can I use to identify the desired XML nodes?