private void preprocessXML(File destination, File inputXml, Zone zone) throws IOException {
        if ( ! inputXml.exists()) return;
        try {
            InstanceName instance = metaData.getApplicationId().instance();
            Document document = new XmlPreProcessor(appDir,
                                                    inputXml,
                                                    instance,
                                                    zone.environment(),
                                                    zone.region(),
                                                    zone.cloud().name(),
                                                    getDeploymentSpec().tags(instance, zone.environment()))
                    .run();

            try (FileOutputStream outputStream = new FileOutputStream(destination)) {
                transformerFactory.newTransformer().transform(new DOMSource(document), new StreamResult(outputStream));
            }
        } catch (TransformerException | ParserConfigurationException | SAXException e) {
            throw new RuntimeException("Error preprocessing " + inputXml.getAbsolutePath() + ": " + e.getMessage(), e);
        }
    }
Reads a ranking expression from file to a string and returns it.

@param name the name of the file to return,
            relative to the search definition directory in the application package
@return the content of a ranking expression file
@throws IllegalArgumentException if the file was not found or could not be read
config-application-package/src/main/java/com/yahoo/config/model/application/provider/FilesApplicationPackage.java