Package org.milyn.javabean.binding.xml

Examples of org.milyn.javabean.binding.xml.XMLBinding.fromXML()


    public void test() throws IOException, SAXException {
        XMLBinding xmlBinding =
                new XMLBinding().add(getClass().getResourceAsStream("POType-binding.xml")).intiailize();

        String poXML = StreamUtils.readStreamAsString(getClass().getResourceAsStream("po.xml"));
        POType po = xmlBinding.fromXML(new StringSource(poXML), POType.class);

        StringWriter writer = new StringWriter();
        xmlBinding.toXML(po, writer);

        XMLUnit.setIgnoreWhitespace(true);
View Full Code Here


    public void test_Person_binding() throws IOException, SAXException {
        XMLBinding xmlBinding = new XMLBinding().add(getClass().getResourceAsStream("config5/person-binding-config.xml"));
        xmlBinding.intiailize();

        Person person = xmlBinding.fromXML("<person name='Max' age='50' />", Person.class);
        String xml = xmlBinding.toXML(person);
        XMLUnit.setIgnoreWhitespace(true);
        XMLAssert.assertXMLEqual("<person name='Max' age='50' />", xml);

    }
View Full Code Here

        // Create and initilise the XMLBinding instance...
        XMLBinding xmlBinding = new XMLBinding().add("smooks-config.xml");
        xmlBinding.intiailize();

        // Read the order XML into the Order Object model...
        Order order = xmlBinding.fromXML(new StringSource(orderXMLMessage), Order.class);

        // Do something with the order....

        // Write the Order object model instance back out to XML...
        String outXML = xmlBinding.toXML(order)// (Note: There's also a version of toXML() that takes a Writer)
View Full Code Here

    public void test() throws IOException, SAXException {
        XMLBinding xmlBinding = new XMLBinding().add("smooks-config.xml");
        xmlBinding.intiailize();

        Order order = xmlBinding.fromXML(new StringSource(Main.orderXMLMessage), Order.class);

        assertNotNull(order);
        assertNotNull(order.getHeader());
        assertNotNull(order.getOrderItems());
        assertEquals(2, order.getOrderItems().size());
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.