I am trying to replace a node in my XML file, but I need some help resolving how to replace a Node with a non-unique name or identifier.
The Question is, How do I replace to following Node with Data from XmlDataReplace:
/Document/ExclusionContainer/Mobile_Devices
Below is some sample code and data used in the sample code.
Sample Code
private void ReplaceXmlArray()
{
System.Xml.XmlDocument OriginalXmlDoc = new System.Xml.XmlDocument();
//Scroll Down for XmlData
OriginalXmlDoc.LoadXml("StackOverflow - XmlDataOriginal");
string NewXmlContent = "StackOverFlow - XmlDataReplace";
//Need help here on Code to Replace
//Node in OriginalXmlDoc
}
XmlDataOriginal - Original Doc
<Document>
<DefaultContainer>
<Mobile_Devices>
<Mobile_Device>
<Id>1</Id>
<Name>Device-One</Name>
</Mobile_Device>
</Mobile_Devices>
</DefaultContainer>
<ExlusionContainer>
<Mobile_Devices>
<Mobile_Device>
<Id>2</Id>
<Name>Device-Two</Name>
</Mobile_Device>
</Mobile_Devices>
<Laptops />
</ExclusionContainer>
</Document>
XmlDataReplace - Will Replace Data in XmlData1 (Document/ExclusionContainer/)
<Mobile_Devices>
<Mobile_Device>
<Id>2</Id>
<Name>Device-Two</Name>
</Mobile_Device>
<Mobile_Device>
<Id>3</Id>
<Name>Device-Three</Name>
</Mobile_Device>
</Mobile_Devices>
/Document/ExclusionContainer/Mobile_Devicesidentifies more than one node...