public final CompoundBlock loadDocument(Document d) {

		Element topLevelBlockElement = null;
		String topLevelBlockUUID = "";
		Element signalMappingElement = null;

		Element rootElement = d.getDocumentElement();
		NodeList nodes = rootElement.getChildNodes();

		// parse top level of xml, for top CompoundBlock and SignalMapping
		for (int i = 0; i < nodes.getLength(); i++) {
			Node node = nodes.item(i);
			if (node instanceof Element) {
				Element child = (Element) node;
				if (child.getNodeName() == "CompoundBlock") {
					topLevelBlockElement = child;
					topLevelBlockUUID = child.getAttribute("uuid");
				}
				if (child.getNodeName() == "SignalMapping") {
					signalMappingElement = child;
				}
			}
		}

		// TODO: replace with Exception
		CompoundBlock parsedBlock = null;

		if (topLevelBlockElement != null && signalMappingElement != null) {
			// parse top level CompoundBlock
			IOListContainer temp = loadCompoundBlock(topLevelBlockElement);

			// create top level CompoundBlock
			parsedBlock = new CompoundBlock(topLevelBlockUUID, temp.inList,
					temp.outList);
			blockHash.put(topLevelBlockUUID, parsedBlock);

			// load signal mapping from xml...
			ArrayList<SignalMappingContainer> mapping = loadSignalMapping(signalMappingElement);
			// ...and map the signals
			mapSignals(mapping);
		}

		// return the top level CompoundBlock
		return parsedBlock;
	}