• 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: HTML Parsing Follow-up
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HTML Parsing Follow-up


  • Subject: Re: HTML Parsing Follow-up
  • From: Markus Hitter <email@hidden>
  • Date: Tue, 22 Jan 2002 14:35:53 +0100

Am Dienstag den, 22. Januar 2002, um 07:39, schrieb Sam Goldman:

There was a short e-mail series on this list about HTML Parsing and it gave
me a little inspiration to get it working.

I came up with this:

- (void)awakeFromNib
{
NSString *testString = @"This <string> is <a> test <string>";
NSScanner *scanner = [[NSScanner alloc] initWithString:testString];

// this can be done with one method (and you forgot to release it later, too):
NSScanner *scanner = [NSScanner scannerWithString:testString];

NSString *tmpString = [[[NSString alloc] init] autorelease];

// no need to allocate an empty string here,
// NSScanner methods will return a new, auotreleased one.
NSString *tmpString;

NSMutableString *doneString = [[[NSMutableString alloc] init]
autorelease];

while ([scanner scanUpToString:@"<" intoString:&tmpString])
{
[doneString appendString:tmpString];

// what about this:
while (! [scanner isAtEnd]) {
[scanner scanUpToString:@"<" intoString:&tmpString])
[doneString appendString:tmpString];
[scanner scanString:@">" intoString:nil];
} // end of while loop



Have fun,
Markus

- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/


References: 
 >HTML Parsing Follow-up (From: Sam Goldman <email@hidden>)

  • Prev by Date: Re: How to interact with Address Book or Mail App
  • Next by Date: Re: Apple Serial Number: Redux
  • Previous by thread: HTML Parsing Follow-up
  • Next by thread: What's up with NSTableView?
  • Index(es):
    • Date
    • Thread