XML – Nesting
XML Nested elements means the element within the element. The structure starts with root element within that another element that follows accordingly. Root element is the most outer element. Inside the root element, all the other elements mentioned can have the inner elements.
Why are we Nesting the elements ?
First of all it is the syntax which needs to be followed and it shows an order for the best identification or forming the data.
Below are the examples which shows the correct and incorrect usage of nested elements.
Example: This is Wrong
<customer> <City> <Location> </City> </Location> </customer>
Example: This is Correct
<customer> <City> <Location> </Location> </City> </customer>