/** * Parses FpML from the specified source, extracting the trades. * <p> * This parses the specified byte source which must be an XML document. * <p> * Sometimes, the FpML document is embedded in a non-FpML wrapper. * This method will intelligently find the FpML document at the root or within one or two levels * of wrapper by searching for an element that contains both {@code <trade>} and {@code <party>}. * * @param source the source of the FpML XML document * @return the parsed trades * @throws RuntimeException if a parse error occurred */ public List<Trade> parseTrades(ByteSource source) { XmlFile xmlFile = XmlFile.of(source, FpmlDocument.ID); XmlElement root = findFpmlRoot(xmlFile.getRoot()); return parseTrades(root, xmlFile.getReferences()); }