docs: public InterestRateSwapProductDescriptor getSwapProductDescriptor(File file) throws SAXException, IOException, ParserConfigurationException {
  
  		Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(file);
  		doc.getDocumentElement().normalize();
  
  		//Check compatibility
  		if(! doc.getDocumentElement().getNodeName().equalsIgnoreCase("FIPXML")) {
  			throw new IllegalArgumentException("This parser is meant for XML of type FIPXML, but file was "+doc.getDocumentElement().getNodeName()+".");
  		}
  
  		if(doc.getElementsByTagName("instrumentName").item(0).getTextContent().equalsIgnoreCase("Interest Rate Swap")) {
  			if (doc.getElementsByTagName("legAgreement").getLength() != 2) {
  				throw new IllegalArgumentException("Unknown swap configuration. Number of swap legs was "+doc.getElementsByTagName("legAgreement").getLength());
  			}
  		} else {
  			throw new IllegalArgumentException("This xml parser is not set up to process trade of type "+doc.getElementsByTagName("instrumentName").item(0).getTextContent());
  		}
  
  		DayCountConvention daycountConvention = DayCountConventionFactory.getDayCountConvention(doc.getElementsByTagName("dayCountFraction").item(0).getTextContent());
  
  		//TODO try to get curves from file. Problems if there are two float/fixed legs
  		//forward curve
  		String forwardCurveName = null;
  		NodeList temp = doc.getElementsByTagName("instrumentId");
  		for(int index = 0; index < temp.getLength(); index++) {
  			Node id = temp.item(index);
  			if(id.getAttributes().getNamedItem("instrumentIdScheme").getTextContent().equalsIgnoreCase("INTERESTRATE")) {
  				forwardCurveName = id.getTextContent();
  				break;
  			}
  		}
  
  		//Discount curve
  		String[] split = forwardCurveName.split("_");
  		String discountCurveName = (this.discountCurveName == null || this.discountCurveName.length() == 0 ) ? split[0] +"_"+split[1] : this.discountCurveName;
  
  		InterestRateSwapLegProductDescriptor legReceiver = null;
  		InterestRateSwapLegProductDescriptor legPayer = null;
  
  		//Get descriptors for both legs
  		NodeList legs = doc.getElementsByTagName("legAgreement");
  		for(int legIndex = 0; legIndex < legs.getLength(); legIndex++) {
  			Element leg = (Element) legs.item(legIndex);
  
  			boolean isPayer = (leg.getElementsByTagName("payDirection").item(0).getTextContent().equalsIgnoreCase("SELLER_TO_BUYER") && !agentIsBuyer)
  					|| (leg.getElementsByTagName("payDirection").item(0).getTextContent().equalsIgnoreCase("BUYER_TO_SELLER") && agentIsBuyer);
  			boolean isFixed = leg.getElementsByTagName("interestType").item(0).getTextContent().equals("FIX");
  
  			if(isPayer) {
  				legPayer = getSwapLegProductDescriptor(leg, isFixed ? null : forwardCurveName, discountCurveName, daycountConvention);
  			} else {
  				legReceiver = getSwapLegProductDescriptor(leg, isFixed ? null : forwardCurveName, discountCurveName, daycountConvention);
  			}
  
  		}
  
  		return new InterestRateSwapProductDescriptor(legReceiver, legPayer);
  
  	}