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/</FT PPATH>
<HOMEPATH>//snap/FTP/</HOM EPATH>
<HOMEFOLDER>Cricket/IVR</H OMEFOLDER>
<Files>
<File>cricket_IVR.zip</Fil e>
</Files>
</FTPSITE>
<FTPSITE code= “payment_file”>
<URI>192.168.1.1</URI>
<Action>put</Action>
<FTPPATH>MPCS/Payments/NG/ </FTPPATH>
<HOMEPATH>//snap/share/</H OMEPATH>
<HOMEFOLDER>MPCS/NG/Paymen ts/</HOMEF OLDER>
<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.
I have a XML like this
<FTPSITES>
<FTPSITE code= ”IVR”>
<URI>212.147.53.21</URI>
<Action>get</Action>
<FTPPATH>Download/IVR/</FT
<HOMEPATH>//snap/FTP/</HOM
<HOMEFOLDER>Cricket/IVR</H
<Files>
<File>cricket_IVR.zip</Fil
</Files>
</FTPSITE>
<FTPSITE code= “payment_file”>
<URI>192.168.1.1</URI>
<Action>put</Action>
<FTPPATH>MPCS/Payments/NG/
<HOMEPATH>//snap/share/</H
<HOMEFOLDER>MPCS/NG/Paymen
<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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER