XML – Tags
XML tags are the starting and ending points of an element. They are basic things to know before we are writing a XML code. For every starting tag there should be an ending tag in the correct order.
<?xml version="1.0" encoding="UTF-8"?> <customer_list> <customer> <name> Sanjay</name> <location> Mumbai</location> </customer> <customer> <name> Micheal</name> <location> Washington</location> </customer> </customer_list>
From the above example:
we can identify the start and end tags.
<customer> - Start Tag </customer> - End Tag
Data is given between these start and end tags. If there is no data between the start and end tags, that can be called as Empty Tag.
When we are writing the XML code, we need to ensure the correct syntax and order of elements.
Below are some wrong examples:
<customer> Wrong because the end tag have Capital letter C where the starting tag have small letter c</Customer>
<customer> <Name>Hari <Location>Bangalore </Name> </Location> </customer>