Rename the xmlnode name using c# dynamically

evevefreene

New Member
I am using the below code to rename the xmlnode name dynamically. It's looping work fine. But it does not change that. Please help me to do this.Sample XML doucment\[code\]- <NewDataSet>- <Table5> <FLD_ID>62</FLD_ID> <FLD_DATE>2013-03-12</FLD_DATE> <FLD_MOD_DATE>2013-04-05</FLD_MOD_DATE> <FLD_DESC>New Creation</FLD_DESC> </Table5>- </NewDataSet>\[/code\]Needed XML DOCUMENT\[code\]- <rows>- <row> <cell>62</cell> <cell>2013-03-12</cell> <cell>2013-04-05</cell> <cell>New Creation</cell> </row>- </rows>\[/code\]My code is here\[code\]XmlNode PackageListNode = hst_doc.SelectSingleNode("NewDataSet"); XmlNodeList PackageNodeList = PackageListNode.SelectNodes("Table5"); foreach (XmlNode node in PackageNodeList) { node.Name.Replace("Table5", "row"); foreach (XmlNode ls in node) { ls.Name.Replace(ls.Name, "cell"); } }\[/code\]
 
Back
Top