XML (Extensible Markup Language) is another markup language (like HTML), but unlike HTML it is not styled, and solely used to store and transport data.
Although there are various standards based on XML e.g. RSS which come with their own set of tags/rules, XML on its own allows the developer to invent/come up with his own tags, as long as the basic ‘tree’ structure is preserved.
All XML documents must follow the node structure as explain below, where everything is contained within a single root element, the root element may contain any number of branches and leaves and where every inner branch may contain more branches and leaves. As long as this structure is maintained the resulting XML document will be valid.
<root>
<branch>
<leaf>content</leaf>
</branch>
</root>
As you can see XML is a very flexible yet efficient way of storing any data structure, I’ve created a simple XML document describing a list of customers, each holding one or more accounts.
I have also validated the XML document at http://validator.w3.org/
XML in the real world
The use of XML is so widespread that it’s actually hard to draw a line and just discuss a few every day uses.
1. Web services
A clear example of extensive use of XML are web services, web services allow any system irrelevant of what language or platform it runs on to interact with any other system which supports web services through the HTTP protocol. The interaction between both systems is done entirely through XML.
- Starting with the wsdl (Webservice Definition Language)– an XML document which describes the service’s endpoints. It simply lists all method calls available through the webservice as well as the inputs and outputs of each endpoint.
- Request/Response – All communication done to and from the webservice is contained within XML.
Had it not been for XML we wouldn’t have any of the flexibility offered through web services.
2. Object serialisation
Any POJO (plain old java object) can be serialised directly into XML, which can then be later stored in a database, text file etc… It is also highly effective when used in conjunction with web services, because if you can marshal an object directly into XML you can actually forward the entire serialised object through the webservice just like you would with any other method.
3. RSS
RSS (Really Simply Syndication) is also extensively used now with all this craze going on around blogs, every blogging platform I know of supports RSS natively, it is an XML standard used to publish articles, it comes with a standard set of XML tags such as date, author, title and post. This enabled the content to be picked up by crawlers and robots to be syndicated over the internet. RSS is one of the main contributors to the fast response to news event we see online.
Although XML can be seen everywhere, I still believe that it’s still in its infancy with innovations cropping up every other day, we still have to yet realise the true potential of this simple but efficient way of storing and forwarding data between systems.
0 comments:
Post a Comment