I have static method CreateXml where i create xml document. i get value of node and then i want add this values to list. my first append work fine, but second append dont work. How it fix and maybe you know how it code clear? screen here
private static void CreateXml(DataReader reader)
{
var tempServerDir = Path.Combine(tempExportDirectory, Text.GetRandomString() + ".xml");
XmlDocument xml=new XmlDocument();
/// <summary>
///Create Head xml element
/// </summary>
xml.CreateElement("Head");
var uniqueIdentifier = xml.CreateElement("Unique_identifier");
var documentDate = xml.CreateElement("Document_date");
var documentNumber = xml.CreateElement("Document_number");
var documentName = xml.CreateElement("Document_name");
var vehicleId = xml.CreateElement("Vehicle_id");
var company = xml.CreateAttribute("Company");
var driverId = xml.CreateAttribute("Driver_id");
var contractId=xml.CreateAttribute("Contract_id");
/// <summary>
///get value of node
/// </summary>
uniqueIdentifier.InnerText = Text.Convert(reader.GetFieldValue<int>("uniqueIdentifier"));
documentDate.InnerText = Text.Convert(reader.GetFieldValue<DateTime>("documentDate"));
documentNumber.InnerText = reader.GetFieldValue<string>("documentNumber");
documentName.InnerText = "NDMTtest";
//documentName.InnerText = reader.GetFieldValue<string>("documentName");
vehicleId.InnerText = Text.Convert(reader.GetFieldValue<int>("vehicleId"));
company.InnerText = Text.Convert(reader.GetFieldValue<int>("company"));
driverId.InnerText = Text.Convert(reader.GetFieldValue<int>("driverId"));
contractId.InnerText = reader.GetFieldValue<string>("contractId");
/// <summary>
///add values to list
/// </summary>
xml.AppendChild(uniqueIdentifier);
//xml.AppendChild(documentDate);
//xml.AppendChild(documentNumber);
//xml.AppendChild(documentName);
//xml.AppendChild(vehicleId);
//xml.AppendChild(driverId);
//xml.AppendChild(company);
//xml.AppendChild(contractId);
/// <summary>
///Create Order xml element
/// </summary>
xml.CreateElement("Order");
var testOrder = xml.CreateAttribute("NPP");
testOrder.InnerText = "TestString";
xml.AppendChild(testOrder);
InfoManager.MessageBox("tempServerDir4:{0}", tempServerDir);
/// <summary>
/// Save and send file to client from temp directory
/// </summary>
//xml.Save(Console.Out);
xml.Save(tempServerDir);
//FileManager.SendFile(tempServerDir);
InfoManager.MessageBox(FileManager.SendFile(tempServerDir));
}
//means that it is a comment, not code. Comments are just there for programmers to read, but they won't be executed. Remove the//and it might work. The colors of the text are there to help.