private void readFieldDefinitions(Element element, QueryProfileType type, QueryProfileTypeRegistry registry) {
        for (Element field : XML.getChildren(element,"field")) {
            String name = field.getAttribute("name");
            if (name.isEmpty()) throw new IllegalArgumentException("A field has no 'name' attribute");
            try {
                String fieldTypeName = field.getAttribute("type");
                if (fieldTypeName.isEmpty()) throw new IllegalArgumentException("Field '" + field + "' has no 'type' attribute");
                FieldType fieldType = FieldType.fromString(fieldTypeName, registry);
                type.addField(new FieldDescription(name,
                                                   fieldType,
                                                   field.getAttribute("alias"),
                                                   getBooleanAttribute("mandatory", false, field),
                                                   getBooleanAttribute("overridable", true, field)),
                              registry);
            }
            catch(RuntimeException e) {
                throw new IllegalArgumentException("Invalid field '" + name + "'",e);
            }
        }
    }
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