Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
def inputFile = new File(this.args[0])

def fileToCompare = new File(this.args[1])

// Some more validations.
if (!inputFile.exists()) {
  // Nothing to process, return
  println "The input file doesn't exist. Process incomplete"
  return
}

if (!fileToCompare) {
  // invalid file for comparison
  println "File to compare doesn't exist. Process incomplete"
  return
}


// If we are here, then the input data is valid, we can start the main processing.

Lets skip some of the sanity checks such as whether the input file is an XML, is it following the XSD structure etc. Lets assume the well structured, required XML files, ready for processing. We have some special parser API available in groovy for processing XML files as dotted notations. Lets load the input file using the API.

...