fast-xml-parser 4.0.14 → 4.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  Note: If you find missing information about particular minor version, that version must have been changed without any functional change in this library.
2
2
 
3
+ **4.1.0 / 2023-02-02**
4
+ * Fix '<' or '>' in DTD comment throwing an error. (#533) (By [Adam Baker](https://github.com/Cwazywierdo))
5
+ * Set "eNotation" to 'true' as default
6
+
7
+ **4.0.15 / 2023-01-25**
8
+ * make "eNotation" optional
9
+
3
10
  **4.0.14 / 2023-01-22**
4
11
  * fixed: add missed typing "eNotation" to parse values
5
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fast-xml-parser",
3
- "version": "4.0.14",
3
+ "version": "4.1.0",
4
4
  "description": "Validate XML, Parse XML, Build XML without C/C++ based libraries",
5
5
  "main": "./src/fxp.js",
6
6
  "scripts": {
package/src/fxp.d.ts CHANGED
@@ -37,7 +37,7 @@ type strnumOptions = {
37
37
  hex: boolean;
38
38
  leadingZeros: boolean,
39
39
  skipLike?: RegExp,
40
- eNotation: boolean
40
+ eNotation?: boolean
41
41
  }
42
42
  type X2jOptionsOptional = Partial<X2jOptions>;
43
43
  type validationOptions = {
@@ -14,7 +14,7 @@ function readDocType(xmlData, i){
14
14
  let hasBody = false, entity = false, comment = false;
15
15
  let exp = "";
16
16
  for(;i<xmlData.length;i++){
17
- if (xmlData[i] === '<') {
17
+ if (xmlData[i] === '<' && !comment) {
18
18
  if( hasBody &&
19
19
  xmlData[i+1] === '!' &&
20
20
  xmlData[i+2] === 'E' &&
@@ -78,14 +78,15 @@ function readDocType(xmlData, i){
78
78
  if(comment){
79
79
  if( xmlData[i - 1] === "-" && xmlData[i - 2] === "-"){
80
80
  comment = false;
81
- }else{
82
- throw new Error(`Invalid XML comment in DOCTYPE`);
81
+ angleBracketsCount--;
83
82
  }
84
- }else if(entity){
85
- parseEntityExp(exp, entities);
86
- entity = false;
83
+ }else{
84
+ if(entity) {
85
+ parseEntityExp(exp, entities);
86
+ entity = false;
87
+ }
88
+ angleBracketsCount--;
87
89
  }
88
- angleBracketsCount--;
89
90
  if (angleBracketsCount === 0) {
90
91
  break;
91
92
  }
@@ -14,7 +14,8 @@ const defaultOptions = {
14
14
  cdataPropName: false,
15
15
  numberParseOptions: {
16
16
  hex: true,
17
- leadingZeros: true
17
+ leadingZeros: true,
18
+ eNotation: true
18
19
  },
19
20
  tagValueProcessor: function(tagName, val) {
20
21
  return val;