private void applyProperties(Element parent) {
        NamedNodeMap attributes = parent.getAttributes();
        for (int i = 0; i < attributes.getLength(); i++) {
            Node a = attributes.item(i);
            if (hasProperty(a)) {
                replaceAttributePropertyWithValue(a);
            }
        }

        if (XML.getChildren(parent).isEmpty() && parent.getTextContent() != null) {
            if (hasPropertyInElement(parent)) {
                replaceElementPropertyWithValue(parent);
            }
        }

        // Repeat for remaining children;
        for (Element child : XML.getChildren(parent)) {
            applyProperties(child);
        }
    }
Handles getting properties from services.xml and replacing references to properties with their real values

@author hmusum
config-application-package/src/main/java/com/yahoo/config/application/PropertiesProcessor.java