@Override
    public Map<String,String> legacyOverrides() {
        Map<String, String> result = new HashMap<>();
        try {
            Document services = Xml.getDocument(getServices());
            NodeList legacyNodes = services.getElementsByTagName("legacy");
            for (int i=0; i < legacyNodes.getLength(); i++) {
                var flagNodes = legacyNodes.item(i).getChildNodes();
                for (int j = 0; j < flagNodes.getLength(); ++j) {
                    var flagNode = flagNodes.item(j);
                    if (flagNode.getNodeType() == Node.ELEMENT_NODE) {
                        String key = flagNode.getNodeName();
                        String value = flagNode.getTextContent();
                        result.put(key, value);
                    }
                }
            }
        } catch (Exception e) {
            // nothing: This method does not validate that services.xml exists, or that it is valid xml.
        }
        return result;
    }
Common code for all implementations of ApplicationPackage

@author arnej
config-application-package/src/main/java/com/yahoo/config/model/application/AbstractApplicationPackage.java