Calendar orderDate = Calendar.getInstance();
orderDate.set(2004, 06, 30);
order.setOrderDate(orderDate);
Items items = factory.createItems();
order.setItems(items);
orders.getPurchaseOrder().add(order);
// Order 2
PurchaseOrder order2 = factory.createPurchaseOrder();
USAddress billTo2 = factory.createUSAddress();
billTo2.setCity("Cambridge");
billTo2.setCountry("US");
billTo2.setName("Robert Smith");
billTo2.setState("MA");
billTo2.setStreet("8 Oak Avenue");
billTo2.setZip(new BigDecimal(12345));
order2.setBillTo(billTo2);
USAddress shipTo2 = factory.createUSAddress();
shipTo2.setCity("Cambridge");
shipTo2.setCountry("US");
shipTo2.setName("Alice Smith");
shipTo2.setState("MA");
shipTo2.setStreet("123 Maple Street");
shipTo2.setZip(new BigDecimal(12345));
order2.setShipTo(shipTo2);
Calendar orderDate2 = Calendar.getInstance();
orderDate2.set(2004, 06, 30);
order2.setOrderDate(orderDate2);
Items items2 = factory.createItems();
order2.setItems(items2);
orders.getPurchaseOrder().add(order2);
File outputFile = new File(outputDir, "jaxbWrite.xml");