We could also have multiple purchase orders in a single XML document

28.1 XML

The most famous data exchange format over the years has been the XML markup language. The XML document contains the data to be transferred, and the XML language defines the structure of the document. Most programming languages have the capability, either built-in or as an add-on, to work with XML data.

For example, if we have a source program developed in .Net, there are libraries available for .Net that can construct XML documents. These XML documents would then be sent to the destination program. If the destination program is in Java, it would have its own libraries to dissect the XML documents.

A sample XML document is given below.

<PurchaseOrder PurchaseOrderNumber="101">

<Address Type="Shipping">

<Name>Mark</Name>

<Street>123 Street</Street>

</Address>

<Items>

<Item Part="123">

<ProductName>Shaver</ProductName>

<Quantity>1</Quantity>

<USPrice>18.95</USPrice>

</Item>

</PurchaseOrder>

The XML document is similar to an HTML document which has tags. You might notice that the document is structured in a way that makes it easy to break into logical segments. So in our document above we have a purchase order, an address, an item, and the details of the item. We could also have multiple purchase orders in a single XML document.

28.2 JSON

JSON stands for JavaScript Object Notation, and is an extremely popular format for transmitting data between programs. With JSON objects are transmitted as simple key value pairs. An example of a JSON document is given below.

Popular posts from this blog

Best exercise for abortion

THIS IS ONE OF THE NEATEST THINGS ABOUT ARRAYS

how to secretly track a cell phone location for free