private void readFields(Element element,QueryProfile profile, QueryProfileRegistry registry,
                            DimensionValues dimensionValues, String sourceDescription) {
        List<KeyValue> references = new ArrayList<>();
        List<KeyValue> properties = new ArrayList<>();
        for (Element field : XML.getChildren(element,"field")) {
            String name = field.getAttribute("name");
            if (name.isEmpty())
                throw new IllegalArgumentException("A field in " + sourceDescription + " has no 'name' attribute");
            try {
                Boolean overridable = getBooleanAttribute("overridable", null, field);
                if (overridable != null)
                    profile.setOverridable(name, overridable, dimensionValues.asContext(profile.getDimensions()));
                Object fieldValue = readFieldValue(field, name, sourceDescription, registry);
                if (fieldValue instanceof QueryProfile)
                    references.add(new KeyValue(name, fieldValue));
                else
                    properties.add(new KeyValue(name, fieldValue));
            }
            catch (IllegalArgumentException e) {
                throw new IllegalArgumentException("Invalid field '" + name + "' in " + sourceDescription,e);
            }
        }
        // Must set references before properties
        for (KeyValue keyValue : references)
            profile.set(keyValue.getKey(), keyValue.getValue(), dimensionValues, registry);
        for (KeyValue keyValue : properties)
            profile.set(keyValue.getKey(), keyValue.getValue(), dimensionValues, registry);

    }
Throws an exception if the name is not corresponding to the id
container-search/src/main/java/com/yahoo/search/query/profile/config/QueryProfileXMLReader.java