@rgrove/parse-xml 2.0.4 → 4.0.0

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.
Files changed (73) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +84 -337
  3. package/dist/browser.js +774 -0
  4. package/dist/browser.js.map +7 -0
  5. package/dist/global.min.js +10 -0
  6. package/dist/global.min.js.map +7 -0
  7. package/dist/index.d.ts +24 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +50 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/lib/Parser.d.ts +218 -0
  12. package/dist/lib/Parser.d.ts.map +1 -0
  13. package/dist/lib/Parser.js +638 -0
  14. package/dist/lib/Parser.js.map +1 -0
  15. package/dist/lib/StringScanner.d.ts +97 -0
  16. package/dist/lib/StringScanner.d.ts.map +1 -0
  17. package/dist/lib/StringScanner.js +210 -0
  18. package/dist/lib/StringScanner.js.map +1 -0
  19. package/dist/lib/XmlCdata.d.ts +8 -0
  20. package/dist/lib/XmlCdata.d.ts.map +1 -0
  21. package/dist/lib/XmlCdata.js +15 -0
  22. package/dist/lib/XmlCdata.js.map +1 -0
  23. package/dist/lib/XmlComment.d.ts +16 -0
  24. package/dist/lib/XmlComment.d.ts.map +1 -0
  25. package/dist/lib/XmlComment.js +23 -0
  26. package/dist/lib/XmlComment.js.map +1 -0
  27. package/dist/lib/XmlDocument.d.ts +29 -0
  28. package/dist/lib/XmlDocument.d.ts.map +1 -0
  29. package/dist/lib/XmlDocument.js +47 -0
  30. package/dist/lib/XmlDocument.js.map +1 -0
  31. package/dist/lib/XmlElement.d.ts +40 -0
  32. package/dist/lib/XmlElement.d.ts.map +1 -0
  33. package/dist/lib/XmlElement.js +51 -0
  34. package/dist/lib/XmlElement.js.map +1 -0
  35. package/dist/lib/XmlNode.d.ts +74 -0
  36. package/dist/lib/XmlNode.d.ts.map +1 -0
  37. package/dist/lib/XmlNode.js +96 -0
  38. package/dist/lib/XmlNode.js.map +1 -0
  39. package/dist/lib/XmlProcessingInstruction.d.ts +22 -0
  40. package/dist/lib/XmlProcessingInstruction.d.ts.map +1 -0
  41. package/dist/lib/XmlProcessingInstruction.js +25 -0
  42. package/dist/lib/XmlProcessingInstruction.js.map +1 -0
  43. package/dist/lib/XmlText.d.ts +16 -0
  44. package/dist/lib/XmlText.d.ts.map +1 -0
  45. package/dist/lib/XmlText.js +23 -0
  46. package/dist/lib/XmlText.js.map +1 -0
  47. package/dist/lib/syntax.d.ts +69 -0
  48. package/dist/lib/syntax.d.ts.map +1 -0
  49. package/dist/lib/syntax.js +133 -0
  50. package/dist/lib/syntax.js.map +1 -0
  51. package/dist/lib/types.d.ts +5 -0
  52. package/dist/lib/types.d.ts.map +1 -0
  53. package/dist/lib/types.js +3 -0
  54. package/dist/lib/types.js.map +1 -0
  55. package/package.json +36 -22
  56. package/src/index.ts +30 -0
  57. package/src/lib/Parser.ts +819 -0
  58. package/src/lib/StringScanner.ts +254 -0
  59. package/src/lib/XmlCdata.ts +11 -0
  60. package/src/lib/XmlComment.ts +26 -0
  61. package/src/lib/XmlDocument.ts +57 -0
  62. package/src/lib/XmlElement.ts +81 -0
  63. package/src/lib/XmlNode.ts +107 -0
  64. package/src/lib/XmlProcessingInstruction.ts +35 -0
  65. package/src/lib/XmlText.ts +26 -0
  66. package/src/lib/syntax.ts +136 -0
  67. package/src/lib/types.ts +2 -0
  68. package/CHANGELOG.md +0 -89
  69. package/dist/commonjs/index.js +0 -434
  70. package/dist/commonjs/lib/syntax.js +0 -262
  71. package/dist/umd/parse-xml.min.js +0 -1
  72. package/src/index.js +0 -451
  73. package/src/lib/syntax.js +0 -263
@@ -0,0 +1,97 @@
1
+ /** @private */
2
+ export declare class StringScanner {
3
+ charIndex: number;
4
+ readonly string: string;
5
+ private readonly charCount;
6
+ private readonly charsToBytes;
7
+ private readonly length;
8
+ private readonly multiByteMode;
9
+ constructor(string: string);
10
+ /**
11
+ * Whether the current character index is at the end of the input string.
12
+ */
13
+ get isEnd(): boolean;
14
+ /**
15
+ * Returns the byte index of the given character index in the string. The two
16
+ * may differ in strings that contain multibyte characters.
17
+ */
18
+ protected charIndexToByteIndex(charIndex?: number): number;
19
+ /**
20
+ * Returns the number of characters in the given string, which may differ from
21
+ * the byte length if the string contains multibyte characters.
22
+ */
23
+ protected charLength(string: string, multiByteSafe?: boolean): number;
24
+ /**
25
+ * Advances the scanner by the given number of characters, stopping if the end
26
+ * of the string is reached.
27
+ */
28
+ advance(count?: number): void;
29
+ /**
30
+ * Consumes and returns the given number of characters if possible, advancing
31
+ * the scanner and stopping if the end of the string is reached.
32
+ *
33
+ * If no characters could be consumed, an empty string will be returned.
34
+ */
35
+ consume(count?: number): string;
36
+ /**
37
+ * Consumes a match for the given sticky regex, advances the scanner, updates
38
+ * the `lastIndex` property of the regex, and returns the matching string.
39
+ *
40
+ * The regex must have a sticky flag ("y") so that its `lastIndex` prop can be
41
+ * used to anchor the match at the current scanner position.
42
+ *
43
+ * Returns the consumed string, or an empty string if nothing was consumed.
44
+ */
45
+ consumeMatch(regex: RegExp): string;
46
+ /**
47
+ * Consumes and returns all characters for which the given function returns a
48
+ * truthy value, stopping on the first falsy return value or if the end of the
49
+ * input is reached.
50
+ */
51
+ consumeMatchFn(fn: (char: string) => boolean): string;
52
+ /**
53
+ * Consumes the given string if it exists at the current character index, and
54
+ * advances the scanner.
55
+ *
56
+ * If the given string doesn't exist at the current character index, an empty
57
+ * string will be returned and the scanner will not be advanced.
58
+ */
59
+ consumeString(stringToConsume: string): string;
60
+ /**
61
+ * Does the same thing as `consumeString()`, but doesn't support consuming
62
+ * multibyte characters. This can be faster if you only need to match single
63
+ * byte characters.
64
+ */
65
+ consumeStringFast(stringToConsume: string): string;
66
+ /**
67
+ * Consumes characters until the given global regex is matched, advancing the
68
+ * scanner up to (but not beyond) the beginning of the match. If the regex
69
+ * doesn't match, nothing will be consumed.
70
+ *
71
+ * Returns the consumed string, or an empty string if nothing was consumed.
72
+ */
73
+ consumeUntilMatch(regex: RegExp): string;
74
+ /**
75
+ * Consumes characters until the given string is found, advancing the scanner
76
+ * up to (but not beyond) that point. If the string is never found, nothing
77
+ * will be consumed.
78
+ *
79
+ * Returns the consumed string, or an empty string if nothing was consumed.
80
+ */
81
+ consumeUntilString(searchString: string): string;
82
+ /**
83
+ * Returns the given number of characters starting at the current character
84
+ * index, without advancing the scanner and without exceeding the end of the
85
+ * input string.
86
+ */
87
+ peek(count?: number): string;
88
+ /**
89
+ * Resets the scanner position to the given character _index_, or to the start
90
+ * of the input string if no index is given.
91
+ *
92
+ * If _index_ is negative, the scanner position will be moved backward by that
93
+ * many characters, stopping if the beginning of the string is reached.
94
+ */
95
+ reset(index?: number): void;
96
+ }
97
+ //# sourceMappingURL=StringScanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StringScanner.d.ts","sourceRoot":"","sources":["../../src/lib/StringScanner.ts"],"names":[],"mappings":"AAGA,eAAe;AACf,qBAAa,aAAa;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAuB;IACpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAU;gBAE5B,MAAM,EAAE,MAAM;IAsB1B;;OAEG;IACH,IAAI,KAAK,YAER;IAID;;;OAGG;IACH,SAAS,CAAC,oBAAoB,CAAC,SAAS,GAAE,MAAuB,GAAG,MAAM;IAM1E;;;OAGG;IACH,SAAS,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,UAAqB,GAAG,MAAM;IAWhF;;;OAGG;IACH,OAAO,CAAC,KAAK,SAAI;IAIjB;;;;;OAKG;IACH,OAAO,CAAC,KAAK,SAAI,GAAG,MAAM;IAM1B;;;;;;;;OAQG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAkBnC;;;;OAIG;IACH,cAAc,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM;IAYrD;;;;;;OAMG;IACH,aAAa,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM;IAoB9C;;;;OAIG;IACH,iBAAiB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM;IAWlD;;;;;;OAMG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAaxC;;;;;;OAMG;IACH,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAchD;;;;OAIG;IACH,IAAI,CAAC,KAAK,SAAI,GAAG,MAAM;IAmBvB;;;;;;OAMG;IACH,KAAK,CAAC,KAAK,SAAI;CAKhB"}
@@ -0,0 +1,210 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StringScanner = void 0;
4
+ const emptyString = '';
5
+ const surrogatePair = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
6
+ /** @private */
7
+ class StringScanner {
8
+ constructor(string) {
9
+ this.charCount = this.charLength(string, true);
10
+ this.charIndex = 0;
11
+ this.length = string.length;
12
+ this.multiByteMode = this.charCount !== this.length;
13
+ this.string = string;
14
+ if (this.multiByteMode) {
15
+ let charsToBytes = [];
16
+ // Create a mapping of character indexes to byte indexes. Since the string
17
+ // contains multibyte characters, a byte index may not necessarily align
18
+ // with a character index.
19
+ for (let byteIndex = 0, charIndex = 0; charIndex < this.charCount; ++charIndex) {
20
+ charsToBytes[charIndex] = byteIndex;
21
+ byteIndex += string.codePointAt(byteIndex) > 65535 ? 2 : 1;
22
+ }
23
+ this.charsToBytes = charsToBytes;
24
+ }
25
+ }
26
+ /**
27
+ * Whether the current character index is at the end of the input string.
28
+ */
29
+ get isEnd() {
30
+ return this.charIndex >= this.charCount;
31
+ }
32
+ // -- Protected Methods ------------------------------------------------------
33
+ /**
34
+ * Returns the byte index of the given character index in the string. The two
35
+ * may differ in strings that contain multibyte characters.
36
+ */
37
+ charIndexToByteIndex(charIndex = this.charIndex) {
38
+ return this.multiByteMode
39
+ ? this.charsToBytes[charIndex] ?? Infinity
40
+ : charIndex;
41
+ }
42
+ /**
43
+ * Returns the number of characters in the given string, which may differ from
44
+ * the byte length if the string contains multibyte characters.
45
+ */
46
+ charLength(string, multiByteSafe = this.multiByteMode) {
47
+ // We could get the char length with `[ ...string ].length`, but that's
48
+ // actually slower than replacing surrogate pairs with single-byte
49
+ // characters and then counting the result.
50
+ return multiByteSafe
51
+ ? string.replace(surrogatePair, '_').length
52
+ : string.length;
53
+ }
54
+ // -- Public Methods ---------------------------------------------------------
55
+ /**
56
+ * Advances the scanner by the given number of characters, stopping if the end
57
+ * of the string is reached.
58
+ */
59
+ advance(count = 1) {
60
+ this.charIndex = Math.min(this.charCount, this.charIndex + count);
61
+ }
62
+ /**
63
+ * Consumes and returns the given number of characters if possible, advancing
64
+ * the scanner and stopping if the end of the string is reached.
65
+ *
66
+ * If no characters could be consumed, an empty string will be returned.
67
+ */
68
+ consume(count = 1) {
69
+ let chars = this.peek(count);
70
+ this.advance(count);
71
+ return chars;
72
+ }
73
+ /**
74
+ * Consumes a match for the given sticky regex, advances the scanner, updates
75
+ * the `lastIndex` property of the regex, and returns the matching string.
76
+ *
77
+ * The regex must have a sticky flag ("y") so that its `lastIndex` prop can be
78
+ * used to anchor the match at the current scanner position.
79
+ *
80
+ * Returns the consumed string, or an empty string if nothing was consumed.
81
+ */
82
+ consumeMatch(regex) {
83
+ if (!regex.sticky) {
84
+ throw new Error('`regex` must have a sticky flag ("y")');
85
+ }
86
+ regex.lastIndex = this.charIndexToByteIndex();
87
+ let result = regex.exec(this.string);
88
+ if (result === null || result.length === 0) {
89
+ return emptyString;
90
+ }
91
+ let match = result[0];
92
+ this.advance(this.charLength(match));
93
+ return match;
94
+ }
95
+ /**
96
+ * Consumes and returns all characters for which the given function returns a
97
+ * truthy value, stopping on the first falsy return value or if the end of the
98
+ * input is reached.
99
+ */
100
+ consumeMatchFn(fn) {
101
+ let char;
102
+ let match = emptyString;
103
+ while ((char = this.peek()) && fn(char)) {
104
+ match += char;
105
+ this.advance();
106
+ }
107
+ return match;
108
+ }
109
+ /**
110
+ * Consumes the given string if it exists at the current character index, and
111
+ * advances the scanner.
112
+ *
113
+ * If the given string doesn't exist at the current character index, an empty
114
+ * string will be returned and the scanner will not be advanced.
115
+ */
116
+ consumeString(stringToConsume) {
117
+ if (this.consumeStringFast(stringToConsume)) {
118
+ return stringToConsume;
119
+ }
120
+ if (this.multiByteMode) {
121
+ let { length } = stringToConsume;
122
+ let charLengthToMatch = this.charLength(stringToConsume);
123
+ if (charLengthToMatch !== length
124
+ && stringToConsume === this.peek(charLengthToMatch)) {
125
+ this.advance(charLengthToMatch);
126
+ return stringToConsume;
127
+ }
128
+ }
129
+ return emptyString;
130
+ }
131
+ /**
132
+ * Does the same thing as `consumeString()`, but doesn't support consuming
133
+ * multibyte characters. This can be faster if you only need to match single
134
+ * byte characters.
135
+ */
136
+ consumeStringFast(stringToConsume) {
137
+ let { length } = stringToConsume;
138
+ if (this.peek(length) === stringToConsume) {
139
+ this.advance(length);
140
+ return stringToConsume;
141
+ }
142
+ return emptyString;
143
+ }
144
+ /**
145
+ * Consumes characters until the given global regex is matched, advancing the
146
+ * scanner up to (but not beyond) the beginning of the match. If the regex
147
+ * doesn't match, nothing will be consumed.
148
+ *
149
+ * Returns the consumed string, or an empty string if nothing was consumed.
150
+ */
151
+ consumeUntilMatch(regex) {
152
+ let restOfString = this.string.slice(this.charIndexToByteIndex());
153
+ let matchByteIndex = restOfString.search(regex);
154
+ if (matchByteIndex <= 0) {
155
+ return emptyString;
156
+ }
157
+ let result = restOfString.slice(0, matchByteIndex);
158
+ this.advance(this.charLength(result));
159
+ return result;
160
+ }
161
+ /**
162
+ * Consumes characters until the given string is found, advancing the scanner
163
+ * up to (but not beyond) that point. If the string is never found, nothing
164
+ * will be consumed.
165
+ *
166
+ * Returns the consumed string, or an empty string if nothing was consumed.
167
+ */
168
+ consumeUntilString(searchString) {
169
+ let { string } = this;
170
+ let byteIndex = this.charIndexToByteIndex();
171
+ let matchByteIndex = string.indexOf(searchString, byteIndex);
172
+ if (matchByteIndex <= 0) {
173
+ return emptyString;
174
+ }
175
+ let result = string.slice(byteIndex, matchByteIndex);
176
+ this.advance(this.charLength(result));
177
+ return result;
178
+ }
179
+ /**
180
+ * Returns the given number of characters starting at the current character
181
+ * index, without advancing the scanner and without exceeding the end of the
182
+ * input string.
183
+ */
184
+ peek(count = 1) {
185
+ let { charIndex, multiByteMode, string } = this;
186
+ if (multiByteMode) {
187
+ // Inlining this comparison instead of checking `this.isEnd` improves perf
188
+ // slightly since `peek()` is called so frequently.
189
+ if (charIndex >= this.charCount) {
190
+ return emptyString;
191
+ }
192
+ return string.slice(this.charIndexToByteIndex(charIndex), this.charIndexToByteIndex(charIndex + count));
193
+ }
194
+ return string.slice(charIndex, charIndex + count);
195
+ }
196
+ /**
197
+ * Resets the scanner position to the given character _index_, or to the start
198
+ * of the input string if no index is given.
199
+ *
200
+ * If _index_ is negative, the scanner position will be moved backward by that
201
+ * many characters, stopping if the beginning of the string is reached.
202
+ */
203
+ reset(index = 0) {
204
+ this.charIndex = index >= 0
205
+ ? Math.min(this.charCount, index)
206
+ : Math.max(0, this.charIndex + index);
207
+ }
208
+ }
209
+ exports.StringScanner = StringScanner;
210
+ //# sourceMappingURL=StringScanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StringScanner.js","sourceRoot":"","sources":["../../src/lib/StringScanner.ts"],"names":[],"mappings":";;;AAAA,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,aAAa,GAAG,iCAAiC,CAAC;AAExD,eAAe;AACf,MAAa,aAAa;IASxB,YAAY,MAAc;QACxB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC/C,I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C,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC;IAC1C,CAAC;CACF;AAzPD,sCAyPC"}
@@ -0,0 +1,8 @@
1
+ import { XmlText } from './XmlText.js';
2
+ /**
3
+ * A CDATA section within an XML document.
4
+ */
5
+ export declare class XmlCdata extends XmlText {
6
+ get type(): string;
7
+ }
8
+ //# sourceMappingURL=XmlCdata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XmlCdata.d.ts","sourceRoot":"","sources":["../../src/lib/XmlCdata.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;GAEG;AACH,qBAAa,QAAS,SAAQ,OAAO;IACnC,IAAa,IAAI,WAEhB;CACF"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.XmlCdata = void 0;
4
+ const XmlNode_js_1 = require("./XmlNode.js");
5
+ const XmlText_js_1 = require("./XmlText.js");
6
+ /**
7
+ * A CDATA section within an XML document.
8
+ */
9
+ class XmlCdata extends XmlText_js_1.XmlText {
10
+ get type() {
11
+ return XmlNode_js_1.XmlNode.TYPE_CDATA;
12
+ }
13
+ }
14
+ exports.XmlCdata = XmlCdata;
15
+ //# sourceMappingURL=XmlCdata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XmlCdata.js","sourceRoot":"","sources":["../../src/lib/XmlCdata.ts"],"names":[],"mappings":";;;AAAA,6CAAuC;AACvC,6CAAuC;AAEvC;;GAEG;AACH,MAAa,QAAS,SAAQ,oBAAO;IACnC,IAAa,IAAI;QACf,OAAO,oBAAO,CAAC,UAAU,CAAC;IAC5B,CAAC;CACF;AAJD,4BAIC"}
@@ -0,0 +1,16 @@
1
+ import { XmlNode } from './XmlNode.js';
2
+ /**
3
+ * A comment within an XML document.
4
+ */
5
+ export declare class XmlComment extends XmlNode {
6
+ /**
7
+ * Content of this comment.
8
+ */
9
+ content: string;
10
+ constructor(content?: string);
11
+ get type(): string;
12
+ toJSON(): import("./types.js").JsonObject & {
13
+ content: string;
14
+ };
15
+ }
16
+ //# sourceMappingURL=XmlComment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XmlComment.d.ts","sourceRoot":"","sources":["../../src/lib/XmlComment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;GAEG;AACH,qBAAa,UAAW,SAAQ,OAAO;IACrC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;gBAEJ,OAAO,SAAK;IAKxB,IAAa,IAAI,WAEhB;IAEQ,MAAM;;;CAKhB"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.XmlComment = void 0;
4
+ const XmlNode_js_1 = require("./XmlNode.js");
5
+ /**
6
+ * A comment within an XML document.
7
+ */
8
+ class XmlComment extends XmlNode_js_1.XmlNode {
9
+ constructor(content = '') {
10
+ super();
11
+ this.content = content;
12
+ }
13
+ get type() {
14
+ return XmlNode_js_1.XmlNode.TYPE_COMMENT;
15
+ }
16
+ toJSON() {
17
+ return Object.assign(XmlNode_js_1.XmlNode.prototype.toJSON.call(this), {
18
+ content: this.content,
19
+ });
20
+ }
21
+ }
22
+ exports.XmlComment = XmlComment;
23
+ //# sourceMappingURL=XmlComment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XmlComment.js","sourceRoot":"","sources":["../../src/lib/XmlComment.ts"],"names":[],"mappings":";;;AAAA,6CAAuC;AAEvC;;GAEG;AACH,MAAa,UAAW,SAAQ,oBAAO;IAMrC,YAAY,OAAO,GAAG,EAAE;QACtB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,IAAa,IAAI;QACf,OAAO,oBAAO,CAAC,YAAY,CAAC;IAC9B,CAAC;IAEQ,MAAM;QACb,OAAO,MAAM,CAAC,MAAM,CAAC,oBAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACxD,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAC;IACL,CAAC;CACF;AApBD,gCAoBC"}
@@ -0,0 +1,29 @@
1
+ import { XmlElement } from './XmlElement.js';
2
+ import { XmlNode } from './XmlNode.js';
3
+ import type { XmlComment } from './XmlComment.js';
4
+ import type { XmlProcessingInstruction } from './XmlProcessingInstruction.js';
5
+ /**
6
+ * Represents an XML document. All elements within the document are descendants
7
+ * of this node.
8
+ */
9
+ export declare class XmlDocument extends XmlNode {
10
+ /**
11
+ * Child nodes of this document.
12
+ */
13
+ readonly children: Array<XmlComment | XmlProcessingInstruction | XmlElement>;
14
+ constructor(children?: Array<XmlComment | XmlElement | XmlProcessingInstruction>);
15
+ get document(): this;
16
+ /**
17
+ * Root element of this document, or `null` if this document is empty.
18
+ */
19
+ get root(): XmlElement | null;
20
+ /**
21
+ * Text content of this document and all its descendants.
22
+ */
23
+ get text(): string;
24
+ get type(): string;
25
+ toJSON(): import("./types.js").JsonObject & {
26
+ children: import("./types.js").JsonObject[];
27
+ };
28
+ }
29
+ //# sourceMappingURL=XmlDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XmlDocument.d.ts","sourceRoot":"","sources":["../../src/lib/XmlDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAE9E;;;GAGG;AACH,qBAAa,WAAY,SAAQ,OAAO;IACtC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,UAAU,GAAG,wBAAwB,GAAG,UAAU,CAAC,CAAC;gBAEjE,QAAQ,GAAE,KAAK,CAAC,UAAU,GAAG,UAAU,GAAG,wBAAwB,CAAM;IAKpF,IAAa,QAAQ,SAEpB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,UAAU,GAAG,IAAI,CAQ5B;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAIjB;IAED,IAAa,IAAI,WAEhB;IAEQ,MAAM;;;CAKhB"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.XmlDocument = void 0;
4
+ const XmlElement_js_1 = require("./XmlElement.js");
5
+ const XmlNode_js_1 = require("./XmlNode.js");
6
+ /**
7
+ * Represents an XML document. All elements within the document are descendants
8
+ * of this node.
9
+ */
10
+ class XmlDocument extends XmlNode_js_1.XmlNode {
11
+ constructor(children = []) {
12
+ super();
13
+ this.children = children;
14
+ }
15
+ get document() {
16
+ return this;
17
+ }
18
+ /**
19
+ * Root element of this document, or `null` if this document is empty.
20
+ */
21
+ get root() {
22
+ for (let child of this.children) {
23
+ if (child instanceof XmlElement_js_1.XmlElement) {
24
+ return child;
25
+ }
26
+ }
27
+ return null;
28
+ }
29
+ /**
30
+ * Text content of this document and all its descendants.
31
+ */
32
+ get text() {
33
+ return this.children
34
+ .map(child => 'text' in child ? child.text : '')
35
+ .join('');
36
+ }
37
+ get type() {
38
+ return XmlNode_js_1.XmlNode.TYPE_DOCUMENT;
39
+ }
40
+ toJSON() {
41
+ return Object.assign(XmlNode_js_1.XmlNode.prototype.toJSON.call(this), {
42
+ children: this.children.map(child => child.toJSON()),
43
+ });
44
+ }
45
+ }
46
+ exports.XmlDocument = XmlDocument;
47
+ //# sourceMappingURL=XmlDocument.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XmlDocument.js","sourceRoot":"","sources":["../../src/lib/XmlDocument.ts"],"names":[],"mappings":";;;AAAA,mDAA6C;AAC7C,6CAAuC;AAKvC;;;GAGG;AACH,MAAa,WAAY,SAAQ,oBAAO;IAMtC,YAAY,WAAsE,EAAE;QAClF,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,IAAa,QAAQ;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACN,KAAK,IAAI,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE;YAC/B,IAAI,KAAK,YAAY,0BAAU,EAAE;gBAC/B,OAAO,KAAK,CAAC;aACd;SACF;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,QAAQ;aACjB,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;aAC/C,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;IAED,IAAa,IAAI;QACf,OAAO,oBAAO,CAAC,aAAa,CAAC;IAC/B,CAAC;IAEQ,MAAM;QACb,OAAO,MAAM,CAAC,MAAM,CAAC,oBAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACxD,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;SACrD,CAAC,CAAC;IACL,CAAC;CACF;AA9CD,kCA8CC"}
@@ -0,0 +1,40 @@
1
+ import { XmlNode } from './XmlNode.js';
2
+ import type { JsonObject } from './types.js';
3
+ import type { XmlCdata } from './XmlCdata.js';
4
+ import type { XmlComment } from './XmlComment.js';
5
+ import type { XmlProcessingInstruction } from './XmlProcessingInstruction.js';
6
+ import type { XmlText } from './XmlText.js';
7
+ /**
8
+ * Element in an XML document.
9
+ */
10
+ export declare class XmlElement extends XmlNode {
11
+ /**
12
+ * Attributes on this element.
13
+ */
14
+ attributes: {
15
+ [attrName: string]: string;
16
+ };
17
+ /**
18
+ * Child nodes of this element.
19
+ */
20
+ children: Array<XmlCdata | XmlComment | XmlElement | XmlProcessingInstruction | XmlText>;
21
+ /**
22
+ * Name of this element.
23
+ */
24
+ name: string;
25
+ constructor(name: string, attributes?: {
26
+ [attrName: string]: string;
27
+ }, children?: Array<XmlCdata | XmlComment | XmlElement | XmlProcessingInstruction | XmlText>);
28
+ /**
29
+ * Whether this element is empty (meaning it has no children).
30
+ */
31
+ get isEmpty(): boolean;
32
+ get preserveWhitespace(): boolean;
33
+ /**
34
+ * Text content of this element and all its descendants.
35
+ */
36
+ get text(): string;
37
+ get type(): string;
38
+ toJSON(): JsonObject;
39
+ }
40
+ //# sourceMappingURL=XmlElement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XmlElement.d.ts","sourceRoot":"","sources":["../../src/lib/XmlElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,qBAAa,UAAW,SAAQ,OAAO;IACrC;;OAEG;IACH,UAAU,EAAE;QAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;KAAC,CAAC;IAEzC;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,wBAAwB,GAAG,OAAO,CAAC,CAAC;IAEzF;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;gBAGX,IAAI,EAAE,MAAM,EACZ,UAAU,GAAE;QAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;KAAuB,EAC9D,QAAQ,GAAE,KAAK,CAAC,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,wBAAwB,GAAG,OAAO,CAAM;IAS/F;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAa,kBAAkB,IAAI,OAAO,CAYzC;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAIjB;IAED,IAAa,IAAI,WAEhB;IAEQ,MAAM,IAAI,UAAU;CAO9B"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.XmlElement = void 0;
4
+ const XmlNode_js_1 = require("./XmlNode.js");
5
+ /**
6
+ * Element in an XML document.
7
+ */
8
+ class XmlElement extends XmlNode_js_1.XmlNode {
9
+ constructor(name, attributes = Object.create(null), children = []) {
10
+ super();
11
+ this.name = name;
12
+ this.attributes = attributes;
13
+ this.children = children;
14
+ }
15
+ /**
16
+ * Whether this element is empty (meaning it has no children).
17
+ */
18
+ get isEmpty() {
19
+ return this.children.length === 0;
20
+ }
21
+ get preserveWhitespace() {
22
+ let node = this; // eslint-disable-line @typescript-eslint/no-this-alias
23
+ while (node instanceof XmlElement) {
24
+ if ('xml:space' in node.attributes) {
25
+ return node.attributes['xml:space'] === 'preserve';
26
+ }
27
+ node = node.parent;
28
+ }
29
+ return false;
30
+ }
31
+ /**
32
+ * Text content of this element and all its descendants.
33
+ */
34
+ get text() {
35
+ return this.children
36
+ .map(child => 'text' in child ? child.text : '')
37
+ .join('');
38
+ }
39
+ get type() {
40
+ return XmlNode_js_1.XmlNode.TYPE_ELEMENT;
41
+ }
42
+ toJSON() {
43
+ return Object.assign(XmlNode_js_1.XmlNode.prototype.toJSON.call(this), {
44
+ name: this.name,
45
+ attributes: this.attributes,
46
+ children: this.children.map(child => child.toJSON()),
47
+ });
48
+ }
49
+ }
50
+ exports.XmlElement = XmlElement;
51
+ //# sourceMappingURL=XmlElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XmlElement.js","sourceRoot":"","sources":["../../src/lib/XmlElement.ts"],"names":[],"mappings":";;;AAAA,6CAAuC;AAQvC;;GAEG;AACH,MAAa,UAAW,SAAQ,oBAAO;IAgBrC,YACE,IAAY,EACZ,aAA2C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAC9D,WAA2F,EAAE;QAE7F,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,IAAa,kBAAkB;QAC7B,IAAI,IAAI,GAAmB,IAAI,CAAC,CAAC,uDAAuD;QAExF,OAAO,IAAI,YAAY,UAAU,EAAE;YACjC,IAAI,WAAW,IAAI,IAAI,CAAC,UAAU,EAAE;gBAClC,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,UAAU,CAAC;aACpD;YAED,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;SACpB;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,QAAQ;aACjB,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;aAC/C,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;IAED,IAAa,IAAI;QACf,OAAO,oBAAO,CAAC,YAAY,CAAC;IAC9B,CAAC;IAEQ,MAAM;QACb,OAAO,MAAM,CAAC,MAAM,CAAC,oBAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACxD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;SACrD,CAAC,CAAC;IACL,CAAC;CACF;AArED,gCAqEC"}
@@ -0,0 +1,74 @@
1
+ import type { JsonObject } from './types.js';
2
+ import type { XmlDocument } from './XmlDocument.js';
3
+ import type { XmlElement } from './XmlElement.js';
4
+ /**
5
+ * Base interface for a node in an XML document.
6
+ */
7
+ export declare class XmlNode {
8
+ /**
9
+ * Type value for an `XmlCdata` node.
10
+ */
11
+ static readonly TYPE_CDATA = "cdata";
12
+ /**
13
+ * Type value for an `XmlComment` node.
14
+ */
15
+ static readonly TYPE_COMMENT = "comment";
16
+ /**
17
+ * Type value for an `XmlDocument` node.
18
+ */
19
+ static readonly TYPE_DOCUMENT = "document";
20
+ /**
21
+ * Type value for an `XmlElement` node.
22
+ */
23
+ static readonly TYPE_ELEMENT = "element";
24
+ /**
25
+ * Type value for an `XmlProcessingInstruction` node.
26
+ */
27
+ static readonly TYPE_PROCESSING_INSTRUCTION = "pi";
28
+ /**
29
+ * Type value for an `XmlText` node.
30
+ */
31
+ static readonly TYPE_TEXT = "text";
32
+ /**
33
+ * Parent node of this node, or `null` if this node has no parent.
34
+ */
35
+ parent: XmlDocument | XmlElement | null;
36
+ /**
37
+ * Document that contains this node, or `null` if this node is not associated
38
+ * with a document.
39
+ */
40
+ get document(): XmlDocument | null;
41
+ /**
42
+ * Whether this node is the root node of the document.
43
+ */
44
+ get isRootNode(): boolean;
45
+ /**
46
+ * Whether whitespace should be preserved in the content of this element and
47
+ * its children.
48
+ *
49
+ * This is influenced by the value of the special `xml:space` attribute, and
50
+ * will be `true` for any node whose `xml:space` attribute is set to
51
+ * "preserve". If a node has no such attribute, it will inherit the value of
52
+ * the nearest ancestor that does (if any).
53
+ *
54
+ * @see https://www.w3.org/TR/2008/REC-xml-20081126/#sec-white-space
55
+ */
56
+ get preserveWhitespace(): boolean;
57
+ /**
58
+ * Type of this node.
59
+ *
60
+ * The value of this property is a string that matches one of the static
61
+ * `TYPE_*` properties on the `XmlNode` class (e.g. `TYPE_ELEMENT`,
62
+ * `TYPE_TEXT`, etc.).
63
+ *
64
+ * The `XmlNode` class itself is a base class and doesn't have its own type
65
+ * name.
66
+ */
67
+ get type(): string;
68
+ /**
69
+ * Returns a JSON-serializable object representing this node, minus properties
70
+ * that could result in circular references.
71
+ */
72
+ toJSON(): JsonObject;
73
+ }
74
+ //# sourceMappingURL=XmlNode.d.ts.map