@loaders.gl/xml 4.2.0-alpha.5 → 4.2.0-alpha.6
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.
- package/dist/dist.dev.js +141 -121
- package/dist/dist.min.js +8 -8
- package/dist/index.cjs +142 -121
- package/dist/index.cjs.map +2 -2
- package/dist/lib/parsers/streaming-xml-parser.js +4 -3
- package/dist/sax-ts/sax.js +100 -85
- package/dist/xml-loader.js +1 -1
- package/package.json +4 -4
package/dist/sax-ts/sax.js
CHANGED
|
@@ -335,89 +335,104 @@ Object.keys(ENTITIES).forEach((key) => {
|
|
|
335
335
|
* Internal helper class
|
|
336
336
|
*/
|
|
337
337
|
class SAX {
|
|
338
|
+
EVENTS = EVENTS;
|
|
339
|
+
ENTITIES = {
|
|
340
|
+
// TODO: make it readonly, needed for entity-mega test
|
|
341
|
+
// amp, gt, lt, quot and apos are resolved to strings instead of numerical
|
|
342
|
+
// codes, IDK why
|
|
343
|
+
...ENTITIES
|
|
344
|
+
};
|
|
345
|
+
XML_ENTITIES = {
|
|
346
|
+
amp: '&',
|
|
347
|
+
gt: '>',
|
|
348
|
+
lt: '<',
|
|
349
|
+
quot: '"',
|
|
350
|
+
apos: "'"
|
|
351
|
+
};
|
|
352
|
+
S = 0;
|
|
353
|
+
opt;
|
|
354
|
+
trackPosition = false;
|
|
355
|
+
column = 0;
|
|
356
|
+
line = 0;
|
|
357
|
+
c = '';
|
|
358
|
+
error;
|
|
359
|
+
q = '';
|
|
360
|
+
bufferCheckPosition;
|
|
361
|
+
closed = false;
|
|
362
|
+
tags = [];
|
|
363
|
+
looseCase = '';
|
|
364
|
+
closedRoot = false;
|
|
365
|
+
sawRoot = false;
|
|
366
|
+
strict = false;
|
|
367
|
+
tag;
|
|
368
|
+
strictEntities;
|
|
369
|
+
state;
|
|
370
|
+
noscript = false;
|
|
371
|
+
attribList = [];
|
|
372
|
+
ns;
|
|
373
|
+
position = 0;
|
|
374
|
+
STATE = {
|
|
375
|
+
BEGIN: this.S++, // leading byte order mark or whitespace
|
|
376
|
+
BEGIN_WHITESPACE: this.S++, // leading whitespace
|
|
377
|
+
TEXT: this.S++, // general stuff
|
|
378
|
+
TEXT_ENTITY: this.S++, // & and such.
|
|
379
|
+
OPEN_WAKA: this.S++, // <
|
|
380
|
+
SGML_DECL: this.S++, // <!BLARG
|
|
381
|
+
SGML_DECL_QUOTED: this.S++, // <!BLARG foo "bar
|
|
382
|
+
DOCTYPE: this.S++, // <!DOCTYPE
|
|
383
|
+
DOCTYPE_QUOTED: this.S++, // <!DOCTYPE "//blah
|
|
384
|
+
DOCTYPE_DTD: this.S++, // <!DOCTYPE "//blah" [ ...
|
|
385
|
+
DOCTYPE_DTD_QUOTED: this.S++, // <!DOCTYPE "//blah" [ "foo
|
|
386
|
+
COMMENT_STARTING: this.S++, // <!-
|
|
387
|
+
COMMENT: this.S++, // <!--
|
|
388
|
+
COMMENT_ENDING: this.S++, // <!-- blah -
|
|
389
|
+
COMMENT_ENDED: this.S++, // <!-- blah --
|
|
390
|
+
CDATA: this.S++, // <![CDATA[ something
|
|
391
|
+
CDATA_ENDING: this.S++, // ]
|
|
392
|
+
CDATA_ENDING_2: this.S++, // ]]
|
|
393
|
+
PROC_INST: this.S++, // <?hi
|
|
394
|
+
PROC_INST_BODY: this.S++, // <?hi there
|
|
395
|
+
PROC_INST_ENDING: this.S++, // <?hi "there" ?
|
|
396
|
+
OPEN_TAG: this.S++, // <strong
|
|
397
|
+
OPEN_TAG_SLASH: this.S++, // <strong /
|
|
398
|
+
ATTRIB: this.S++, // <a
|
|
399
|
+
ATTRIB_NAME: this.S++, // <a foo
|
|
400
|
+
ATTRIB_NAME_SAW_WHITE: this.S++, // <a foo _
|
|
401
|
+
ATTRIB_VALUE: this.S++, // <a foo=
|
|
402
|
+
ATTRIB_VALUE_QUOTED: this.S++, // <a foo="bar
|
|
403
|
+
ATTRIB_VALUE_CLOSED: this.S++, // <a foo="bar"
|
|
404
|
+
ATTRIB_VALUE_UNQUOTED: this.S++, // <a foo=bar
|
|
405
|
+
ATTRIB_VALUE_ENTITY_Q: this.S++, // <foo bar="""
|
|
406
|
+
ATTRIB_VALUE_ENTITY_U: this.S++, // <foo bar="
|
|
407
|
+
CLOSE_TAG: this.S++, // </a
|
|
408
|
+
CLOSE_TAG_SAW_WHITE: this.S++, // </a >
|
|
409
|
+
SCRIPT: this.S++, // <script> ...
|
|
410
|
+
SCRIPT_ENDING: this.S++ // <script> ... <
|
|
411
|
+
};
|
|
412
|
+
BUFFERS = BUFFERS;
|
|
413
|
+
// private parser: (strict: boolean, opt: any) => SAXParser;
|
|
414
|
+
CDATA = '[CDATA[';
|
|
415
|
+
DOCTYPE = 'DOCTYPE';
|
|
416
|
+
XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
417
|
+
XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/';
|
|
418
|
+
rootNS = {
|
|
419
|
+
xml: this.XML_NAMESPACE,
|
|
420
|
+
xmlns: this.XMLNS_NAMESPACE
|
|
421
|
+
};
|
|
422
|
+
comment;
|
|
423
|
+
sgmlDecl;
|
|
424
|
+
textNode = '';
|
|
425
|
+
tagName;
|
|
426
|
+
doctype;
|
|
427
|
+
procInstName;
|
|
428
|
+
procInstBody;
|
|
429
|
+
entity = '';
|
|
430
|
+
attribName;
|
|
431
|
+
attribValue;
|
|
432
|
+
cdata = '';
|
|
433
|
+
script = '';
|
|
434
|
+
startTagPosition = 0;
|
|
338
435
|
constructor() {
|
|
339
|
-
this.EVENTS = EVENTS;
|
|
340
|
-
this.ENTITIES = {
|
|
341
|
-
// TODO: make it readonly, needed for entity-mega test
|
|
342
|
-
// amp, gt, lt, quot and apos are resolved to strings instead of numerical
|
|
343
|
-
// codes, IDK why
|
|
344
|
-
...ENTITIES
|
|
345
|
-
};
|
|
346
|
-
this.XML_ENTITIES = {
|
|
347
|
-
amp: '&',
|
|
348
|
-
gt: '>',
|
|
349
|
-
lt: '<',
|
|
350
|
-
quot: '"',
|
|
351
|
-
apos: "'"
|
|
352
|
-
};
|
|
353
|
-
this.S = 0;
|
|
354
|
-
this.trackPosition = false;
|
|
355
|
-
this.column = 0;
|
|
356
|
-
this.line = 0;
|
|
357
|
-
this.c = '';
|
|
358
|
-
this.q = '';
|
|
359
|
-
this.closed = false;
|
|
360
|
-
this.tags = [];
|
|
361
|
-
this.looseCase = '';
|
|
362
|
-
this.closedRoot = false;
|
|
363
|
-
this.sawRoot = false;
|
|
364
|
-
this.strict = false;
|
|
365
|
-
this.noscript = false;
|
|
366
|
-
this.attribList = [];
|
|
367
|
-
this.position = 0;
|
|
368
|
-
this.STATE = {
|
|
369
|
-
BEGIN: this.S++, // leading byte order mark or whitespace
|
|
370
|
-
BEGIN_WHITESPACE: this.S++, // leading whitespace
|
|
371
|
-
TEXT: this.S++, // general stuff
|
|
372
|
-
TEXT_ENTITY: this.S++, // & and such.
|
|
373
|
-
OPEN_WAKA: this.S++, // <
|
|
374
|
-
SGML_DECL: this.S++, // <!BLARG
|
|
375
|
-
SGML_DECL_QUOTED: this.S++, // <!BLARG foo "bar
|
|
376
|
-
DOCTYPE: this.S++, // <!DOCTYPE
|
|
377
|
-
DOCTYPE_QUOTED: this.S++, // <!DOCTYPE "//blah
|
|
378
|
-
DOCTYPE_DTD: this.S++, // <!DOCTYPE "//blah" [ ...
|
|
379
|
-
DOCTYPE_DTD_QUOTED: this.S++, // <!DOCTYPE "//blah" [ "foo
|
|
380
|
-
COMMENT_STARTING: this.S++, // <!-
|
|
381
|
-
COMMENT: this.S++, // <!--
|
|
382
|
-
COMMENT_ENDING: this.S++, // <!-- blah -
|
|
383
|
-
COMMENT_ENDED: this.S++, // <!-- blah --
|
|
384
|
-
CDATA: this.S++, // <![CDATA[ something
|
|
385
|
-
CDATA_ENDING: this.S++, // ]
|
|
386
|
-
CDATA_ENDING_2: this.S++, // ]]
|
|
387
|
-
PROC_INST: this.S++, // <?hi
|
|
388
|
-
PROC_INST_BODY: this.S++, // <?hi there
|
|
389
|
-
PROC_INST_ENDING: this.S++, // <?hi "there" ?
|
|
390
|
-
OPEN_TAG: this.S++, // <strong
|
|
391
|
-
OPEN_TAG_SLASH: this.S++, // <strong /
|
|
392
|
-
ATTRIB: this.S++, // <a
|
|
393
|
-
ATTRIB_NAME: this.S++, // <a foo
|
|
394
|
-
ATTRIB_NAME_SAW_WHITE: this.S++, // <a foo _
|
|
395
|
-
ATTRIB_VALUE: this.S++, // <a foo=
|
|
396
|
-
ATTRIB_VALUE_QUOTED: this.S++, // <a foo="bar
|
|
397
|
-
ATTRIB_VALUE_CLOSED: this.S++, // <a foo="bar"
|
|
398
|
-
ATTRIB_VALUE_UNQUOTED: this.S++, // <a foo=bar
|
|
399
|
-
ATTRIB_VALUE_ENTITY_Q: this.S++, // <foo bar="""
|
|
400
|
-
ATTRIB_VALUE_ENTITY_U: this.S++, // <foo bar="
|
|
401
|
-
CLOSE_TAG: this.S++, // </a
|
|
402
|
-
CLOSE_TAG_SAW_WHITE: this.S++, // </a >
|
|
403
|
-
SCRIPT: this.S++, // <script> ...
|
|
404
|
-
SCRIPT_ENDING: this.S++ // <script> ... <
|
|
405
|
-
};
|
|
406
|
-
this.BUFFERS = BUFFERS;
|
|
407
|
-
// private parser: (strict: boolean, opt: any) => SAXParser;
|
|
408
|
-
this.CDATA = '[CDATA[';
|
|
409
|
-
this.DOCTYPE = 'DOCTYPE';
|
|
410
|
-
this.XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
411
|
-
this.XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/';
|
|
412
|
-
this.rootNS = {
|
|
413
|
-
xml: this.XML_NAMESPACE,
|
|
414
|
-
xmlns: this.XMLNS_NAMESPACE
|
|
415
|
-
};
|
|
416
|
-
this.textNode = '';
|
|
417
|
-
this.entity = '';
|
|
418
|
-
this.cdata = '';
|
|
419
|
-
this.script = '';
|
|
420
|
-
this.startTagPosition = 0;
|
|
421
436
|
this.S = 0;
|
|
422
437
|
for (const s in this.STATE) {
|
|
423
438
|
if (this.STATE.hasOwnProperty(s)) {
|
|
@@ -1389,10 +1404,11 @@ class SAX {
|
|
|
1389
1404
|
* @todo Weird inheritance, with some variables initialized in subclass
|
|
1390
1405
|
*/
|
|
1391
1406
|
export class SAXParser extends SAX {
|
|
1407
|
+
static ENTITIES = ENTITIES;
|
|
1408
|
+
opt = DEFAULT_SAX_PARSER_OPTIONS;
|
|
1409
|
+
events = DEFAULT_SAX_EVENTS;
|
|
1392
1410
|
constructor(opt) {
|
|
1393
1411
|
super();
|
|
1394
|
-
this.opt = DEFAULT_SAX_PARSER_OPTIONS;
|
|
1395
|
-
this.events = DEFAULT_SAX_EVENTS;
|
|
1396
1412
|
this.clearBuffers();
|
|
1397
1413
|
this.opt = opt = { ...this.opt, ...opt };
|
|
1398
1414
|
this.events = { ...this.events, ...opt };
|
|
@@ -1435,4 +1451,3 @@ export class SAXParser extends SAX {
|
|
|
1435
1451
|
this.flushBuffers();
|
|
1436
1452
|
}
|
|
1437
1453
|
}
|
|
1438
|
-
SAXParser.ENTITIES = ENTITIES;
|
package/dist/xml-loader.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { parseXMLSync } from "./lib/parsers/parse-xml.js";
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "4.2.0-alpha.
|
|
7
|
+
const VERSION = typeof "4.2.0-alpha.5" !== 'undefined' ? "4.2.0-alpha.5" : 'latest';
|
|
8
8
|
/**
|
|
9
9
|
* Loader for XML files
|
|
10
10
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/xml",
|
|
3
|
-
"version": "4.2.0-alpha.
|
|
3
|
+
"version": "4.2.0-alpha.6",
|
|
4
4
|
"description": "Framework-independent loaders for the XML (eXtensible Markup Language) format",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"build-bundle-dev": "ocular-bundle ./bundle.ts --env=dev --output=dist/dist.dev.js"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@loaders.gl/loader-utils": "4.2.0-alpha.
|
|
45
|
-
"@loaders.gl/schema": "4.2.0-alpha.
|
|
44
|
+
"@loaders.gl/loader-utils": "4.2.0-alpha.6",
|
|
45
|
+
"@loaders.gl/schema": "4.2.0-alpha.6",
|
|
46
46
|
"fast-xml-parser": "^4.2.5"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@loaders.gl/core": "^4.0.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "37bd8ca71763529f18727ee4bf29dd176aa914ca"
|
|
52
52
|
}
|