public static FeatureNode fromDom(Node node) {
        List<Element> children = XmlHelper.getChildElements(node, null);
        if (children.size() != 2) {
            throw new IllegalArgumentException("Expected 2 children in element '" + node.getNodeName() + "', got " +
                                               children.size() + ".");
        }

        String name = XmlHelper.getAttributeText(node, "feature");
        Value[] values = toValues(XmlHelper.getAttributeText(node, "value"));
        Optional<Integer> samples = toInteger(XmlHelper.getOptionalAttributeText(node, "nSamples"));
        TreeNode left = TreeNode.fromDom(children.get(0));
        TreeNode right = TreeNode.fromDom(children.get(1));

        if (name.endsWith("$") || values.length>1 || values[0] instanceof StringValue)
            return new CategoryFeatureNode(name, values, samples, left, right);
        else
            return new NumericFeatureNode(name, values[0], samples, left, right);
    }
A node in a GBDT tree which references a feature value

@author bratseth
searchlib/src/main/java/com/yahoo/searchlib/gbdt/FeatureNode.java