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