I can't quite get it to work. I can append an element but not a whole section.
here is the xml
Code:
- <InstrumentSession>
<gas>UNK</gas>
<alarmLow>2</alarmLow>
- <readings>
- <SensorReading>
<time>12:45</time>
<temperature>27</temperature>
<rawReading>4</rawReading>
</SensorReading>
</readings>
<customResponsename />
<customResponseValue>0</customResponseValue>
<status>OK</status>
</InstrumentSession>
Code:
Dim Docz As New System.Xml.XmlDocument
Dim Nodez As System.Xml.XmlNode
Docz.Load("C:\file.xml")
Nodez = Docz.CreateNodeSystem.Xml.XmlNodeType.Element, "SensorReading", "")
Docz.SelectSingleNode("//readings").AppendChild(Nodez)
Docz.Save("C:\file.xml")
That will add the element "SensorReading" but I want to add the whole "SensorReading" section inside of "readings". There has to be an easier way than where I am going. Please help.