Hi all,
I am having few xml files with same attrributes having different input values. I have created a js file to take these inputs from single xml file.
Following is the js code :
var Nodes = new Array();
var RaidType;
function XMLReader()
{
var Doc, node, s;
// Create a COM object
Doc = Sys.OleObject("Msxml2.DOMDocument.6.0");
Doc.async = false;
var Filename = "
test.xml";
// Load data from a file
Doc.load("
C:\\test.xml");
// Report an error, if, for instance, the markup or file structure is invalid
// Obtain the node
node = Doc.documentElement;
// Process the node
ProcessNode(node);
}
function ProcessNode(ANode)
{
var i, ChildNodes;
// Process the node's value and insert it in variables
switch(ANode.nodeName)
{
case 'Node':
Nodes[a] = ANode.nodeTypedValue;
//Nodes = temp.split(" ");
Log.Message(Nodes[a]);
a = a + 1;
break;
case 'RaidType':
RaidType = ANode.nodeTypedValue;
Log.Message(RaidType);
break;
}
// Exclude helper nodes from processing
// Obtain the collection of child nodes
ChildNodes = ANode.childNodes;
// Processes each node of the collection
for(i = 0; i < ChildNodes.length; i++)
ProcessNode(ChildNodes.item(i));
}
I am Calling below two functions for execution :
XMLReader();
startUpgrade();
Query : As of now, i am able to retrieve values from test.xml file (only) mentioned above in the code and execute. I need to similarly retrieve values from mutiple xml files ie. first time i need values from test.xml and process below functions:
XMLReader(); //values of test.xml
startUpgrade();
In the next iteration, i need values to be retrieved from abc.xml and process below functions:
XMLReader(); //values of abc.xml
startUpgrade();
In the next iteration, i need values to be retrieved from def.xml and process below functions:
XMLReader(); //values of def.xml
startUpgrade();
Can anyone help me on this as i am really confused on how to get going
Thanks in advance..