d1a4aeb5e1
The parser is initialized with a HTML string which can be parsed as a document or a document fragment. When parsing a fragment a context element should be provided. It is also possible to parse the same string as a fragment for different context elements. In this case the parser reset its internal state and runs the parsing algorithm again. Parsing a fragment for the same context element runs the algorithm only once, since the parser caches the context element and the parsing results.
23 lines
516 B
Objective-C
23 lines
516 B
Objective-C
//
|
|
// HTMLParser.h
|
|
// HTMLKit
|
|
//
|
|
// Created by Iska on 04/10/14.
|
|
// Copyright (c) 2014 BrainCookie. All rights reserved.
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import "HTMLElement.h"
|
|
|
|
@interface HTMLParser : NSObject
|
|
|
|
@property (nonatomic, strong, readonly) NSArray *parseErrors;
|
|
@property (nonatomic, strong, readonly) HTMLDocument *document;
|
|
|
|
- (instancetype)initWithString:(NSString *)string;
|
|
|
|
- (HTMLDocument *)parseDocument;
|
|
- (NSArray *)parseFragmentWithContextElement:(HTMLElement *)contextElement;
|
|
|
|
@end
|