Forum Discussion

wynandb1's avatar
wynandb1
Contributor
10 years ago

XML File Comparison

Hi

 

Can anyone perhaps help me with the following please ? 

 

I want to compare master XML file with newly exported file. The new file name has variables in it. I tried the XML checkpoint and added the masted to the store but hte problem is that I cant spesify the new file name. 

 

I tried wild cards, but it doesn't work. I get the following error. 

 

'C:\foldername\file_export_name_*_*.xml' document is invalid. Error: The filename, directory name, or volume label syntax is incorrect.

 

Is there a way to add to the jscrip I have here to achieve the comparison of the new file which has variables in the file name ? 

 

Your help will be highly appreciated. 

 

function Test1()
{
//Compares the XmlCheckpoint2 Stores item with the 'C:\Bopkaart XML\BSV_BOPCARDXMLEXPORT_OUT_*_*.xml' XML document.
XML.XmlCheckpoint2.Check("C:\\Bopkaart XML\\BSV_BOPCARDXMLEXPORT_OUT_*_*.xml");
}

 
  • Use the aqFileSystem to find the file you're looking for.

     

     

    function Test1() {
    
      var aFile,
          filePath,
          foundFiles;
          
      foundFiles = aqFileSystem.FindFiles("C:\\path\\to\\files\\", "Test_*_*.xml");
      
      if (foundFiles != null) {
          aFile = foundFiles.Next();
          Log.Message(aFile.Name);
      }
      else
        Log.Message("No files were found.");
       
      filePath = "C:\\path\\to\\files\\" + aFile.Name;
      
      Log.Message(filePath);
      
      XML.XmlCheckpoint1.Check(filePath);

    }

     

  • cunderw's avatar
    cunderw
    Community Hero

    Use the aqFileSystem to find the file you're looking for.

     

     

    function Test1() {
    
      var aFile,
          filePath,
          foundFiles;
          
      foundFiles = aqFileSystem.FindFiles("C:\\path\\to\\files\\", "Test_*_*.xml");
      
      if (foundFiles != null) {
          aFile = foundFiles.Next();
          Log.Message(aFile.Name);
      }
      else
        Log.Message("No files were found.");
       
      filePath = "C:\\path\\to\\files\\" + aFile.Name;
      
      Log.Message(filePath);
      
      XML.XmlCheckpoint1.Check(filePath);

    }