PDA

View Full Version : How Is XML Useful?


Dean440
06-17-2010, 03:03 AM
I've never really been able to understand how XML is useful. For processing AJAX requests and returning multiple pieces of data, you can just use JSON and for serious record storage and retrieval you can just use a database.

I know there's more to it than that. What is it actually useful for? Do you need a special parser to really make it worthwhile? And can't it be used for configuring some applications?

I would appreciate anyone who can clarify some of this for me. From what I can see (since it doesn't really even seem to be a language), it's just a means of organizing or maybe encoding hierarchies of information. Am I far off?

Dormilich
06-17-2010, 09:22 AM
From what I can see (since it doesn't really even seem to be a language), it's just a means of organizing or maybe encoding hierarchies of information. Am I far off?

yes.

XML is a Markup Language (similar to HTML) and an internationally approved standard (ref. (http://w3.org/tr/xml)). (XML @ Wikipedia (http://en.wikipedia.org/wiki/Xml))

What XML is used for, is storing data. (you can use it for configuration, since that is data too).

a point, where you would use the XML part in AJAX is inserting code chunks (not via .innerHTML, but .appendChild()) … and you don’t even have to parse it before use (which you have to do in case of JSON). also mind that not every application is able to read JSON data*, while most applications have a DOM implementation (or any other way to read XML).

* - e.g. PHP supports JSON since version 5.2, XML has been supported since PHP 4, maybe even earlier

Alex Vincent
06-17-2010, 06:31 PM
XML is actually a format intended for exchanging information. In this respect, JSON may be superior.

However, individual XML languages add a dimension of complexity and richness that JSON cannot adequately capture. For instance, MathML (a XML language) allows us to express mathematics in markup. SVG (another XML language) allows us to express graphics in markup. There's a bunch of XML languages out there, including XHTML, each of which brings a potentially unique "meaning" to the markup.

smithdylan
06-18-2010, 07:32 AM
google is prefer xml than html , the sitemap making is xml. :confused: (http://www.golfclubsseller.com/goods-165-Callaway+Legacy+Driver.html)

Dormilich
06-18-2010, 07:35 AM
hm, yes, there’s also an XML version for creating sitemaps that are intended to be read by computer programmes (like a google bot). (ref (http://www.sitemaps.org/protocol.php))

jeofjingjeff
06-21-2010, 07:06 AM
XML is the extensible markup language. XML uses tags very similar to HTML, instead of describing the structure of the page the tags, XML uses the tags to describe the data. This allows a structured data format, that can be extended without breaking previous implementations.

The best thing about XML for documentation is that the XML is easy to understand for humans, both of the actual documentation, but also the XML code surrounding it. XML can be used for any type of documentation, from a publishing house to Marketing materials.