use of org.jibx.runtime.IMarshallingContext in project kernel by exoplatform.
the class TestConfigurationService method testMarshallAndUnmarshall.
public void testMarshallAndUnmarshall() throws Exception {
String basedir = System.getProperty("basedir");
ConfigurationUnmarshaller unmarshaller = new ConfigurationUnmarshaller();
URL url = TestConfigurationService.class.getResource("../../../../configuration.xml");
Object obj = unmarshaller.unmarshall(url);
IBindingFactory bfact = BindingDirectory.getFactory(Configuration.class);
IMarshallingContext mctx = bfact.createMarshallingContext();
mctx.setIndent(2);
mctx.marshalDocument(obj, "UTF-8", null, new FileOutputStream(basedir + "/target/configuration.xml"));
}
use of org.jibx.runtime.IMarshallingContext in project kernel by exoplatform.
the class TestDataXML method testMarshallAndUnmarshall.
public void testMarshallAndUnmarshall() throws Exception {
String projectdir = System.getProperty("basedir");
IBindingFactory bfact = BindingDirectory.getFactory(XMLObject.class);
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
URL url = TestDataXML.class.getResource("../../../../object.xml");
Object obj = uctx.unmarshalDocument(url.openStream(), null);
IMarshallingContext mctx = bfact.createMarshallingContext();
mctx.setIndent(2);
mctx.marshalDocument(obj, "UTF-8", null, new FileOutputStream(projectdir + "/target/object.xml"));
}
Aggregations