Creating New Elements

In this section, you will look at two reasons why you might need to create new elements.

In some transformations, the element names in the source document and the corresponding element name in the output document differ. For example, suppose that a company based in the United States is doing business with a company based in the United Kingdom. The U.S. company wants to place an order for white shirts. In the United States, the company might describe a white shirt, using this:

<Color>white</Color> 

The U.K. company might use this line, however:

<Colour>white</Colour> 

Only one letter is different in the element type name, but that is enough to trip up an XML parser.

Consider also that you might want to create a new element ...

Get Sams Teach Yourself XML in 10 Minutes 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.