private String sortXml(final String originalXml) {

        xmlProcessingInstructionParser.scanForIgnoredSections(originalXml);
        String xml = xmlProcessingInstructionParser.replaceIgnoredSections();

        insertXmlInXmlProcessor(xml, () -> "Could not sort " + pomFile.getAbsolutePath() + " content: ");
        xmlProcessor.sortXml();
        Document newDocument = xmlProcessor.getNewDocument();

        String sortedXml = xmlOutputGenerator.getSortedXml(newDocument);
        if (xmlProcessingInstructionParser.existsIgnoredSections()) {
            sortedXml = xmlProcessingInstructionParser.revertIgnoredSections(sortedXml);
        }
        return sortedXml;
    }
private String sortXml ( final String originalXml ) { xmlProcessingInstructionParser . scanForIgnoredSections ( originalXml ) ; String xml = xmlProcessingInstructionParser . replaceIgnoredSections ( ) ; insertXmlInXmlProcessor ( xml , ( ) -> "Could not sort " + pomFile . getAbsolutePath ( ) + " content: " ) ; xmlProcessor . sortXml ( ) ; Document newDocument = xmlProcessor . getNewDocument ( ) ; String sortedXml = xmlOutputGenerator . getSortedXml ( newDocument ) ; if ( xmlProcessingInstructionParser . existsIgnoredSections ( ) ) { sortedXml = xmlProcessingInstructionParser . revertIgnoredSections ( sortedXml ) ; } return sortedXml ; }
Sorts the incoming xml.

@param originalXml the xml that should be sorted.
@return the sorted xml