Why is XML an extensive mark-up language?

0

The HTML and XML documents contain data using tags, but this is the only resembling fact about the two languages. For HTML, the tags are used to define the aspect and stile of data, the lines are here, the paragraph begins here, and so. The tags are used to establish the structure and the signification of data.

If you need to establish the structure and the signification of a set of dates, you would make it possible to reuse them in any way. For example, if you have a set of commercial data and every element from the block is identified clearly, you can load only the needed elements in a sales report, and you could load the accounting data from a database. This way, you can utilize a system to generate data and to mark them with XML tags, processing the data in any other system. This portability made XML one of the most popular technologies to exchange data.

 

As you continue, don’t forget the next aspects:

  • It is not possible to use HTML instead of XML. However, XML data can be closed with HTML tags to be displayed in a web page.
  • HTML is limited to a predefined set of tags
  • XML allows creating any kind of tags used to describe data and the structure of it. For the moment, let’s suppose it is necessary to stock information about pets.

Create the next HTML code:

<?xml version="1.0"?>
<DOG>
  <NAME>Lassie</NAME>
  <BREED>German Sheppard</BREED>
  <AGE>4</AGE>
  <ALTERED>yes</ALTERED>
  <DECLAWED>no</DECLAWED>
  <LICENSE>Yourname</LICENSE>
  <OWNER>John Frank</OWNER>
</DOG>

You can see that XML tags give you the possibility to identify the exact types of data you are consulting. As an example, if you know that this is information about a dog, and you can find out the name of the dog, amongst other aspects. This ability to create special tags, which would define almost any structure, makes the XML extensible.

Don’t confuse those tags from this example with the ones from a HTML file. As an example, if this XML structure is put in a HTML structure, the browser will give you the next information:

Lassie German Sheppard 4 yes no Yourname John Frank

 

A few words about data integrity

Maybe you heard somebody from your IT department talking about “good” XML. A good XML file is conform to a set of strict rules that governs the XML language. If a file does not comply with these rules, the XML would not work. As an example, the previous code has an opening and a closing tag, so the example is conformed to the rules. If you eliminate one single tag and you are trying to open the file in an Office document, you will get and error message and the program will not be able to use the file.

It is not necessary to know the rules of a correct XML code (they are easy to understand), but it is better to remember that XM data could be shared between programs and tags only if they are correctly formed. If you can’t open an XML file, there are chances that the file would not be correctly formulated.

 

Leave a Reply

Your email address will not be published. Required fields are marked *