Hi I need to delete the Empty Nodes in XML port through code unit with using Dot net variable. Is my code is correct ? kindly suggest some answers.
Documentation()
OnRun()
Document:= Document.XmlDocument();
Document.Load('D:\xml\xmlportforexport.xml');
Parentnode:= Document.SelectSingleNode('Root');
Nodelist:= Parentnode.ChildNodes();
FOR I := 0 TO Nodelist.Count -1 DO BEGIN
Childnode := Nodelist.ItemOf(I);
CASE Childnode.Name OF
'Tablename':
BEGIN
Childnodelist:= Childnode.ChildNodes();
FOR J := 0 TO Childnodelist.Count -1 DO BEGIN
Childnode:= Childnodelist.ItemOf(J);
Deletingfunction(Childnode);
END;
END;
ELSE
BEGIN
END;
END;
END;
MESSAGE('done');
LOCAL Deletingfunction(Nodes : DotNet "System.Xml.XmlNodeList")
Nodes:= XMLDoc.ChildNodes;
FOR A := 0 TO Nodes.Count -1 DO BEGIN
DOMNode:= Nodes.Item(A);
END;
XMLDoc:= XMLDoc.XmlDocument;
XMLDoc.Load('D:\xml\xmlportforexport.xml');
Nodes:= XMLDoc.SelectSingleNode('/name');
FOR A := 0 TO Nodes.Count -1 DO BEGIN
XMLNode1:= Nodes.Item(A);
XMLNode1:= Nodes.Item(A);
XMLNode1.ParentNode().RemoveChild(XMLNode1);
END;
XMLDoc.Save('D:\xml\xmlportforexport2.xml');
MESSAGE('Work delted');
0
Answers