This is the new Code but same error
public void run()
{
Set permissionSet;
perm = new InterOpPermission(InteropKind::ClrInterop);
permissionSet = new Set(Types::Class);
permissionSet.add(perm);
errorFlag =0;
////////// File path from table ////////////
select * from CompanySetupFolderAP;
processFilePath=CompanySetupFolderAP.ProcessingPEPS;
successFilePath=CompanySetupFolderAP.SuccessPEPS;
errorFilePath =CompanySetupFolderAP.FailedPEPS;
try
{
//Traverse to the inbound folder and search file
directoryInfo = new System.IO.DirectoryInfo(processFilePath );
//Get list of only text files
fileList = directoryInfo.GetFiles(@"*.xml");
//Get the file count
fileCount = fileList.get_Length();
//One by one get each file
for (i = 0; i < fileCount; i++)
{
file = fileList.GetValue(i);
///.Net method returns System.String need to marshal it to AX str data type
processName = file.get_FullName();
proName = file.get_Name();
axProcessName = proName;
xx=processFilePath+"\\"+axProcessName;
////////// Process Start Time /////////////
processStartTime = DateTimeUtil::getSystemDateTime();
//////// Read the XML Document //////////////////
filePerm = new FileIoPermission(xx,'r');
permissionSet.add(filePerm);
CodeAccessPermission::assertMultiple(permissionSet);
doc = new XMLDocument();
doc.load(xx);
//////// Verify Document Structure ////////////////
xmlError = doc.parseError();
if(xmlError && xmlError.errorCode()!= 0)
{
throw error(strFmt("Error: %1",xmlError.reason()));
}
///////////////// Parsing document contents //////////////////
rootNode = doc.documentElement();
/// Get all Vendor information from XML document tags (and remove it) ///
NodeLedgerJournal = rootNode.selectSingleNode("//LedgerJournal");
NodeCompany= rootNode.selectSingleNode("//Company");
info(NodeCompany.text());