diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-09-15 10:18:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-15 10:18:29 +0200 |
commit | 79611f45f30943652b27c9d22232ceac8bc6bedc (patch) | |
tree | 0ffdd1886a5f1ad9844b8c0aa6a6a13bba30090d /config-model/src/main | |
parent | 4c059e953fa882fb8d3607927ade0cdc0d647097 (diff) | |
parent | 93fa75131c332ad0e095230328c1f1798c7897ce (diff) |
Merge branch 'master' into bratseth/validate-model-elements
Diffstat (limited to 'config-model/src/main')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomConfigPayloadBuilder.java | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomConfigPayloadBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomConfigPayloadBuilder.java index 72358c1d413..1631bd228df 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomConfigPayloadBuilder.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomConfigPayloadBuilder.java @@ -11,10 +11,8 @@ import com.yahoo.vespa.config.util.ConfigUtils; import com.yahoo.yolean.Exceptions; import org.w3c.dom.Element; import java.util.List; -import java.util.regex.Matcher; import java.util.regex.Pattern; - /** * Builder that transforms xml config to a slime tree representation of the config. The root element of the xml config * must be named 'config' and have a 'name' attribute that matches the name of the {@link ConfigDefinition}. The values @@ -37,8 +35,8 @@ public class DomConfigPayloadBuilder { /** * Builds a {@link ConfigPayloadBuilder} representing the input 'config' xml element. * - * @param configE The 'config' xml element - * @return a new payload builder built from xml. + * @param configE the 'config' xml element + * @return a new payload builder built from xml */ public ConfigPayloadBuilder build(Element configE) { parseConfigName(configE); @@ -120,7 +118,6 @@ public class DomConfigPayloadBuilder { private void parseLeaf(Element element, ConfigPayloadBuilder payloadBuilder, String parentName) { String name = extractName(element); String value = XML.getValue(element); - var definition = payloadBuilder.getConfigDefinition(); if (value == null) { throw new ConfigurationRuntimeException("Element '" + name + "' must have either children or a value"); } @@ -134,7 +131,8 @@ public class DomConfigPayloadBuilder { payloadBuilder.getArray(parentName).append(value); } } - else if (definition != null && definition.getModelDefs().containsKey(name)) { // model field special syntax + else if (element.hasAttribute("model-id") || element.hasAttribute("url") || element.hasAttribute("path")) { + // special syntax for "model" fields String modelString = modelElement("model-id", element); modelString += " " + modelElement("url", element); modelString += " " + modelElement("path", element); |