convert txt file into XML in C# RRS feed

  • 问题

  • I have following content in text file ,I need convert it into xml format .Please help me for this xml conversion

    <event date="Feb 11 08:45:55 +00:00" severity="2" hostName="CHAITALIK" source=" module=" process=" pid="2908" thread="26" tickCount="9596031"><![CDATA[Failed To Save File : ]]></event><event date="Feb 11 08:45:55 +00:00" severity="2" hostName="CHAITALIK" source=" module="Symantec.SPC.Middletier.Services.exe" process="Symantec.SPC.Middletier.Services" pid="2908" thread="26" tickCount="9596046"><![CDATA[Failed To Save File : ]]></event>

    2010年2月16日 10:23


  • Hi,

    Not sure exactly what do you want. xml is actually a text file bound to a format. if your content in the text file is already in xml format.  the only thing you need to do is change the suffix of the file name from .txt to .xml.

    If your content in the text  file is simply a plain string. you may need c# to do some extra work to construct a xml document tree. see this:
    This posting is provided "AS IS" with no warranties, and confers no rights. Microsoft Online Community Support
    2010年2月22日 1:29