use of org.springframework.oxm.xstream.XStreamMarshaller in project cia by Hack23.
the class UnmarshallXmlTest method unmarshallTest.
/**
* Unmarshall test.
*
* @throws Exception
* the exception
*/
@Test
public void unmarshallTest() throws Exception {
final String content = "abcdefg";
final String xmlContent = "<string>" + content + "</string>";
File temp;
temp = File.createTempFile("UnmarshallXmlTestTempFile", ".xml");
final OutputStreamWriter bw = new OutputStreamWriter(new FileOutputStream(temp), StandardCharsets.UTF_8);
bw.write(xmlContent);
bw.close();
final XStream xstream = new XStream();
xstream.alias("TestXml", TestXml.class);
assertEquals(content, unmarshallXml(new XStreamMarshaller(), temp.getAbsolutePath()));
}
use of org.springframework.oxm.xstream.XStreamMarshaller in project tutorials by eugenp.
the class WebConfig method createXmlHttpMessageConverter.
private HttpMessageConverter<Object> createXmlHttpMessageConverter() {
final MarshallingHttpMessageConverter xmlConverter = new MarshallingHttpMessageConverter();
final XStreamMarshaller xstreamMarshaller = new XStreamMarshaller();
xmlConverter.setMarshaller(xstreamMarshaller);
xmlConverter.setUnmarshaller(xstreamMarshaller);
return xmlConverter;
}
Aggregations