@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { FIXMLRoot root = (FIXMLRoot) source; writer.addAttribute("v", root.getVersion()); writer.addAttribute("r", root.getReleaseDate()); writer.addAttribute("s", root.getSchemaDate()); context.convertAnother(root.getMessage()); }
public Message toFIX(String fixml) { if (!initialized) { initialize(); } FIXMLRoot root = (FIXMLRoot) xstream.fromXML(fixml); return root.getMessage(); }
@Override public FIXMLRoot unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { FIXMLRoot root = new FIXMLRoot(); root.setVersion(reader.getAttribute("v")); root.setReleaseDate(reader.getAttribute("r")); root.setSchemaDate(reader.getAttribute("s")); if (reader.hasMoreChildren()) { reader.moveDown(); root.setMessage((Message) context.convertAnother(root, Message.class)); reader.moveUp(); } return root; }