forked from nolanw/HTMLReader
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTMLDocument.h
More file actions
59 lines (42 loc) · 1.92 KB
/
HTMLDocument.h
File metadata and controls
59 lines (42 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// HTMLDocument.h
//
// Public domain. https://github.com/nolanw/HTMLReader
#import <HTMLReader/HTMLDocumentType.h>
#import <HTMLReader/HTMLElement.h>
#import <HTMLReader/HTMLNode.h>
#import <HTMLReader/HTMLQuirksMode.h>
#import <HTMLReader/HTMLSupport.h>
NS_ASSUME_NONNULL_BEGIN
/**
An HTMLDocument is the root of a tree of nodes representing parsed HTML.
For more information, see http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#writing
*/
@interface HTMLDocument : HTMLNode
/**
Parses data of an unknown string encoding into an HTML document.
@param contentType The value of the HTTP Content-Type header, if present.
*/
+ (instancetype)documentWithData:(NSData *)data contentTypeHeader:(NSString * __nullable)contentType;
/**
Initializes a document with data of an unknown string encoding.
@param contentType The value of the HTTP Content-Type header, if present.
*/
- (instancetype)initWithData:(NSData *)data contentTypeHeader:(NSString * __nullable)contentType;
/// Parses an HTML string into a document.
+ (instancetype)documentWithString:(NSString *)string;
/// Initializes a document with a string of HTML.
- (instancetype)initWithString:(NSString *)string;
/**
The document type node.
The setter replaces the existing documentType, if there is one; otherwise, the new documentType will be placed immediately before the rootElement, if there is one; otherwise the new documentType is added as the last child.
*/
@property (strong, nonatomic) HTMLDocumentType * __nullable documentType;
/// The document's quirks mode.
@property (assign, nonatomic) HTMLQuirksMode quirksMode;
/**
The first element in tree order. Typically the `<html>` element.
The setter replaces the existing rootElement, if there is one; otherwise, the new rootElement is added as the last child.
*/
@property (strong, nonatomic) HTMLElement * __nullable rootElement;
@end
NS_ASSUME_NONNULL_END