What is XML

What is XML?

Table of Contents

XML (Extensible Markup Language) acts as a mode of communication between different applications to transport and store data. Java contains various libraries that are used to parse, modify, or inquire about the XML documents.

XML Documents consist of elements similar to HTML, and each element has a starting tag, content, and ending tag. XML consists of one root element which encloses all the other elements inside it. XML is a case sensitive language, and XML files are hierarchical.

Basic Example:

<?xml version="1.0"?>
<!-- This is a comment -->
<address>
    <name>ABC</name>
    <street> GT </street>
    <telephone number= "0123"/>
</address>

Features of XML:

  1. XML is a markup language.
  2. XML is also a tag-based language similar to HTML, but the tags are not predefined in XML.
  3. You can define your tags in XML. Hence it is also said to be an extensible language.
  4. W3C recommends XML.
  5. XML is a platform-independent language.
  6. No programming is required to modify the data, and thus look and feel of the documents can be easily changed.
  7. XML is a future-oriented language.

Uses of XML:

  1. Web Publishing: With the help of XML, you can create interactive web pages and creating e-commerce applications. In XML, you need to store data only once, and then this content can be used for different viewers or devices.
  2. Web Searching and automating Web Tasks: XML makes it easy to return useful information while searching the web. Web Agents and Robots (programs that are used to automate Web Searches.)
  3. General Applications: XML makes it easy for general applications to use, store, transmit, and display data.
  4. E-business Applications: XML helps in more accessibility of EDI (electronic data interchange) that is used for information interchange, business-to-business transactions, and business-to-consumer transactions.
  5. Metadata Applications: With the help of XML, it becomes easy to express metadata in a reusable and portable format.
  6. Pervasive Computing: It provides structured and portable information to display on wireless devices like PDAs (Personal Digital Assistants), cellular phones, and others.

Advantages of XML:

  1. XML is technology independent. Any technology can use XML for storing and parsing the data.
  2. XML is readable and easy to understand.
  3. Custom tags are very easy to create and use in XML.
  4. XML can be easily validated using XSD and DTD.

Disadvantages of XML:

  1. XML contains lots of redundant data.
  2. XML is a verbose language, so its file size increases the transmission and storage costs.

Technologies Related to XML:

TechnologyMeaningDescription
XHTMLExtensible HTMLThis is developed to make HTML more extensible and inter-operability with other data.
XML DOMXML Document Object ModelThis is used to access and manipulate XML.
XSLExtensible Style Sheet LanguageThis is used to transform XML into other formats, formatting XML to screen, paper, etc.
XQueryXML Query LanguageThis is used to query XML based data.
DTDDocument Type DefinitionThis is used to define legal elements in an XML document.
XSDXML Schema DefinitionIt is an alternative to DTD.
XLinkXML linking languageThis is used to create Hyperlinks.
XPointerXML pointer languageThis is used to address components of XML data.
SOAPSimple object access protocolThis helps to exchange information over HTTP.
WSDLweb services description languagesIt is used to describe the functionality offered by web services.
RDFweb services description languagesThis is used to describe web resources.
SVGScalable vector graphicsThis is used to support graphics and animation.
RSSReally simple syndicationThis is used to handle web content syndication.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<bookstore>

  <book category="cooking">
    <title lang="en">Everyday Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.00</price>
  </book>

  <book category="children">
    <title lang="en">Harry Potter</title>
    <author>J K. Rowling</author>
    <year>2005</year>
    <price>29.99</price>
  </book>

  <book category="web">
    <title lang="en">XQuery Kick Start</title>
    <author>James McGovern</author>
    <author>Per Bothner</author>
    <author>Kurt Cagle</author>
    <author>James Linn</author>
    <author>Vaidyanathan Nagarajan</author>
    <year>2003</year>
    <price>49.99</price>
  </book>

  <book category="web" cover="paperback">
    <title lang="en">Learning XML</title>
    <author>Erik T. Ray</author>
    <year>2003</year>
    <price>39.95</price>
  </book>

</bookstore>

8 Responses

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share this article
Subscribe
By pressing the Subscribe button, you confirm that you have read our Privacy Policy.
Need a Free Demo Class?
Join H2K Infosys IT Online Training
Enroll Free demo class