• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting HTML
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting HTML


  • Subject: Re: Getting HTML
  • From: "John C. Randolph" <email@hidden>
  • Date: Thu, 14 Jun 2001 09:07:16 -0700

On Wednesday, June 13, 2001, at 12:12 PM, email@hidden wrote:

Whats the easiest way to get the HTML from a given URL? The only examples I have seen have been the OmniGroups, and they arent helping me much...too complex. I just need to take the HTML and assign it to a string, and then later on use the string. Any suggestions?

Just did this about two days ago:

- (IBAction)retrieveURL:(id)sender
{
NSURL *where =
[NSURL URLWithString:[[[sender stringValue] mutableCopy] stringWithPrefix:@"http://"; suffix:@"/"]];
NSAttributedString
*content =
[[NSAttributedString alloc]
initWithHTML:[NSData dataWithContentsOfURL:where]
documentAttributes:nil];
[[ContentText textStorage] setAttributedString:content];
}

-stringWithPrefix:suffix: is defined in a MiscKit category, it simply ensures that the string in question has the given prefix and suffix. ContentText is an NSTextField.

Hope this helps,

-jcr


"The right to be heard does not include the right to be taken seriously." - Hubert Humphrey


References: 
 >Getting HTML (From: email@hidden)

  • Prev by Date: Re: What has Bill Gates got to do with Obj-C ???
  • Next by Date: Re: Cocoa, a complete Mac OS X API?
  • Previous by thread: Getting HTML
  • Next by thread: Re: Getting HTML
  • Index(es):
    • Date
    • Thread