I have a web service client that pull some information successfully. It's a Windows form application and the output is pulled in a textBox, which is correct.
Here you have part of my code:
if (GetData != null && GetData.Length > 0)
{
textBox1.Text += "Data Type" + ", ";
textBox1.Text += "\r\n";
for (int s = 0; s < GetData.Length; ++s)
{
textBox1.Text += GetData[s].ID + ", ";
textBox1.Text += "\r\n";
}
}
I want to output this into a XML file. To achieve this I have include the follow code. The files gets created successfully but it only include some data. I am suppose to get over 100 lines and I only get 4 lines at the same time. When I refresh the XML created file, the data change but It show only 4 lines and not all the 100 lines. What I can be missing?
Thanks
using (XmlTextWriter writer = new XmlTextWriter("Data.xml", null))
{
writer.WriteStartDocument();
writer.Formatting = Formatting.Indented;
writer.WriteStartElement("GetData");
writer.Formatting = Formatting.Indented;
for (int r = 0; r < GetData.Length; ++r)
{
writer.Formatting = Formatting.Indented;
writer.WriteStartElement("DataDetail");
writer.WriteElementString("DataType", GetData[r].ID);
writer.WriteEndElement();
}
writer.WriteEndElement();
writer.WriteEndDocument();
}