XML

eXtensible Markup Language (XML) is a very popular data format. Ajax responses from Web services are usually returned as text or XML. It has standard native support in JavaScript via the DOM APIs and doesn't require additional parsing. Although it is still common to find data in XML format, CSV and JSON alternatives, if available, are usually smaller and easier to work with.

This is an example of an XML file with the same data as the CSV file shown earlier (Data/sample.xml):

<continents>
<continent>
<name>North America</name>
<population>579024000</population>
<area unit="km">24490000</area>
</continent>
<continent>
<name>Asia</name>
<population>4436224000</population>
<area unit="km">43820000</area>
</continent>
...
<continent>
<name>Antarctica</name>
<population>1106</population>
<area>13720000</area>
</continent>
</continents>

XML files can be validated if an XML Schema is available. You can extract data from a well-formed XML file with DOM or with XPath (which is easier). There are many tools in all languages to manipulate XML. XML is also very easy to generate. Its main disadvantage is verbosity and size.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset