Ticker

6/recent/ticker-posts

Click Here

What is XML? It's Uses, Advantages and Disadvantages with examples | Quicky Tech

Introduction to XML

XML stands for eXtensible markup language. A markup language is a set of codes, or tags, that describes the text in a digital document. ... XML, a more flexible cousin of HTML, makes it possible to conduct complex business over the Internet.


Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. The World Wide Web Consortium's XML 1.0 Specification of 1998 and several other related specifications—all of them free open standards—define XML.

XML refers to EXtensible Markup Language. It is another markup language like that of HTML. The difference lies in the fact that in XML, tags are not pre-defined and one has to define his own tags. This language is self describing and uses DTD (Document Type Definition) to describe its data.

00

The major difference between both the languages is that XML was designed to describe data and HTML was designed to display data. Therefore, we can say that XML acts as a complement for HTML.

XML language uses certain set of rules for encoding documents that can be read by both humans and machines.

XML stands for eXtensible Markup Language. XML is a markup language much like HTML. XML was designed to store and transport data. XML was designed to be self-descriptive.

Instead, you define your own tags designed specifically for your needs. This is a powerful way to store data in a format that can be stored, searched, and shared. Most importantly, since the fundamental format of XML is standardized, if you share or transmit XML across systems or platforms, either locally or over the internet, the recipient can still parse the data due to the standardized XML syntax.

There are many languages based on XML, including XHTML, MathML, SVG, XUL, XBL, RSS, and RDF. 


Why Study XML?

  • XML plays an important role in many different IT systems.
  • XML is often used for distributing data over the Internet.
  • It is important (for all types of software developers!) to have a good understanding of XML.

What is XML?

  • XML stands for extensible Markup Language. A markup language is used to provide information about a document.
  • Tags are added to the document to provide the extra information.
  • HTML tags tell a browser how to display the document.
  • XML tags give a reader some idea what some of the data means.

Uses of XML:

  • XML stands for eXtensible Markup Language.
  • XML was designed to store and transport data.
  • XML was designed to be both human- and machine-readable.
  • XML is used in web development.
  • XML can Separate Data from HTML   XML is Used to Exchange Data.
  • XML Can be Used to Share Data.
  • XML Can be Used to Store Data.
  • XML can Make your Data More Useful.
  • It is used as a base language for communication protocols like XMPP. It is also used to interchange data from one computer to another through internet.
  • It has become default format for many office productivity tools like Microsoft Office.

Tags in XML:

Tags in XML language can be expressed in three ways:
1. Start tag as <section>;
2. End tag as </section>; and
3. Empty element tag as <line-break />.

These tags are the markup construct that begins with < and ends with >. Tags come in  above three flavors.

 XML Example for a note containing simple reminder from Sam to Tom.

<note>
<to>Tom</to>
<from Sam</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

Advantages of XML:

  • XML is text (Unicode) based.
        - Takes up less space. 
        - Can be transmitted efficiently.

  • One XML document can be displayed differently in different media. - Html, video, CD, DVD,
        - You only have to change the document in order to change all the  rest.

  •  XML documents can be modularized. Parts can be reused.

Disadvantages of XML:


  • XML syntax is verbose and redundant compared to other text-based data transmission formats such as JSON.
  • The redundancy in syntax of XML causes higher storage and transportation cost when the volume of data is large.
  • XML document is less readable compared to other text-based data transmission formats such as JSON.


Character:

  • An XML document is a string of characters. Virtually every licit Unicode character may appear in an XML document.
  • XML documents consist entirely of characters from the Unicode repertoire. Except for a minuscule number of concretely omitted control characters, any character defined by Unicode may appear within the content of an XML document.
  • XML includes facilities for identifying the encoding of the Unicode characters that make up the document, and for expressing characters that, for one reason or another, cannot be used directly.

Processor:

The processor analyzes the markup and passes structured information to an application. The designation places requisites on what an XML processor must do and not do, but the application is outside its scope. The processor (as the designation calls it) is often referred to colloquially as an XML parser.

Element:

An element is a logical document component that either commences with a commencement-tag and ends with a matching end-tag or consists only of a vacuous-element tag. The characters between the commencement-tag and culminate-tag, if any, are the element's content, and may contain markup, including other elements, which are called child elements. 

An example is <greeting>Hello, world!</greeting>. Another is <line-break />.

Attribute:

An attribute is a markup construct consisting of a name–value pair that subsists within a commencement-tag or empty-element tag. An example is <img src="madonna.jpg" alt="Madonna" />, where the denominations of the attributes are "src" and "alt", and their values are "madonna.jpg" and "Madonna" respectively.

 Another example is <step number="3">Connect A to B.</step>, where the designation of the attribute is "number" and its value is "3". An XML attribute can only have a single value and each attribute can appear at most once on each element. In the prevalent situation where a list of multiple values is desired, this must be done by encoding the list into a well-composed XML attribute[i] with some format beyond what XML defines itself. Customarily this is either a comma or semi-colon delimited list or, if the individual values are kenned not to contain spaces,[ii] a space-delimited list can be utilized. <div class="inner greeting-box">Welcome!</div>, where the attribute "class" has both the value "inner greeting-box" and additionally denotes the two CSS class names "inner" and "greeting-box".


XML declaration:

XML documents may commence with an XML declaration that describes some information about themselves. An example is <?xml version="1.0" encoding="UTF-8"?>.


XML Example 1

<?xml version="1.0" encoding="UTF-8"?>
<note>
  <to>Tove</to>
  <from>Jani</from>
  <heading>Reminder</heading>
  <body>Don't forget me this weekend!</body>
</note>
 

XML Example 2

<?xml version="1.0" encoding="UTF-8"?>
<breakfast_menu>
<food>
    <name>Belgian Waffles</name>
    <price>$5.95</price>
    <description>
   Two of our famous Belgian Waffles with plenty of real maple syrup
   </description>
    <calories>650</calories>
</food>
<food>
    <name>Strawberry Belgian Waffles</name>
    <price>$7.95</price>
    <description>
    Light Belgian waffles covered with strawberries and whipped cream
    </description>
    <calories>900</calories>
</food>
<food>
    <name>Berry-Berry Belgian Waffles</name>
    <price>$8.95</price>
    <description>
    Belgian waffles covered with assorted fresh berries and whipped cream
    </description>
    <calories>900</calories>
</food>
<food>
    <name>French Toast</name>
    <price>$4.50</price>
    <description>
    Thick slices made from our homemade sourdough bread
    </description>
    <calories>600</calories>
</food>
<food>
    <name>Homestyle Breakfast</name>
    <price>$6.95</price>
    <description>
    Two eggs, bacon or sausage, toast, and our ever-popular hash browns
    </description>
    <calories>950</calories>
</food>
</breakfast_menu>



What is XML Utilized For?

XML is one of the most widely-used formats for sharing structured information today: between programs, between people, between computers and people, both locally and across networks.

A short example:

<part number="1976">
  <name>Windscreen Wiper</name>
  <description>The Windscreen wiper
    automatically abstracts rain
    from your windscreen, if it
    should transpire to splash there.
    It has a rubber <ref part="1977">blade</ref>
    which can be authoritatively mandated discretely
    if you require to supersede it.
  </description>
</part>

 

If you are already habituated with HTML, you can visually perceive that XML is very homogeneous. However, the syntax rules of XML are rigorous: XML implements will not process files that contain errors, but instead will give you error messages so that you fine-tune them. This designates that virtually all XML documents can be processed reliably by computer software.





The main differences from HTML are:

All elements must be closed or marked as vacuous.

  • Empty elements can be closed as mundane, <ecstasy></ecstasy> or you can utilize a special short-form, <jubilance /> instead.
  • In HTML, you only need to quote an attribute value under certain circumstances (it contains a space, or a character not sanctioned in a denomination), but the rules are hard to recollect. In XML, attribute values must always be quoted.
  • In HTML there is a built-in set of element names (along with their attributes). In XML, there are no built-in names (albeit names starting with xml have special designations).
  • In HTML, there is a list of some built-in character names like é for é but XML does not retain this. In XML, there are only five built-in character entities: <, >, &, " and ' for <, >, &, " and ' respectively. You can define your own entities in a Document Type Definition, or you can utilize any Unicode character (optically discern next item).
  • In HTML, there are withal numeric character references, such as & for &. You can refer to any Unicode character, but the number is decimal, whereas in the Unicode tables the number is conventionally in hexadecimal. XML withal sanctions hexadecimal references: & for example.

XML has a number of advantages over many other formats. For any particular scenario, you might be able to come up with a better format, but then you would have to include costs of converting and processing your format, and of training, and of the XML-categorical editing and probing implement that are now very widely available. Some of the advantages of XML include:

1. Redundancy:

XML markup is very verbose. For example, every terminus tag must be supplied, such as </description> in the example. This lets the computer catch mundane errors such as erroneous nesting.

2. Self-describing:

The readability of XML (it is a text-predicated format) and the presence of element and attribute names in XML designates that people optically canvassing an XML document can often get a head start on understanding the format (and it additionally avails people to find mistakes!)


3. Network effect and the XML Promise:

Any XML document can be read and processed by any XML implement whatsoever. Of course, some XML implements might want categorical XML markup, but the XML format itself can be read by any XML parser: you can't verbally express, this XML document is only to be processed by such-and-such an implement.

This betokens that every incipient XML document increases the value of every other XML document, and of every XML implement, and every incipient XML implement increases the value of every XML document and hence of every other implement. Today, XML is the most widely-used format of its kind anywhere in the world.

Examples:

XML is very widely used today. It is the substructure of a great many standards such as the Macrocosmic Business Language (UBL); of Macrocosmic Plug and Play (UPnP) utilized for home electronics; word processing formats such as ODF and OOXML; graphics formats such as SVG; it is utilized for communication with XMLRPC and Web Accommodations, it is fortified directly by computer programming languages and databases, from giant servers all the way down to mobile telephones.


If you double-click an icon on your computer desktop (the icon may well have been drawn with SVG), chances are that an XML message is sent from one component of the desktop to another. If you take your car to be rehabilitated, the engine's computer sends XML to the mechanic's diagnostic systems. It is the age of XML: it is ubiquitous.


Related Queries:

    If you got to know anything from this article. So you can like this article.

     And if you find anything bad in this article. Or do you want to improve anything in this article. You comment in the comment box of this article. So that we can improve our upcoming articles To visit the Website at last Thanks. 

    Thanks You again for Visiting our Website. Please Visit Again.

    Quicky Tech

    Post a Comment

    0 Comments