How to get attribute name and its values from xml using javascript?
Hi,
I am trying to get the attribute name and its values from xml(i have saved this xml in some folder) using javascript.the code has given below,
var currentFolder = Folder.selectDialog();
if (currentFolder == null) exit();
var currentFolderPath = currentFolder.absoluteURI + "/";
var xmlFile = new File(currentFolderPath +xmlname);
if (!xmlFile.exists) exit();
xmlFile.open("r");
var xmlStr = xmlFile.read();
xmlFile.close();
var root = new XML(xmlStr);
var linksArr = [];
var componentList = root.xpath("//product_family");
var componentsLength = componentList.length(); var component;
var product;var pricevalue;var products;var itemvalue;
for (var c = 0; c <componentsLength; c++)
{
component = componentList
product=component.xpath("//products").children()
for(var d=0;d<product.length();d++)
{
prod=product.children().length();
for(var x=0;x<product.children().length();x++)
{
attribute=product.children()
}
}
}
In this,attribute=product.children()
Thanks in advance,
Vimala L
