生成的XML文件格式

问题描述:

亲爱的朋友,

使用
生成了XML
ds.WriteXml(Application.Current.Properties ["Appath"].ToString()+"sampe.xml");

生成以下格式的XML.

Dear Freinds,

Have generated the XML using

ds.WriteXml(Application.Current.Properties["Appath"].ToString() + "sampe.xml");

The below format XML generated.

 <?xml version="1.0" standalone="yes" ?> 
 <Root>
 <KYCDATA>
  <columndiff>1</columndiff> 
  <acct_code>1765</acct_code> 
  <dpid>12063700</dpid> 
  <APP_UPDTFLG>0</APP_UPDTFLG> 
  <APP_POS_CODE /> 
  <APP_TYPE /> 
 <KYCDATA/>
<Root/>



但是下面的结构XML格式是什么



But What the below stucture XML format

<Root>
<KYCDATA>
 <columndiff>1</columndiff>
 <acct_code>1765</acct_code>
 <dpid>12063700</dpid>
 <APP_UPDTFLG>0</APP_UPDTFLG>
 <APP_POS_CODE />
 <APP_TYPE />
<KYCDATA>
<Root>



谢谢,
Mahalakshmi S.



Thanks,
Mahalakshmi S.

您将相同的XML粘贴了两次.您的格式将是您创建的格式.使用System.IO.Path.Combine方法创建路径而不是字符串混搭.
You pasted the same XML twice. Your format will be the format you created. Use the System.IO.Path.Combine method to create paths instead of string mashing.


我的解决方案在这里

My solution is here

dsExport.WriteXml(_appath + "\\" + strfilename);
StreamReader streamReader;
streamReader = File.OpenText(_appath + "\\" + strfilename);                    
string contents = streamReader.ReadToEnd();
streamReader.Close();
StreamWriter streamWriter = File.CreateText(_appath + "\\" + strfilename);  
streamWriter.Write(contents.Substring(contents.IndexOf("?>")+2));
streamWriter.Close();      



谢谢



Thanks