用XmlTextWriter追加记录

FileStream filestream  =   new  FileStream( @" c:/info.txt " , FileMode.Append);
XmlTextWriter writer 
=   new  XmlTextWriter(filestream, Encoding.Default);
writer.WriteStartElement(
" item " );
writer.WriteStartElement(
" person " );
writer.WriteElementString(
" name " " wzb " );
writer.WriteElementString(
" sex " " " );
writer.WriteEndElement();
writer.WriteEndElement();
writer.Close();
filestream.Close();



xml
<? xml version="1.0" ?>
<! DOCTYPE root [
<!ENTITY items    
 SYSTEM "info.txt"
>
]>
< root >
&items;
</ root >

你可能感兴趣的:(c,xml)