Forums

FpML Discussion

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • daveboden
    Spectator

    Worked around the issue by resorting to using XPath to separately pull out the trade identifiers. Sun’s implementation of JAXB probably won’t ever support this schema; please see my comments on the JAXB bug. Here’s an overview of the workaround: private final NamespaceContext namespaceContext = new MarkitServNamespacePrefixMapper(); //When receiving a message: NodeList messages = (NodeList)xpath.evaluate(“/env:Envelope/env:Body/mtc:OTC_Matching/*”, new InputSource(new StringReader(fpml)), XPathConstants.NODESET) if(messages != null && otcMatchings.size() != 0) { if(messages.getLength() != otcMatchings.size()) { throw new RuntimeException( String.format(“Error – JAXB reported %d sub-messaages but XPath reported %d”, otcMatchings.size(), messages.getLength() ) ); } } Then a method to pull out the ID based on scheme: private String parseId(Node message, String idScheme) { XPath xpath = xpathThreadLocal.get(); String matchId; try { matchId = xpath.evaluate(“//fpml:tradeReferenceInformation/fpml:partyTradeIdentifier/fpml:tradeId[@tradeIdScheme='” + idScheme + “‘]”, message); } catch (XPathExpressionException ex) { throw new RuntimeException(“Error parsing id of type: ” + idScheme, ex); } return matchId; }

Viewing 1 post (of 1 total)