1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | import { Writable } from 'stream'
|
15 | import { DomHandler } from 'domhandler';
|
16 | import * as DomUtils from 'domutils';
|
17 | export { DomElement, DomHandlerOptions, DomHandler, Element, Node } from 'domhandler';
|
18 |
|
19 | export interface ParserOptions {
|
20 |
|
21 | |
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | xmlMode?: boolean | undefined;
|
28 |
|
29 | |
30 |
|
31 |
|
32 | decodeEntities?: boolean | undefined;
|
33 |
|
34 | |
35 |
|
36 |
|
37 | lowerCaseTags?: boolean | undefined;
|
38 |
|
39 | |
40 |
|
41 |
|
42 | lowerCaseAttributeNames?: boolean | undefined;
|
43 |
|
44 | |
45 |
|
46 |
|
47 |
|
48 | recognizeCDATA?: boolean | undefined;
|
49 |
|
50 | |
51 |
|
52 |
|
53 |
|
54 | recognizeSelfClosing?: boolean | undefined;
|
55 | }
|
56 |
|
57 |
|
58 |
|
59 | export type Options = ParserOptions
|
60 |
|
61 | export declare class WritableStream extends Writable {
|
62 | constructor(handler: DomHandler, options?: ParserOptions);
|
63 | }
|
64 |
|
65 | export declare class Parser {
|
66 | constructor(handler: Partial<DomHandler>, options?: ParserOptions);
|
67 |
|
68 | /***
|
69 | * Parses a chunk of data and calls the corresponding callbacks.
|
70 | * @param input
|
71 | */
|
72 | write(input: string): void;
|
73 |
|
74 | /***
|
75 | * alias for backwards compat
|
76 | */
|
77 | parseChunk(chunk: string): void;
|
78 |
|
79 | /***
|
80 | * Parses the end of the buffer and clears the stack, calls onend.
|
81 | */
|
82 | end(): void;
|
83 |
|
84 | /***
|
85 | * Parses the end of the buffer and clears the stack, calls onend.
|
86 | */
|
87 | end(chunk: string): void;
|
88 |
|
89 | /***
|
90 | * alias for backwards compat
|
91 | */
|
92 | done(): void;
|
93 |
|
94 | /***
|
95 | * Pauses the parser
|
96 | */
|
97 | pause(): void;
|
98 |
|
99 | /***
|
100 | * Resumes the parser
|
101 | */
|
102 | resume(): void;
|
103 |
|
104 | /***
|
105 | * Resets the parser, parses the data & calls end.
|
106 | * @param input
|
107 | */
|
108 | parseComplete(input: string): void;
|
109 |
|
110 | /***
|
111 | * Resets buffer & stack, calls onreset.
|
112 | */
|
113 | reset(): void;
|
114 |
|
115 | ontext(data: any): void;
|
116 | onopentagname(name: string): void;
|
117 | onopentagend(): void;
|
118 | onclosetag(name: string): void;
|
119 | onselfclosingtag(): void;
|
120 | onattribname(name: string): void;
|
121 | onattribend(): void;
|
122 | ondeclaration(): void;
|
123 | onprocessinginstruction(value: string): void;
|
124 | oncomment(value: string): void;
|
125 | oncdata(value: string): void;
|
126 | onerror(err: Error): void;
|
127 | onend(): void;
|
128 | }
|
129 |
|
130 | export { DomUtils }
|