class SvgValidator {

    private String pathsAreClosed(final SVGOMSVGElement icon) {
        return browseDom(icon, node -> {
            if ("path".equals(node.getNodeName())) {
                final Node d = node.getAttributes() == null ? null : node.getAttributes().getNamedItem("d");
                if (d == null || d.getNodeValue() == null) {
                    return "Missing 'd' in a path";
                }
                if (!d.getNodeValue().toLowerCase(Locale.ROOT).endsWith("z")) {
                    return "All path must be closed so end with 'z', found value: '" + d.getNodeValue() + '\'';
                }
            }
            return null;
        });
    }

}