Changing an Attribute to an Element

Due to the different ways in which people think about data, you are very likely to see the same item of data treated as an Attribute in one XML document and as an Element in someone else's idea of the same business document. In those types of situations you'll need to convert data between Elements and Attributes.

Here is a fairly common example. Most purchase orders list both a quantity and a unit of measure for a product item. Suppose that our order management system has the capability to import a purchase order in XML. Suppose that the designers decided to depict unit of measure and quantity as separate Elements in an overall line item Element. Suppose further that someone sends us a purchase order coded ...

Get Using XML with Legacy Business Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.