@Override public void marshal(Object graph, Result result) throws XmlMappingException, IOException { super.marshal(graph, result); try { StaxTestUtils.getXmlEventWriter(result).close(); } catch (Exception e) { throw new RuntimeException("Exception while writing to output file", e); } }
@Override public void marshal(Object graph, Result result) throws XmlMappingException, IOException { try { StaxTestUtils.getXmlEventWriter(result).add(XMLEventFactory.newInstance().createComment(graph.toString())); } catch ( Exception e) { throw new RuntimeException("Exception while writing to output file", e); } }
@Override public void marshal(Object graph, Result result) throws XmlMappingException, IOException { Assert.isInstanceOf( Result.class, result); try { StaxTestUtils.getXmlEventWriter( result ).add( XMLEventFactory.newInstance().createStartElement(namespacePrefix, namespace, graph.toString())); StaxTestUtils.getXmlEventWriter( result ).add( XMLEventFactory.newInstance().createEndElement(namespacePrefix, namespace, graph.toString())); } catch ( Exception e) { throw new RuntimeException("Exception while writing to output file", e); } }
@Override public void marshal(Object graph, Result result) throws XmlMappingException, IOException { Assert.isInstanceOf(Result.class, result); try { XMLEventFactory factory = XMLEventFactory.newInstance(); XMLEventWriter writer = StaxTestUtils.getXmlEventWriter(result); writer.add(factory.createStartDocument("UTF-8")); writer.add(factory.createStartElement("prefix", "namespace", graph.toString())); writer.add(factory.createEndElement("prefix", "namespace", graph.toString())); writer.add(factory.createEndDocument()); } catch ( Exception e) { throw new RuntimeException("Exception while writing to output file", e); } }