Hey guys, I've tried to read an xml file in my program, but there's a line I can not read.
<?xml version="1.0"?>
<XML>
<PATCHINFO>
<PATCHNODE file="./Unit1.dfm">
<SIZE>2962</SIZE>
<CHECKSUM>4206740436</CHECKSUM>
</PATCHNODE>
<PATCHNODE file="./Unit1.pas">
<SIZE>5124</SIZE>
<CHECKSUM>2933818657</CHECKSUM>
</PATCHNODE>
<PATCHNODE file="./atch.pas">
<SIZE>4286</SIZE>
<CHECKSUM>1112274213</CHECKSUM>
</PATCHNODE>
<PATCHNODE file="./teste.dpr">
<SIZE>252</SIZE>
<CHECKSUM>3715331657</CHECKSUM>
</PATCHNODE>
<PATCHNODE file="./teste2.res">
<SIZE>1572</SIZE>
<CHECKSUM>1544128681</CHECKSUM>
</PATCHNODE>
</PATCHINFO>
</XML>
My code is edited for xml below
int curr_array_element = 0;
Hash hash = new Hash();
XmlDocument doc = new XmlDocument();
doc.Load("Patch.xml");
XmlElement root = doc.DocumentElement;
XmlNodeList allFiles = root.GetElementsByTagName("PATCHINFO");
foreach (XmlNode n in allFiles)
{
string fileName = n["NAME"].InnerText;
string fileHash = n["CHECKSUM"].InnerText;
if (!File.Exists(fileName))
{
this.allSize += Convert.ToInt32(XMLHandler.getSizeOfFile(fileName));
this.increaseDownloadNumber();
string[] temp = this.toDownloadFile;
this.toDownloadFile = new string[this.toDownloadNumber];
int curr_store_element = 0;
foreach (string curr_element in temp)
{
this.toDownloadFile[curr_store_element] = curr_element;
curr_store_element++;
}
this.addToDownloadList(fileName, curr_array_element);
curr_array_element++;
}
If I edit xml, in the following way, then I can read
<?xml version="1.0"?>
<XML>
<PATCHINFO>
<Name>Teste</Name>
<SIZE>2962</SIZE>
<CHECKSUM>4206740436</CHECKSUM>
</PATCHINFO>
</XML>