Link to home
Start Free TrialLog in
Avatar of jyotishb
jyotishb

asked on

Parsing XML in C#

Hi,
I have a XML like this
<FTPSITES>
   <FTPSITE code= ”IVR”>
      <URI>212.147.53.21</URI>
      <Action>get</Action>
      <FTPPATH>Download/IVR/</FTPPATH>
      <HOMEPATH>//snap/FTP/</HOMEPATH>
      <HOMEFOLDER>Cricket/IVR</HOMEFOLDER>
      <Files>
          <File>cricket_IVR.zip</File>
      </Files>
   </FTPSITE>
   
   <FTPSITE code= “payment_file”>
      <URI>192.168.1.1</URI>
      <Action>put</Action>
      <FTPPATH>MPCS/Payments/NG/</FTPPATH>
      <HOMEPATH>//snap/share/</HOMEPATH>
      <HOMEFOLDER>MPCS/NG/Payments/</HOMEFOLDER>
      <Files>
          <File>NG_DEF.txt</File>
          <File>NG_CONTROL.txt</File>
          <File>NG_BATCH.txt</File>
      </Files>
   </FTPSITE>
</FTPSITES>

And i want to create a array of structures where each structure will record all the XML element values.
I have declared the structure like this:
              struct FtpParam
            {
                  public string code;
                  public string URI;
                  public string Action;
                  public string FTPPATH;
                  public string HOMEPATH;
                  public string HOMEFOLDER;
                  public ArrayList Files;
            
            }

So for each FTPSITE tag there will be one structure which will store all the inside tag values.

what would be the best way to do that?
Thanks in advance.
If some part of the question is not clear, please let me know.
ASKER CERTIFIED SOLUTION
Avatar of ankitbansal
ankitbansal

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jyotishb
jyotishb

ASKER

hey, thanks for the help