code: public String getNormalizedXml(String filePath) {
  
          // Read the provided filename
          final StringWriter toReturn = new StringWriter();
          final BufferedReader in;
          try {
              in = new BufferedReader(new FileReader(new File(filePath)));
          } catch (FileNotFoundException e) {
              throw new IllegalArgumentException("Could not find file [" + filePath + "]", e);
          }
  
          // Parse into a Document
          final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          factory.setNamespaceAware(true);
  
          Document document = null;
          try {
  
              document = factory.newDocumentBuilder().parse(new InputSource(in));
              Transformer transformer = FACTORY.newTransformer();
              transformer.setOutputProperty(OutputKeys.INDENT, "yes");
              transformer.transform(new DOMSource(document.getFirstChild()), new StreamResult(toReturn));
  
          } catch (Exception e) {
              throw new IllegalArgumentException("Could not transform DOM Document", e);
          }
  
          // All done.
          return toReturn.toString();
      }
docs: Reads the XML file found at the provided filePath, returning a normalized
  XML form suitable for comparison.
  
  @param filePath The path to the XML file to read.
  @return A normalized, human-readable, version of the given XML document.