public RrdGraphDef getRrdGraphDef() {
        // basic check
        if (!root.getTagName().equals("rrd_graph_def")) {
            throw new IllegalArgumentException("XML definition must start with <rrd_graph_def>");
        }
        validateTagsOnlyOnce(root, new String[]{"filename", "span", "options", "datasources", "graph"});
        rrdGraphDef = new RrdGraphDef();
        // traverse all nodes
        Node[] childNodes = getChildNodes(root);
        for (Node childNode : childNodes) {
            String nodeName = childNode.getNodeName();
            if (nodeName.equals("filename")) {
                resolveFilename(childNode);
            }
            // SPAN
            else if (nodeName.equals("span")) {
                resolveSpan(childNode);
            }
            // OPTIONS
            else if (nodeName.equals("options")) {
                resolveOptions(childNode);
            }
            // DATASOURCES
            else if (nodeName.equals("datasources")) {
                resolveDatasources(childNode);
            }
            // GRAPH ELEMENTS
            else if (nodeName.equals("graph")) {
                resolveGraphElements(childNode);
            }
        }
        return rrdGraphDef;
    }