<?xml version="1.0"?> <equipments> <equipment name="DA-001"> <plant>Brazil</plant> </equipment> <equipment name="VERIGY-93K_PSL-032"> <plant>Brazil</plant> </equipment> <equipment name="BA-1500-002"> <plant>Muar</plant> </equipment> </equipments>
XmlDocument doc = new XmlDocument(); doc.Load(history); XmlNode equipment = doc.CreateElement("equipment"); XmlAttribute name = doc.CreateAttribute("name"); name.Value = textBox.Text; equipment.Attributes.Append(name); doc.DocumentElement.AppendChild(equipment); XmlNode plant = doc.CreateElement("plant"); plant.InnerText = cmbPlant.SelectedItem.ToString(); doc.DocumentElement.AppendChild(plant); doc.Save("Equipment.xml");
<?xml version="1.0"?> <equipments> <equipment name="DA-001"> <plant>Brazil</plant> </equipment> <equipment name="VERIGY-93K_PSL-032"> <plant>Brazil</plant> </equipment> <equipment name="BA-1500-002"> <plant>Muar</plant> </equipment> <equipment name="This_Equipment_added" /> <plant>USA</plant> </equipments>
doc.DocumentElement.AppendChild(equipment); doc.DocumentElement.AppendChild(plant);
equipment.AppendChild(plant);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)