Eae pessoal, to tentado ler um arquivo xml no meu programa, mas tem uma linha que não estou conseguindo ler.
<?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>
Meu codigo está editado para a xml abaixo
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++;
}
Se eu editar xml, na seguinte forma, ai eu consigo ler
<?xml version="1.0"?>
<XML>
<PATCHINFO>
<Name>Teste</Name>
<SIZE>2962</SIZE>
<CHECKSUM>4206740436</CHECKSUM>
</PATCHINFO>
</XML>