/** * Parses the FpML document extracting the trades. * <p> * This parses the specified FpML root element, using the map of references. * The FpML specification uses references to link one part of the XML to another. * For example, if one part of the XML has {@code <foo id="fooId">}, the references * map will contain an entry mapping "fooId" to the parsed element {@code <foo>}. * * @param fpmlRootEl the source of the FpML XML document * @param references the map of id/href to referenced element * @return the parsed trades * @throws RuntimeException if a parse error occurred */ public List<Trade> parseTrades( XmlElement fpmlRootEl, Map<String, XmlElement> references) { FpmlDocument document = new FpmlDocument(fpmlRootEl, references, ourPartySelector, tradeInfoParser, refData); List<XmlElement> tradeEls = document.getFpmlRoot().getChildren("trade"); ImmutableList.Builder<Trade> builder = ImmutableList.builder(); for (XmlElement tradeEl : tradeEls) { builder.add(parseTrade(document, tradeEl)); } return builder.build(); }