how to modify a xml file using Test complete
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
how to modify a xml file using Test complete
I am using the below method to modify the xml but it seems not working . please any idea how to do it
function ModifyXml(fileName, childNode,nodeNum,modifyNodeNum,text)
{
// If you have MSXML 6:
Doc = Sys.OleObject("Msxml2.DOMDocument.6.0");
Doc.async = false;
// Load data from a file
Doc.load(fileName)
Nodes = ExecuteXml(Doc,fileName, childNode);
// Process the node
for(i = 0; i < Nodes.length; i++)
{
// Get the node from the collection of the found nodes
Node = Nodes.item(i);
if ( i==nodeNum)
{
// Get child nodes
ChildNodes = Node.childNodes;
ChildNodes.item(modifyNodeNum).text = text
Log.Message(ChildNodes.item(modifyNodeNum).text + ": " + ChildNodes.item(2).text);
break;
}
Doc.save(fileName)
}
}
- Labels:
-
Script Extensions
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your question!
Hi @ApplePen @anupamchampati @tphillips , any ideas on how to fix this?
Sonya Mihaljova
Community and Education Specialist
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello ,
Can you please share the error log what error you are getting?
Also ExecuteXml seems to be separate function, can you please share that as well.
Thanks
