private String sortXml(final String originalXml){
  String errorMsg="Could not sort pom files content: ";
  xmlProcessingInstructionParser.scanForIgnoredSections(originalXml);
  String xml=xmlProcessingInstructionParser.replaceIgnoredSections();
  insertXmlInXmlProcessor(xml,errorMsg);
  xmlProcessor.sortXml();
  try (ByteArrayOutputStream sortedXmlOutputStream=xmlProcessor.getSortedXml()){
    String sortedXml=sortedXmlOutputStream.toString(encoding);
    if (xmlProcessingInstructionParser.existsIgnoredSections()) {
      sortedXml=xmlProcessingInstructionParser.revertIgnoredSections(sortedXml);
    }
    return sortedXml;
  }
 catch (  IOException e) {
    throw new FailureException(errorMsg + xml,e);
  }
}

private String sortXml ( final String originalXml ) { String errorMsg = "Could not sort pom files content: " ; xmlProcessingInstructionParser . scanForIgnoredSections ( originalXml ) ; String xml = xmlProcessingInstructionParser . replaceIgnoredSections ( ) ; insertXmlInXmlProcessor ( xml , errorMsg ) ; xmlProcessor . sortXml ( ) ; try ( ByteArrayOutputStream sortedXmlOutputStream = xmlProcessor . getSortedXml ( ) ) { String sortedXml = sortedXmlOutputStream . toString ( encoding ) ; if ( xmlProcessingInstructionParser . existsIgnoredSections ( ) ) { sortedXml = xmlProcessingInstructionParser . revertIgnoredSections ( sortedXml ) ; } return sortedXml ; } catch ( IOException e ) { throw new FailureException ( errorMsg + xml , e ) ; } }
sorts the incoming xml .
