@lango-project/lango-js 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,591 @@
1
+ 'use strict';
2
+
3
+ var conventions = require('./conventions');
4
+ var dom = require('./dom');
5
+ var errors = require('./errors');
6
+ var entities = require('./entities');
7
+ var sax = require('./sax');
8
+
9
+ var DOMImplementation = dom.DOMImplementation;
10
+
11
+ var hasDefaultHTMLNamespace = conventions.hasDefaultHTMLNamespace;
12
+ var isHTMLMimeType = conventions.isHTMLMimeType;
13
+ var isValidMimeType = conventions.isValidMimeType;
14
+ var MIME_TYPE = conventions.MIME_TYPE;
15
+ var NAMESPACE = conventions.NAMESPACE;
16
+ var ParseError = errors.ParseError;
17
+
18
+ var XMLReader = sax.XMLReader;
19
+
20
+ /**
21
+ * Normalizes line ending according to <https://www.w3.org/TR/xml11/#sec-line-ends>,
22
+ * including some Unicode "newline" characters:
23
+ *
24
+ * > XML parsed entities are often stored in computer files which,
25
+ * > for editing convenience, are organized into lines.
26
+ * > These lines are typically separated by some combination
27
+ * > of the characters CARRIAGE RETURN (#xD) and LINE FEED (#xA).
28
+ * >
29
+ * > To simplify the tasks of applications, the XML processor must behave
30
+ * > as if it normalized all line breaks in external parsed entities (including the document entity)
31
+ * > on input, before parsing, by translating the following to a single #xA character:
32
+ * >
33
+ * > 1. the two-character sequence #xD #xA,
34
+ * > 2. the two-character sequence #xD #x85,
35
+ * > 3. the single character #x85,
36
+ * > 4. the single character #x2028,
37
+ * > 5. the single character #x2029,
38
+ * > 6. any #xD character that is not immediately followed by #xA or #x85.
39
+ *
40
+ * @param {string} input
41
+ * @returns {string}
42
+ * @prettierignore
43
+ */
44
+ function normalizeLineEndings(input) {
45
+ return input.replace(/\r[\n\u0085]/g, '\n').replace(/[\r\u0085\u2028\u2029]/g, '\n');
46
+ }
47
+
48
+ /**
49
+ * @typedef Locator
50
+ * @property {number} [columnNumber]
51
+ * @property {number} [lineNumber]
52
+ */
53
+
54
+ /**
55
+ * @typedef DOMParserOptions
56
+ * @property {typeof assign} [assign]
57
+ * The method to use instead of `conventions.assign`, which is used to copy values from
58
+ * `options` before they are used for parsing.
59
+ * @property {typeof DOMHandler} [domHandler]
60
+ * For internal testing: The class for creating an instance for handling events from the SAX
61
+ * parser.
62
+ * *****Warning: By configuring a faulty implementation, the specified behavior can completely
63
+ * be broken.*****.
64
+ * @property {Function} [errorHandler]
65
+ * DEPRECATED! use `onError` instead.
66
+ * @property {function(level:ErrorLevel, message:string, context: DOMHandler):void}
67
+ * [onError]
68
+ * A function invoked for every error that occurs during parsing.
69
+ *
70
+ * If it is not provided, all errors are reported to `console.error`
71
+ * and only `fatalError`s are thrown as a `ParseError`,
72
+ * which prevents any further processing.
73
+ * If the provided method throws, a `ParserError` is thrown,
74
+ * which prevents any further processing.
75
+ *
76
+ * Be aware that many `warning`s are considered an error that prevents further processing in
77
+ * most implementations.
78
+ * @property {boolean} [locator=true]
79
+ * Configures if the nodes created during parsing will have a `lineNumber` and a `columnNumber`
80
+ * attribute describing their location in the XML string.
81
+ * Default is true.
82
+ * @property {(string) => string} [normalizeLineEndings]
83
+ * used to replace line endings before parsing, defaults to exported `normalizeLineEndings`,
84
+ * which normalizes line endings according to <https://www.w3.org/TR/xml11/#sec-line-ends>,
85
+ * including some Unicode "newline" characters.
86
+ * @property {Object} [xmlns]
87
+ * The XML namespaces that should be assumed when parsing.
88
+ * The default namespace can be provided by the key that is the empty string.
89
+ * When the `mimeType` for HTML, XHTML or SVG are passed to `parseFromString`,
90
+ * the default namespace that will be used,
91
+ * will be overridden according to the specification.
92
+ * @see {@link normalizeLineEndings}
93
+ */
94
+
95
+ /**
96
+ * The DOMParser interface provides the ability to parse XML or HTML source code from a string
97
+ * into a DOM `Document`.
98
+ *
99
+ * ***xmldom is different from the spec in that it allows an `options` parameter,
100
+ * to control the behavior***.
101
+ *
102
+ * @class
103
+ * @param {DOMParserOptions} [options]
104
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser
105
+ * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization
106
+ */
107
+ function DOMParser(options) {
108
+ options = options || {};
109
+ if (options.locator === undefined) {
110
+ options.locator = true;
111
+ }
112
+
113
+ /**
114
+ * The method to use instead of `conventions.assign`, which is used to copy values from
115
+ * `options`
116
+ * before they are used for parsing.
117
+ *
118
+ * @type {conventions.assign}
119
+ * @private
120
+ * @see {@link conventions.assign}
121
+ * @readonly
122
+ */
123
+ this.assign = options.assign || conventions.assign;
124
+
125
+ /**
126
+ * For internal testing: The class for creating an instance for handling events from the SAX
127
+ * parser.
128
+ * *****Warning: By configuring a faulty implementation, the specified behavior can completely
129
+ * be broken*****.
130
+ *
131
+ * @type {typeof DOMHandler}
132
+ * @private
133
+ * @readonly
134
+ */
135
+ this.domHandler = options.domHandler || DOMHandler;
136
+
137
+ /**
138
+ * A function that is invoked for every error that occurs during parsing.
139
+ *
140
+ * If it is not provided, all errors are reported to `console.error`
141
+ * and only `fatalError`s are thrown as a `ParseError`,
142
+ * which prevents any further processing.
143
+ * If the provided method throws, a `ParserError` is thrown,
144
+ * which prevents any further processing.
145
+ *
146
+ * Be aware that many `warning`s are considered an error that prevents further processing in
147
+ * most implementations.
148
+ *
149
+ * @type {function(level:ErrorLevel, message:string, context: DOMHandler):void}
150
+ * @see {@link onErrorStopParsing}
151
+ * @see {@link onWarningStopParsing}
152
+ */
153
+ this.onError = options.onError || options.errorHandler;
154
+ if (options.errorHandler && typeof options.errorHandler !== 'function') {
155
+ throw new TypeError('errorHandler object is no longer supported, switch to onError!');
156
+ } else if (options.errorHandler) {
157
+ options.errorHandler('warning', 'The `errorHandler` option has been deprecated, use `onError` instead!', this);
158
+ }
159
+
160
+ /**
161
+ * used to replace line endings before parsing, defaults to `normalizeLineEndings`
162
+ *
163
+ * @type {(string) => string}
164
+ * @readonly
165
+ */
166
+ this.normalizeLineEndings = options.normalizeLineEndings || normalizeLineEndings;
167
+
168
+ /**
169
+ * Configures if the nodes created during parsing will have a `lineNumber` and a
170
+ * `columnNumber`
171
+ * attribute describing their location in the XML string.
172
+ * Default is true.
173
+ *
174
+ * @type {boolean}
175
+ * @readonly
176
+ */
177
+ this.locator = !!options.locator;
178
+
179
+ /**
180
+ * The default namespace can be provided by the key that is the empty string.
181
+ * When the `mimeType` for HTML, XHTML or SVG are passed to `parseFromString`,
182
+ * the default namespace that will be used,
183
+ * will be overridden according to the specification.
184
+ *
185
+ * @type {Readonly<Object>}
186
+ * @readonly
187
+ */
188
+ this.xmlns = this.assign(Object.create(null), options.xmlns);
189
+ }
190
+
191
+ /**
192
+ * Parses `source` using the options in the way configured by the `DOMParserOptions` of `this`
193
+ * `DOMParser`. If `mimeType` is `text/html` an HTML `Document` is created,
194
+ * otherwise an XML `Document` is created.
195
+ *
196
+ * __It behaves different from the description in the living standard__:
197
+ * - Uses the `options` passed to the `DOMParser` constructor to modify the behavior.
198
+ * - Any unexpected input is reported to `onError` with either a `warning`,
199
+ * `error` or `fatalError` level.
200
+ * - Any `fatalError` throws a `ParseError` which prevents further processing.
201
+ * - Any error thrown by `onError` is converted to a `ParseError` which prevents further
202
+ * processing - If no `Document` was created during parsing it is reported as a `fatalError`.
203
+ * - A `DOMException` raised while building the DOM (e.g. an unbound namespace prefix) is
204
+ * reported as a `fatalError` and rethrown as a `ParseError` with the `DOMException` as its
205
+ * `cause`.
206
+ * *****Warning: By configuring a faulty DOMHandler implementation,
207
+ * the specified behavior can completely be broken*****.
208
+ *
209
+ * @param {string} source
210
+ * The XML mime type only allows string input!
211
+ * @param {string} [mimeType='application/xml']
212
+ * the mimeType or contentType of the document to be created determines the `type` of document
213
+ * created (XML or HTML)
214
+ * @returns {Document}
215
+ * The `Document` node.
216
+ * @throws {ParseError}
217
+ * for any `fatalError` or anything that is thrown by `onError`
218
+ * @throws {TypeError}
219
+ * for any invalid `mimeType`
220
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString
221
+ * @see https://html.spec.whatwg.org/#dom-domparser-parsefromstring-dev
222
+ */
223
+ DOMParser.prototype.parseFromString = function (source, mimeType) {
224
+ if (!isValidMimeType(mimeType)) {
225
+ throw new TypeError('DOMParser.parseFromString: the provided mimeType "' + mimeType + '" is not valid.');
226
+ }
227
+ var defaultNSMap = this.assign(Object.create(null), this.xmlns);
228
+ var entityMap = entities.XML_ENTITIES;
229
+ var defaultNamespace = defaultNSMap[''] || null;
230
+ if (hasDefaultHTMLNamespace(mimeType)) {
231
+ entityMap = entities.HTML_ENTITIES;
232
+ defaultNamespace = NAMESPACE.HTML;
233
+ } else if (mimeType === MIME_TYPE.XML_SVG_IMAGE) {
234
+ defaultNamespace = NAMESPACE.SVG;
235
+ }
236
+ defaultNSMap[''] = defaultNamespace;
237
+ defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;
238
+
239
+ var domBuilder = new this.domHandler({
240
+ mimeType: mimeType,
241
+ defaultNamespace: defaultNamespace,
242
+ onError: this.onError,
243
+ });
244
+ var locator = this.locator ? {} : undefined;
245
+ if (this.locator) {
246
+ domBuilder.setDocumentLocator(locator);
247
+ }
248
+
249
+ var sax = new XMLReader();
250
+ sax.errorHandler = domBuilder;
251
+ sax.domBuilder = domBuilder;
252
+ var isXml = !conventions.isHTMLMimeType(mimeType);
253
+ if (isXml && typeof source !== 'string') {
254
+ sax.errorHandler.fatalError('source is not a string');
255
+ }
256
+ sax.parse(this.normalizeLineEndings(String(source)), defaultNSMap, entityMap);
257
+ if (!domBuilder.doc.documentElement) {
258
+ sax.errorHandler.fatalError('missing root element');
259
+ }
260
+ return domBuilder.doc;
261
+ };
262
+
263
+ /**
264
+ * @typedef DOMHandlerOptions
265
+ * @property {string} [mimeType=MIME_TYPE.XML_APPLICATION]
266
+ * @property {string | null} [defaultNamespace=null]
267
+ */
268
+ /**
269
+ * The class that is used to handle events from the SAX parser to create the related DOM
270
+ * elements.
271
+ *
272
+ * Some methods are only implemented as an empty function,
273
+ * since they are (at least currently) not relevant for xmldom.
274
+ *
275
+ * @class
276
+ * @param {DOMHandlerOptions} [options]
277
+ * @see http://www.saxproject.org/apidoc/org/xml/sax/ext/DefaultHandler2.html
278
+ */
279
+ function DOMHandler(options) {
280
+ var opt = options || {};
281
+ /**
282
+ * The mime type is used to determine if the DOM handler will create an XML or HTML document.
283
+ * Only if it is set to `text/html` it will create an HTML document.
284
+ * It defaults to MIME_TYPE.XML_APPLICATION.
285
+ *
286
+ * @type {string}
287
+ * @see {@link MIME_TYPE}
288
+ * @readonly
289
+ */
290
+ this.mimeType = opt.mimeType || MIME_TYPE.XML_APPLICATION;
291
+
292
+ /**
293
+ * The namespace to use to create an XML document.
294
+ * For the following reasons this is required:
295
+ * - The SAX API for `startDocument` doesn't offer any way to pass a namespace,
296
+ * since at that point there is no way for the parser to know what the default namespace from
297
+ * the document will be.
298
+ * - When creating using `DOMImplementation.createDocument` it is required to pass a
299
+ * namespace,
300
+ * to determine the correct `Document.contentType`, which should match `this.mimeType`.
301
+ * - When parsing an XML document with the `application/xhtml+xml` mimeType,
302
+ * the HTML namespace needs to be the default namespace.
303
+ *
304
+ * @type {string | null}
305
+ * @private
306
+ * @readonly
307
+ */
308
+ this.defaultNamespace = opt.defaultNamespace || null;
309
+
310
+ /**
311
+ * @type {boolean}
312
+ * @private
313
+ */
314
+ this.cdata = false;
315
+
316
+ /**
317
+ * The last `Element` that was created by `startElement`.
318
+ * `endElement` sets it to the `currentElement.parentNode`.
319
+ *
320
+ * Note: The sax parser currently sets it to white space text nodes between tags.
321
+ *
322
+ * @type {Element | Node | undefined}
323
+ * @private
324
+ */
325
+ this.currentElement = undefined;
326
+
327
+ /**
328
+ * The Document that is created as part of `startDocument`,
329
+ * and returned by `DOMParser.parseFromString`.
330
+ *
331
+ * @type {Document | undefined}
332
+ * @readonly
333
+ */
334
+ this.doc = undefined;
335
+
336
+ /**
337
+ * The locator is stored as part of setDocumentLocator.
338
+ * It is controlled and mutated by the SAX parser to store the current parsing position.
339
+ * It is used by DOMHandler to set `columnNumber` and `lineNumber`
340
+ * on the DOM nodes.
341
+ *
342
+ * @type {Readonly<Locator> | undefined}
343
+ * @private
344
+ * @readonly (the
345
+ * sax parser currently sometimes set's it)
346
+ */
347
+ this.locator = undefined;
348
+ /**
349
+ * @type {function (level:ErrorLevel ,message:string, context:DOMHandler):void}
350
+ * @readonly
351
+ */
352
+ this.onError = opt.onError;
353
+ }
354
+
355
+ function position(locator, node) {
356
+ node.lineNumber = locator.lineNumber;
357
+ node.columnNumber = locator.columnNumber;
358
+ }
359
+
360
+ DOMHandler.prototype = {
361
+ /**
362
+ * Either creates an XML or an HTML document and stores it under `this.doc`.
363
+ * If it is an XML document, `this.defaultNamespace` is used to create it,
364
+ * and it will not contain any `childNodes`.
365
+ * If it is an HTML document, it will be created without any `childNodes`.
366
+ *
367
+ * @see http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html
368
+ */
369
+ startDocument: function () {
370
+ var impl = new DOMImplementation();
371
+ this.doc = isHTMLMimeType(this.mimeType) ? impl.createHTMLDocument(false) : impl.createDocument(this.defaultNamespace, '');
372
+ },
373
+ startElement: function (namespaceURI, localName, qName, attrs) {
374
+ var doc = this.doc;
375
+ var el = doc.createElementNS(namespaceURI, qName || localName);
376
+ var len = attrs.length;
377
+ appendElement(this, el);
378
+ this.currentElement = el;
379
+
380
+ this.locator && position(this.locator, el);
381
+ for (var i = 0; i < len; i++) {
382
+ var namespaceURI = attrs.getURI(i);
383
+ var value = attrs.getValue(i);
384
+ var qName = attrs.getQName(i);
385
+ var attr = doc.createAttributeNS(namespaceURI, qName);
386
+ this.locator && position(attrs.getLocator(i), attr);
387
+ attr.value = attr.nodeValue = value;
388
+ el.setAttributeNode(attr);
389
+ }
390
+ },
391
+ endElement: function (namespaceURI, localName, qName) {
392
+ this.currentElement = this.currentElement.parentNode;
393
+ },
394
+ startPrefixMapping: function (prefix, uri) {},
395
+ endPrefixMapping: function (prefix) {},
396
+ processingInstruction: function (target, data) {
397
+ var ins = this.doc.createProcessingInstruction(target, data);
398
+ this.locator && position(this.locator, ins);
399
+ appendElement(this, ins);
400
+ },
401
+ ignorableWhitespace: function (ch, start, length) {},
402
+ characters: function (chars, start, length) {
403
+ chars = _toString.apply(this, arguments);
404
+ //console.log(chars)
405
+ if (chars) {
406
+ if (this.cdata) {
407
+ var charNode = this.doc.createCDATASection(chars);
408
+ } else {
409
+ var charNode = this.doc.createTextNode(chars);
410
+ }
411
+ if (this.currentElement) {
412
+ this.currentElement.appendChild(charNode);
413
+ } else if (/^\s*$/.test(chars)) {
414
+ this.doc.appendChild(charNode);
415
+ //process xml
416
+ }
417
+ this.locator && position(this.locator, charNode);
418
+ }
419
+ },
420
+ skippedEntity: function (name) {},
421
+ endDocument: function () {
422
+ this.doc.normalize();
423
+ },
424
+ /**
425
+ * Stores the locator to be able to set the `columnNumber` and `lineNumber`
426
+ * on the created DOM nodes.
427
+ *
428
+ * @param {Locator} locator
429
+ */
430
+ setDocumentLocator: function (locator) {
431
+ if (locator) {
432
+ locator.lineNumber = 0;
433
+ }
434
+ this.locator = locator;
435
+ },
436
+ //LexicalHandler
437
+ comment: function (chars, start, length) {
438
+ chars = _toString.apply(this, arguments);
439
+ var comm = this.doc.createComment(chars);
440
+ this.locator && position(this.locator, comm);
441
+ appendElement(this, comm);
442
+ },
443
+
444
+ startCDATA: function () {
445
+ //used in characters() methods
446
+ this.cdata = true;
447
+ },
448
+ endCDATA: function () {
449
+ this.cdata = false;
450
+ },
451
+
452
+ startDTD: function (name, publicId, systemId, internalSubset) {
453
+ var impl = this.doc.implementation;
454
+ if (impl && impl.createDocumentType) {
455
+ var dt = impl.createDocumentType(name, publicId, systemId, internalSubset);
456
+ this.locator && position(this.locator, dt);
457
+ appendElement(this, dt);
458
+ this.doc.doctype = dt;
459
+ }
460
+ },
461
+ reportError: function (level, message) {
462
+ if (typeof this.onError === 'function') {
463
+ try {
464
+ this.onError(level, message, this);
465
+ } catch (e) {
466
+ throw new ParseError('Reporting ' + level + ' "' + message + '" caused ' + e, this.locator);
467
+ }
468
+ } else {
469
+ console.error('[xmldom ' + level + ']\t' + message, _locator(this.locator));
470
+ }
471
+ },
472
+ /**
473
+ * @see http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html
474
+ */
475
+ warning: function (message) {
476
+ this.reportError('warning', message);
477
+ },
478
+ error: function (message) {
479
+ this.reportError('error', message);
480
+ },
481
+ /**
482
+ * This function reports a fatal error and throws a ParseError.
483
+ *
484
+ * @param {string} message
485
+ * - The message to be used for reporting and throwing the error.
486
+ * @param {Error} [cause]
487
+ * The error that caused this fatal error, preserved as the thrown `ParseError`'s `cause`.
488
+ * @returns {never}
489
+ * This function always throws an error and never returns a value.
490
+ * @throws {ParseError}
491
+ * Always throws a ParseError with the provided message.
492
+ */
493
+ fatalError: function (message, cause) {
494
+ this.reportError('fatalError', message);
495
+ throw new ParseError(message, this.locator, cause);
496
+ },
497
+ };
498
+
499
+ function _locator(l) {
500
+ if (l) {
501
+ return '\n@#[line:' + l.lineNumber + ',col:' + l.columnNumber + ']';
502
+ }
503
+ }
504
+
505
+ function _toString(chars, start, length) {
506
+ if (typeof chars == 'string') {
507
+ return chars.substr(start, length);
508
+ } else {
509
+ //java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)")
510
+ if (chars.length >= start + length || start) {
511
+ return new java.lang.String(chars, start, length) + '';
512
+ }
513
+ return chars;
514
+ }
515
+ }
516
+
517
+ /*
518
+ * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html
519
+ * used method of org.xml.sax.ext.LexicalHandler:
520
+ * #comment(chars, start, length)
521
+ * #startCDATA()
522
+ * #endCDATA()
523
+ * #startDTD(name, publicId, systemId)
524
+ *
525
+ *
526
+ * IGNORED method of org.xml.sax.ext.LexicalHandler:
527
+ * #endDTD()
528
+ * #startEntity(name)
529
+ * #endEntity(name)
530
+ *
531
+ *
532
+ * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html
533
+ * IGNORED method of org.xml.sax.ext.DeclHandler
534
+ * #attributeDecl(eName, aName, type, mode, value)
535
+ * #elementDecl(name, model)
536
+ * #externalEntityDecl(name, publicId, systemId)
537
+ * #internalEntityDecl(name, value)
538
+ * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html
539
+ * IGNORED method of org.xml.sax.EntityResolver2
540
+ * #resolveEntity(String name,String publicId,String baseURI,String systemId)
541
+ * #resolveEntity(publicId, systemId)
542
+ * #getExternalSubset(name, baseURI)
543
+ * @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html
544
+ * IGNORED method of org.xml.sax.DTDHandler
545
+ * #notationDecl(name, publicId, systemId) {};
546
+ * #unparsedEntityDecl(name, publicId, systemId, notationName) {};
547
+ */
548
+ 'endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl'.replace(
549
+ /\w+/g,
550
+ function (key) {
551
+ DOMHandler.prototype[key] = function () {
552
+ return null;
553
+ };
554
+ }
555
+ );
556
+
557
+ /* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */
558
+ function appendElement(handler, node) {
559
+ if (!handler.currentElement) {
560
+ handler.doc.appendChild(node);
561
+ } else {
562
+ handler.currentElement.appendChild(node);
563
+ }
564
+ }
565
+
566
+ /**
567
+ * A method that prevents any further parsing when an `error`
568
+ * with level `error` is reported during parsing.
569
+ *
570
+ * @see {@link DOMParserOptions.onError}
571
+ * @see {@link onWarningStopParsing}
572
+ */
573
+ function onErrorStopParsing(level) {
574
+ if (level === 'error') throw 'onErrorStopParsing';
575
+ }
576
+
577
+ /**
578
+ * A method that prevents any further parsing when any `error` is reported during parsing.
579
+ *
580
+ * @see {@link DOMParserOptions.onError}
581
+ * @see {@link onErrorStopParsing}
582
+ */
583
+ function onWarningStopParsing() {
584
+ throw 'onWarningStopParsing';
585
+ }
586
+
587
+ exports.__DOMHandler = DOMHandler;
588
+ exports.DOMParser = DOMParser;
589
+ exports.normalizeLineEndings = normalizeLineEndings;
590
+ exports.onErrorStopParsing = onErrorStopParsing;
591
+ exports.onWarningStopParsing = onWarningStopParsing;