Searching a good way to split an XML path into an array. I have the feeling my solution is not as reliable as i want.
What I have: <product><containeditem><productidentifier>
What I want to get is an array like: [product, containeditem, productidentifier]
My Code:
function GetPathArray(path) {
if (path != null) {
path = path.substring(0, path.length - 1);
path = path.substring(1);
var pathArray = [{}];
pathArray = path.split("><");
return pathArray;
}
else {
return null;
}
}