Skip to content

Commit b6be419

Browse files
committed
Update package and browser bundle
1 parent 30e91c7 commit b6be419

File tree

3 files changed

+28
-12
lines changed

3 files changed

+28
-12
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
3.10.0 / 2018-05-13
2+
* Added support of cyrillic characters in parsing XML to JSON
3+
3.9.11 / 2018-05-09
4+
* fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/80 fix nimn chars
5+
* update package information
6+
* fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/86: json 2 xml parser : property with null value should be parsed to self closing tag.
7+
* update online demo
8+
* revert zombiejs to old version to support old version of node
9+
* update dependencies
110
3.3.10 / 2018-04-23
211
* fix #77 : parse even if closing tag has space before '>'
312
* include all css & js lib in demo app

lib/parser.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -331,16 +331,19 @@ var char = function(a) {
331331
};
332332

333333
var chars = {
334-
nilChar: char(254),
335-
missingChar: char(200),
336-
nilPremitive: char(176),
337-
missingPremitive: char(201),
338-
emptyChar: char(177),
339-
emptyValue: char(178),
340-
boundryChar: char(186),
341-
arrayEnd: char(197),
334+
nilChar : char(176),
335+
missingChar : char(201),
336+
nilPremitive : char(175),
337+
missingPremitive : char(200),
338+
339+
emptyChar : char(178),
340+
emptyValue: char(177),//empty Premitive
341+
342+
boundryChar : char(179),
343+
342344
objStart: char(198),
343-
arrStart: char(199)
345+
arrStart: char(204),
346+
arrayEnd: char(185),
344347
};
345348

346349
var charsArr = [
@@ -350,6 +353,7 @@ var charsArr = [
350353
chars.missingPremitive,
351354
chars.boundryChar,
352355
chars.emptyChar,
356+
chars.emptyValue,
353357
chars.arrayEnd,
354358
chars.objStart,
355359
chars.arrStart
@@ -865,6 +869,7 @@ var util = require("./util");
865869
var buildOptions = require("./util").buildOptions;
866870
var xmlNode = require("./xmlNode");
867871
var TagType = {"OPENING": 1, "CLOSING": 2, "SELF": 3, "CDATA": 4};
872+
var regx = "<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|(([\\w:\\-._]*:)?([\\w:\\-._]+))([^>]*)>|((\\/)(([\\w:\\-._]*:)?([\\w:\\-._]+))\\s*>))([^<]*)";
868873

869874
//var tagsRegx = new RegExp("<(\\/?[\\w:\\-\._]+)([^>]*)>(\\s*"+cdataRegx+")*([^<]+)?","g");
870875
//var tagsRegx = new RegExp("<(\\/?)((\\w*:)?([\\w:\\-\._]+))([^>]*)>([^<]*)("+cdataRegx+"([^<]*))*([^<]+)?","g");
@@ -885,14 +890,15 @@ var defaultOptions = {
885890
trimValues: true, //Trim string values of tag and attributes
886891
cdataTagName: false,
887892
cdataPositionChar: "\\c",
893+
localeRange: "",
888894
tagValueProcessor: function(a) {return a},
889895
attrValueProcessor: function(a) {return a}
890896
//decodeStrict: false,
891897
};
892898

893899
exports.defaultOptions = defaultOptions;
894900

895-
var props = ["attributeNamePrefix", "attrNodeName", "textNodeName", "ignoreAttributes", "ignoreNameSpace", "allowBooleanAttributes", "parseNodeValue", "parseAttributeValue", "arrayMode", "trimValues", "cdataTagName", "cdataPositionChar", "tagValueProcessor", "attrValueProcessor"];
901+
var props = ["attributeNamePrefix", "attrNodeName", "textNodeName", "ignoreAttributes", "ignoreNameSpace", "allowBooleanAttributes", "parseNodeValue", "parseAttributeValue", "arrayMode", "trimValues", "cdataTagName", "cdataPositionChar", "localeRange", "tagValueProcessor", "attrValueProcessor"];
896902
exports.props = props;
897903

898904
var getTraversalObj = function(xmlData, options) {
@@ -903,7 +909,8 @@ var getTraversalObj = function(xmlData, options) {
903909
var xmlObj = new xmlNode("!xml");
904910
var currentNode = xmlObj;
905911

906-
var tagsRegx = /<((!\[CDATA\[([\s\S]*?)(]]>))|(([\w:\-._]*:)?([\w:\-._]+))([^>]*)>|((\/)(([\w:\-._]*:)?([\w:\-._]+))\s*>))([^<]*)/g;
912+
regx = regx.replace(/\[\\w/g, "[" + options.localeRange + "\\w");
913+
var tagsRegx = new RegExp(regx, "g");
907914
var tag = tagsRegx.exec(xmlData);
908915
var nextTag = tagsRegx.exec(xmlData);
909916
while (tag) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fast-xml-parser",
3-
"version": "3.9.11",
3+
"version": "3.10.0",
44
"description": "Validate XML or Parse XML to JS/JSON very fast without C/C++ based libraries",
55
"main": "./src/parser.js",
66
"scripts": {

0 commit comments

Comments
 (0)