I don't get any error basically the object is null anyway this code worked a few weeks ago.
If I tried to read some node i get a exception object is null
static void TEST(Args _args)
{
XmlDocument xmlRates;
XmlNode currencyNode;
str url = "">www.ecb.europa.eu/.../eurofxref-daily.xml";
str url2 = "">www.bnr.ro/nbrfxrates.xml";
System.Net.WebClient webClient = new System.Net.WebClient();
System.Exception ex;
Set permissionSet;
permissionSet = new Set(Types::Class);
permissionSet.add(new InteropPermission(InteropKind::ClrInterop));
permissionSet.add(new FileIOPermission(url, 'r'));
CodeAccessPermission::assertMultiple(permissionSet);
try
{
xmlRates = new XmlDocument();
if(!xmlRates.load(url))
{
throw error("Error");
//return;
}
CodeAccessPermission::revertAssert();
permissionSet = new Set(Types::Class);
permissionSet.add(new InteropPermission(InteropKind::ClrInterop));
permissionSet.add(new FileIOPermission(url2, 'r'));
CodeAccessPermission::assertMultiple(permissionSet);
xmlRates = new XmlDocument();
xmlRates.load(url2);
/*if(!xmlRates.load(url2))
{
throw error("Error");
}*/
currencyNode = xmlRates.root();
if (!currencyNode)
{
return;
}
}
catch (Exception::CLRError)
{
ex = ClrInterop::getLastException();
if (ex != null)
{
info(ex.get_Message());
ex = ex.get_InnerException();
if (ex != null)
error(ex.ToString());
}
}
catch (Exception::Internal)
{
ex = ClrInterop::getLastException();
if (ex != null)
info(ex.get_Message());
}
CodeAccessPermission::revertAssert();
}