Hi all,
I’ve found a program that is exactly what im looking for but its in a different language and im not sure how to alter it! Can anyone help me translate it or tell me what language its in so i can translate it.
Thanks a million,
mags
This is part of the code:
// Incarca XML din fisierul extern
Stage.showMenu = false;
var myXML = new XML();
myXML.onLoad = function() {
play();
}
myXML.load(“hierarchy.xml”);
stop();
XML.prototype.toObject = function(removeWS) {
// Initializare
removeWS = (removeWS==null || !removeWS) ? false : true;
var xObj = this;
var obj = {};
var arrayNodes = new Object(); // Nodurile sunt salvate ca siruri
var i;
// Procesare
if(xObj.nodeType==1) {
// Adauga atribut
for(i in xObj.attributes) {
if(i!=‘XAforce’) obj* = xObj.attributes*;
}
var cNodes = new Array();
for(i in xObj.childNodes) {
cNodes.unshift(xObj.childNodes*);
}
// Trecere prin nodurile aferente
for(i in cNodes) {
// Se trece de noduri goale
var s = cNodes*.toString();
s = s.split("
“).join(”");
s = s.split("\r").join("");
s = s.split(" “).join(”");
if(s=="") continue;
// Variabile
var child = cNodes*;
child.toObject = XML.prototype.toObject;
// Adauga nod la obiect
if(child.nodeName==null) {
}
else if(obj[child.nodeName]!=null) {
// Marcheaza daca nod exista in sir
if(arrayNodes[child.nodeName]==null) {
arrayNodes[child.nodeName] = true;
obj[child.nodeName] = [obj[child.nodeName]];
}
// Push nod in sir
obj[child.nodeName][obj[child.nodeName].length] = child.toObject(removeWS);
}
else if(child.attributes[‘XAforce’]!=null) {
// Marcheaza daca nod exista in sir
if(arrayNodes[child.nodeName]==null) {
arrayNodes[child.nodeName] = true;
}
}
else {
// Procesare ramura urmatoare
obj[child.nodeName] = child.toObject(removeWS);
}
}
}
// Returneaza obiect
return obj;
}