Listing 4.1 shows an example of an XML document that holds details on a request for insurance coverage.
Listing 4.1: Sample XML document
<?xml version="1.0" encoding="ISO-8859-1"?> <!- policy request -> <Insured Customer> <CarPolicy PolicyType="Auto"> <Vehicle Category="Sedan"> <Make>Honda</Make> <Model>Accord</Model> </Vehicle> <Vehicle Category="Sport"> <Make>Ford</Make> <Model>Mustang</Model> </Vehicle> </CarPolicy> <CarPolicy PolicyType="Antique"> <Vehicle Category="Sport"> <Make>Triumph</Make> <Model>Spitfire</Model> </Vehicle> </CarPolicy> </Insured>
When you create an XML document, you use a vocabulary, which is a set of terms that are organized in a way that reflects the data used in your business. Each tag name (such as Vehicle) is a reserved word only in the narrow context of your application, company, or industry.
Data that conforms to an XML format is handled by an XML processor, also called an XML engine. The processor is software that
is invoked by other software
identifies units of information in the XML-formatted input
provides that information for some purpose such as
to display the data, as occurs when you launch an XML file with a recent browser
to convert the data to another format, as occurs when an SOA runtime product invokes a SOAP engine
to construct a runtime service implementation, as occurs when you invoke a Business Process Execution Language (BPEL) engine
XML benefits the business developer in several ways:
XML allows development of specialized vocabularies that reduce the cost of business-to-business interaction. Widely used vocabularies include ACORD (for the insurance industry) and IFX (for the financial-services industry).
You can process data with ease because of the many software products that support XML. A product might provide text searches and editing capability or might transform text from one XML vocabulary into another.
XML provides mechanisms for validating the data, including technologies such as Document Type Definition (DTD), XML Schema Definition (XSD), RELAX NG, and Schematron. This book focuses on XSD because in many cases an SOA runtime product uses that technology to validate transmitted data.
An XML document is clear to the human reader. The content is simple text rather than a stream of binary characters and is relatively self-documenting, showing data values as well as relationships. In our example, a customer is requesting two policies, and each policy includes details on specific cars.