Examples of JSONJAXBContext


Examples of com.sun.jersey.api.json.JSONJAXBContext

*/
public class SchemaExtensibilityTest extends TestCase {

    public void testExtensibility() throws Exception {
        String baseXml = JSONTestHelper.getResourceAsString("com/sun/jersey/json/impl/rim/", "LightningDataset.xml");
        JSONJAXBContext jsonContext = new JSONJAXBContext(JSONConfiguration.natural().build(), "com.sun.jersey.json.impl.rim");

        Unmarshaller jaxbUnmarshaller = jsonContext.createUnmarshaller();
        Object fromXml = jaxbUnmarshaller.unmarshal(new StringReader(baseXml));

        StringWriter sw = new StringWriter();

        jsonContext.createJSONMarshaller().marshallToJSON(fromXml, sw);
        String jsonRepresentation = sw.toString();

        System.out.println(jsonRepresentation);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.