Skip to content

Cannot iterate children at proper order #21

@eliseevmikhail

Description

@eliseevmikhail

Nodes order is important sometimes. I think, it is need to add _children array for proper order iterating, something like this:

--- xmlToJSON.js-orig   2016-05-05 13:37:23.096356807 +0700
+++ xmlToJSON.js        2016-05-05 17:39:14.599282243 +0700
@@ -156,7 +156,9 @@
                     }

                     vContent = xmlToJSON.parseXML(oNode);
-
+                    if(!vResult['_children']) vResult._children=[];
+                    vResult._children.push(vContent);
+                    vContent._tagname = sProp;
                     if (vResult.hasOwnProperty(sProp)) {
                         if (vResult[sProp].constructor !== Array) {
                             vResult[sProp] = [vResult[sProp]];

PS Sorry for my english

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions