Skip to content
Snippets Groups Projects
Commit e6968382 authored by baigner's avatar baigner
Browse files

New data structure try 4: Interpretation of new tree data in the html file almost finished!

Former-commit-id: 22199a213eee5ad0364a154a5d281b2eb97bde14
parent 4fe9a2ca
No related branches found
No related tags found
No related merge requests found
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment