我已經將我的DataTable轉換爲XML。安排從數據錶轉換的xml
目前XML輸出是這樣的..
<DocumentElement>\r\n <cardDetails>\r\n <mid>123456789190</mid>\r\n <cardnumber>1234</cardnumber>\r\n <expmonth>01</expmonth>\r\n <expyear>2017</expyear>\r\n <cvv>404</cvv>\r\n <amount>3.54</amount>\r\n <exptime>1/1/2017 11:03:38 AM</exptime>\r\n <responsecode>0000</responsecode>\r\n </cardDetails>\r\n
我希望我的輸出是這樣的..
<DocumentElement>
<cardDetails>
<mid>123456789190</mid>
<cardnumber>123456789190</cardnumber>
<expmonth>01</expmonth>
<expyear>2017</expyear>
<cvv>404</cvv>
<amount>3.54</amount>
<exptime>1/1/2017 11:03:38 AM</exptime>
<responsecode>0000</responsecode>
</cardDetails
這裏是我的代碼
DataTable table = getGenerate.generateCard(mid, passcode, amount, expmonth, expyear, expday, days, hrs, numberOfCards);
string xmlString = string.Empty;
using (TextWriter writer = new StringWriter())
{
table.WriteXml(writer);
xml = writer.ToString();
}
return xml;
所以,任何幫助?
'\ r \ N'只是未在你的XML的觀點得到應用的返回碼。看看這裏:http://programmers.stackexchange.com/questions/29075/difference-between-n-and-r-n – Bendy
你試過保存到文件? – jdweng