From e6968382ea293b909039db827da24e73cf54d3c6 Mon Sep 17 00:00:00 2001
From: baigner <benedikt.aigner@rwth-aachen.de>
Date: Tue, 17 Apr 2018 14:14:03 +0200
Subject: [PATCH] New data structure try 4: Interpretation of new tree data in
 the html file almost finished!

Former-commit-id: 22199a213eee5ad0364a154a5d281b2eb97bde14
---
 kadmos/vistoms/templates/VISTOMS.html | 42 ++++++++++++++++-----------
 1 file changed, 25 insertions(+), 17 deletions(-)

diff --git a/kadmos/vistoms/templates/VISTOMS.html b/kadmos/vistoms/templates/VISTOMS.html
index 5f6b4c8b1..36849b1df 100644
--- a/kadmos/vistoms/templates/VISTOMS.html
+++ b/kadmos/vistoms/templates/VISTOMS.html
@@ -21504,17 +21504,17 @@
                     }
                     
                     
-                    function appendChildren(aParent, xPath_list)
+                    function appendChildren(anElement, aParent, xPath_list)
                     {
-                        if (xPath_list.length > 1)
+                        if (xPath_list.length > 0)
                         {
                             //If element has no children yet, initialize children array
                             if (!aParent.children){aParent.children = [];}
                             //remove the first element from the xPath list
                             let newXPath_list = JSON.parse(JSON.stringify(xPath_list));
                             newXPath_list.shift();
-                            console.log(xPath_list)
-                            console.log(newXPath_list)
+                            <!-- console.log(xPath_list) -->
+                            <!-- console.log(newXPath_list) -->
                             //Create a new child element, if it does not exist yet
                             if (!childExists(xPath_list[0], aParent.children))
                             {
@@ -21524,11 +21524,19 @@
                             }
                             aParent.children.forEach(function(aChild)
                             {
-                                <!-- console.log("Children will be appended for: " + aChild.name) -->
-                                <!-- console.log(newXPath_list) -->
-                                appendChildren(aChild, newXPath_list)
+                                if (xPath_list[0] == aChild.name)
+                                {
+                                    <!-- console.log("Children will be appended for: " + aChild.name) -->
+                                    <!-- console.log(newXPath_list) -->
+                                    <!-- console.log(anElement.xpath) -->
+                                    appendChildren(anElement, aChild, newXPath_list)
+                                }
                             })
-                        }                        
+                        }
+                        else
+                        {
+                            aParent.value = anElement.value;
+                        }
                     }
                     
                     var newTree = {};
@@ -21541,17 +21549,17 @@
                             if (index > -1) {xPath_split.splice(index, 1);}
                             root.level = 0
                             root.name = xPath_split[0]
-                            console.log("####################")
-                            console.log(element.xpath)
-                            appendChildren(root, xPath_split)
+                            <!-- console.log("####################") -->
+                            <!-- console.log(element.xpath) -->
+                            let newXPath_split = JSON.parse(JSON.stringify(xPath_split));
+                            newXPath_split.shift();
+                            appendChildren(element, root, newXPath_split)
+                            <!-- console.log("DONE!") -->
+                            <!-- console.log("####################") -->
                         })
                     }
-                    buildTree(newTree, treeData)
-                    
-                    console.log(newTree)
-                    
-                    return
-                    console.log("I passed the return!!!")
+                    buildTree(newTree, treeData)                    
+                    treeData = newTree
                     //######################################################################
                     //aigner:New implementation end
                     
-- 
GitLab