Skip to content

Compare XML files Command: compareXMLFiles

The compareXMLFiles command under the File Handler function is used to compare the content of two XML files. It determines whether the files are identical in content.

Example: Suppose you want to verify if two configuration XML files have the same content.

Steps to configure:

  1. Select Set a Variable from the Action dropdown.
  2. Enter a variable name in the Element Key field (e.g., ComparisonResult). This variable will store the result of the comparison (True or False).
  3. Click on Form to open the configuration window.
  4. Select Functions from the dropdown, then choose File handler Functions.
  5. In the Cmd field, select compareXMLFiles.
  6. Provide the following parameters:
    • File1: Path to the first XML file (e.g., C:/Data/File1.xml).
    • File2: Path to the second XML file (e.g., C:/Data/File2.xml).
  7.  Click Save.
scrn-compare-xml-files-command-tabular-view
Tabular View
scrn-compare-xml-files-command-card-view
Card View

Outcome on execution:

  • If both XML files have identical content, the command returns true.
  • If there are differences or the operation fails (e.g., due to missing files), the command returns false.
  • The result is stored in the variable defined in the Element Key This variable can be used in later steps of your automation process to reference the stored information using the syntax ${VariableName} (e.g., ${ComparisonResult}).

Note: The comparison is case-sensitive and includes all whitespace characters.

Back To Top