Skip to content

Compare XML text Command: compareXMLText

The compareXMLText command under the File Handler function is used to compare two XML text contents. It determines whether the entered XML contents are identical.

Example: Suppose you have two XML text snippets and want to verify if they are identical.

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 compareXMLText.
  6. Provide the following parameters:
    • XmlContent1: Enter the first XML text to be compared.
    • XmlContent2: Enter the second XML text to be compared.
  7. Click Save.
scrn-compare-xml-text-command-tabular-view
Tabular View
scrn-compare-xml-text-command-card-view
Card View

Outcome on execution:

  • If the XML text contents are identical, the command returns true.
  • If there are differences or the operation fails, 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}).

Notes:

  • Ensure that the XML text is well-formed and properly structured before execution. Any missing or mismatched tags will result in a false output.
  • The comparison is case-sensitive and includes all whitespace characters.

Back To Top