Package org.apache.xmlbeans.samples.substitutiongroup.easypo

Examples of org.apache.xmlbeans.samples.substitutiongroup.easypo.NameAddress


        PurchaseOrderDocument.PurchaseOrder purchaseOrderElement = poDoc.getPurchaseOrder();

        InvoiceHeaderDocument.InvoiceHeader invHeaders = purchaseOrderElement.addNewInvoiceHeader();

        // Assign values to the newly created invoice-header element.
        NameAddress shipto = invHeaders.addNewShipTo();
        shipto.setName("New Company");
        shipto.setAddress("NewTown, NewCity");

        NameAddress billto = invHeaders.addNewBillTo();
        billto.setName("New Company");
        billto.setAddress("NewTown, NewCity");
       
        // Create a new Book and add it to the invoice.
        BookType book = BookType.Factory.newInstance();
        book.setId(1000);
        book.setTitle("Where the Red Fern Grows");
        invHeaders.setProduct(book);
        XmlCursor cursor = invHeaders.getProduct().newCursor();
        cursor.setName(new QName("http://xmlbeans.apache.org/samples/substitutiongroup/easypo", "book"));
        cursor.dispose();

        // Creating a new comment - with substitution group member bill-comment element.
        invHeaders.setComment("This is a new bill-comment");
        cursor = invHeaders.xgetComment().newCursor();
        cursor.setName(new QName("http://xmlbeans.apache.org/samples/substitutiongroup/easypo", "bill-comment"));
        cursor.dispose();

        // Add another invoice-header.
        invHeaders = purchaseOrderElement.addNewInvoiceHeader();

        // Assign values to the newly created invoice-header element.
        shipto = invHeaders.addNewShipTo();
        shipto.setName("Other Company");
        shipto.setAddress("OtherTown, OtherCity");

        billto = invHeaders.addNewBillTo();
        billto.setName("Other Company");
        billto.setAddress("OtherTown, OtherCity");

        // Create a new Clothing and add it to the invoice.
        ClothingType clothing = ClothingType.Factory.newInstance();
        clothing.setId(2000);
        clothing.setColor(ClothingType.Color.BLUE);
View Full Code Here

TOP

Related Classes of org.apache.xmlbeans.samples.substitutiongroup.easypo.NameAddress

Copyright © 2018 www.massapicom. 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.