O'Reilly logo

XForms Essentials by Micah Dubinko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A Real-World Example

As an example, this section will develop an XForms solution for creating and editing a UBL purchase order. The first step is to define the initial instance data, which is a skeleton XML document that contains the complete structure of the desired final document, but with only initial data. This document serves as a template for newly-created purchase orders, and provides a framework on which to hang the rest of the form.

Tip

This complete example form is available online at http://dubinko.info/writing/xforms/ubl/.

Example 2-1 shows what a UBL purchase order document looks like. Figure 2-1 shows, in the X-Smiles browser, an XForms document capable of creating such a document.

An XML purchase order being created with XForms

Figure 2-1. An XML purchase order being created with XForms

Example 2-1. An XML purchase order using UBL

<Order xmlns="urn:oasis:names:tc:ubl:Order:1.0:0.70" xmlns:cat="urn:oasis:names:tc:ubl:CommonAggregateTypes:1.0:0.70"> <cat:ID/> <cat:IssueDate/> <cat:LineExtensionTotalAmount currencyID="USD"/> <cat:BuyerParty> <cat:ID/> <cat:PartyName> <cat:Name/> </cat:PartyName> <cat:Address> <cat:ID/> <cat:Street/> <cat:CityName/> <cat:PostalZone/> <cat:CountrySub-Entity/> </cat:Address> <cat:BuyerContact> <cat:ID/> <cat:Name/> </cat:BuyerContact> </cat:BuyerParty> <cat:SellerParty> <cat:ID/> <cat:PartyName> <cat:Name/> </cat:PartyName> <cat:Address> <cat:ID/> <cat:Street/> <cat:CityName/> <cat:CountrySub-Entity/> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required