Search in sources :

Example 1 with OrderDocument

use of org.apache.axiom.ts.om.document.xmlbeans.OrderDocument in project webservices-axiom by apache.

the class TestGetSAXResultXMLBeans method runTest.

@Override
protected void runTest() throws Throwable {
    OrderDocument document = OrderDocument.Factory.newInstance();
    Order order = document.addNewOrder();
    order.setCustomerId("73107481");
    Item item = order.addNewItem();
    item.setPartId("P85-137-19");
    item.setQuantity(2);
    item = order.addNewItem();
    item.setPartId("O85-554-66");
    item.setQuantity(1);
    StringWriter out = new StringWriter();
    document.save(out);
    OMDocument omDocument = metaFactory.getOMFactory().createOMDocument();
    ContentHandler handler = omDocument.getSAXResult().getHandler();
    document.save(handler, (LexicalHandler) handler);
    assertAbout(xml()).that(xml(OMDocument.class, omDocument)).hasSameContentAs(out.toString());
}
Also used : Order(org.apache.axiom.ts.om.document.xmlbeans.OrderDocument.Order) Item(org.apache.axiom.ts.om.document.xmlbeans.OrderDocument.Order.Item) OrderDocument(org.apache.axiom.ts.om.document.xmlbeans.OrderDocument) StringWriter(java.io.StringWriter) ContentHandler(org.xml.sax.ContentHandler) OMDocument(org.apache.axiom.om.OMDocument)

Aggregations

StringWriter (java.io.StringWriter)1 OMDocument (org.apache.axiom.om.OMDocument)1 OrderDocument (org.apache.axiom.ts.om.document.xmlbeans.OrderDocument)1 Order (org.apache.axiom.ts.om.document.xmlbeans.OrderDocument.Order)1 Item (org.apache.axiom.ts.om.document.xmlbeans.OrderDocument.Order.Item)1 ContentHandler (org.xml.sax.ContentHandler)1