public double retrievePrecedingDuration(String node){		
		NodeList nodeList = doc.getElementsByTagName(node);
		double balanspost;
		int numberNodes = doc.getElementsByTagName(node).getLength();
		
		switch (numberNodes) {
		case 3:
			int itemNumberThree = 1;
			String contextRef = nodeList.item(itemNumberThree).getAttributes().getNamedItem("contextRef").getNodeValue();
			
			if (contextRef.equals("PrecedingInstant") || contextRef.equals("PrecedingInstant") ) {
				balanspost = Double.parseDouble(doc.getElementsByTagName(node).item(itemNumberThree).getTextContent());;
				//System.out.println(balancepost + " - " + doc.getElementsByTagName(node).item(1).getTextContent());
			} else {
				balanspost = 0;
			}
			break;
			
		case 2:
			int itemNumberTwo = 1;
			String contextRefTwo = nodeList.item(itemNumberTwo).getAttributes().getNamedItem("contextRef").getNodeValue();
		
			if (contextRefTwo.equals("PrecedingInstant") || contextRefTwo.equals("PrecedingDuration") ) {
				balanspost = Double.parseDouble(doc.getElementsByTagName(node).item(itemNumberTwo).getTextContent());;
				//System.out.println(balancepost + " - " + doc.getElementsByTagName(node).item(1).getTextContent());
			} else {
				balanspost = 0;
			}
			break;

		case 1:
			int itemNumberOne = 0;
			String contextRefOne = nodeList.item(itemNumberOne).getAttributes().getNamedItem("contextRef").getNodeValue();
			
			if (contextRefOne.equals("PrecedingInstant") || contextRefOne.equals("PrecedingDuration") ) {
				balanspost = Double.parseDouble(doc.getElementsByTagName(node).item(itemNumberOne).getTextContent());;
				//System.out.println(balancepost + " - " + doc.getElementsByTagName(node).item(1).getTextContent());
			} else {
				balanspost = 0;
			}
			break;	
			
		default:
			balanspost = 0;
			break;
		}
				
		return balanspost;	
	}