目前在Visual Studio中我能够生成XML,但我想在IE中打开结果。
标有箭头的代码行是我生成XML文件的地方,当我右键单击它时,我可以在XML可视化工具中看到它。我想在IE中打开XML,以便我可以折叠和扩展节点以方便使用。谁能告诉我如何在IE中查看XML?
public bool GenerateNETSXML(AccountPRC acct, User currentUser)
{
bool success = true;
int nextTransactionSequence = 0;
NetsXMLGen xmlGen = new NetsXMLGen();
---> string xml = xmlGen.GenerateNetsXml(acct, ref nextTransactionSequence);
System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
byte[] xmlBytes = encoding.GetBytes(xml);
RiskXML riskxml = new RiskXML(true);
riskxml.GeneratedDate = DateTime.Now;
riskxml.TransactionSequence = nextTransactionSequence;
riskxml.NetsXML = xmlBytes;
acct.CurrentRisk.LoadRiskXMLs(false);
acct.CurrentRisk.RiskXMLs.Add(riskxml);
return success;
}
答案 0 :(得分:0)
将其写入如下文件:
string s = "<xml><foo></foo></xml>";
XmlDocument xdoc = new XmlDocument();
xdoc.LoadXml(s);
xdoc.Save("myfilename.xml");
然后像在其他任何地方一样在IE中打开文件。