I am currently working in .Net 2.0 and need to write an XML file
so far I have managed to find code that will push out to XML but will only write to the same line.
What I need os for new data to be written down the page like so
<Samples>
<sample>
<SationID> C1 </StationID>
<Date> 01/01/2011 </date>
<Time> 00:00 </time
<stub> 11111111A </stub>
<weight> 126 </Weight>
<tops> 4 </tops>
<Sample>
<sample>
<SationID> C1 </StationID>
<Date> 01/01/2011 </date>
<Time> 00:00 </time
<stub> 11111111A </stub>
<weight> 126 </Weight>
<tops> 4 </tops>
<Sample>
<sample>
<SationID> C1 </StationID>
<Date> 01/01/2011 </date>
<Time> 00:00 </time
<stub> 11111111A </stub>
<weight> 126 </Weight>
<tops> 4 </tops>
<Sample>
</Samples>
which is currently showing as
<Samples>
<Sample Stub="1111111A" Date="21/10/2011" Time="14:12:36" Weight="126" Tops="4" />
</Samples>
The code I am using to generate this is
Dim writer As Xml.XmlWriter
Dim enc As New System.[Text].UnicodeEncoding()
writer = New Xml.XmlTextWriter("C:\test.xml", enc)
writer.WriteStartDocument()
writer.WriteStartElement("Samples")
writer.WriteStartElement("Sample")
writer.WriteAttributeString("Stub", stubTxt.Text)
writer.WriteAttributeString("Date", dateLbl.Text)
writer.WriteAttributeString("Time", TimeLbl.Text)
writer.WriteAttributeString("Weight", cleanTxt.Text)
writer.WriteAttributeString("Tops", topsTxt.Text)
writer.WriteEndElement()
writer.WriteEndElement()
writer.Close()
MsgBox("Done", MsgBoxStyle.Exclamation, "XML")
Any help will be very much appreciated.