Introduction To XML

What is XML?
  1. XML stands for Extensible Markup Language.
  2. XML is a markup language much like HTML.
  3. XML was designed to carry the data but not to display it.
  4. XML tags are not predefined. You must define your own tags.
  5. XML is designed to be self-descriptive.
Why XML is popular?
  1. Our machines are now only capable of processing requirements of this data format.
  2. It supports data processing, data storage, and bandwidth requirements for the exchange of XML documents.
  3. Driving force for the use of a technology, like XML, is the desire to exchange information in Open Systems or Open Software.
  4. Development of the internet.
  1. XML is text (Unicode) based; Takes up less space; Can be transmitted efficiently.

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

  3. XML documents can be modularized and its parts can be reused.
SGML (Standard Generalized Markup Language)
  1. Forefather of all markup languages.
  2. In 1969, it Introduced the notion that data processing and document processing could be one and the same thing.
  3. Introduced the notion of a generalized document format.
  4. SGML specification can communicate between systems.
  5. Provides DTD specification to improve the standard of the document.
Example of an HTML Document
  1. <html>  
  2. <head><title>Example</title></head.  
  3. <body>  
  4. <h1>This is an example of a page.</h1>  
  5. <h2>Some information goes here.</h2>  
  6. </body>  
  7. </html>  

Write the HTML code in notepad and save it with .html extension(EX:sample.html). Click the file to run in the browser.

  1. <?xml version=“1.0”/>  
  2. <mymessage>  
  3. <message> Welcome to XML </message>  
  4. </mymessage>  
An XML document contains one root element and its child elements.

Example of an XML Document
  1. <?xml version=“1.0”/>  
  2. <address>  
  3. <name>Alice Lee</name>  
  4. <email></email>  
  5. <phone>212-346-1234</phone>  
  6. <birthday>1985-03-22</birthday>  
  7. </address>  

The XML code will be written in the XML copy editor. Save it at any location (EX:text.xml). Click it and open in the browse.
output(The XML program output)


Difference Between HTML and XML 
  1. HTML tags have a fixed meaning and browsers know what it is while the XML tags are different for different applications, and users know what they mean.

  2. HTML tags are used for display while the XML tags are used to describe the documents and the data.
Benefits of XML
  1. Simplifies Data Sharing.
  2. Simplifies Data Transport.
  3. Simplifies Platform Changes.
  4. Separates Data from HTML.
  5. Makes Your Data More Available.
  6. Represents the information and the metadata about the information.
  7. XML is referred as future-proof or loosely coupled, since it has the capability of separating process and data content.
  8. XML is used to create new internet languages.
Well-Formed Documents
  1. An XML document is said to be well-formed if it follows all the rules.
  2. An XML parser is used to check that all the rules have been obeyed.
  3. Parser is a software to process XML Document.
  4. It reads the XML Document, Checks its syntax, reports errors and allows programmatic access to documents contents.
  5. XML document is considered well formed if the syntax is correct.
  6. Single root, start and end tag, attribute values in quotes.
  7. Recent browsers such as Internet Explorer 5 and Netscape 7 come with XML parsers.
  8. Parsers are also available for free download over the Internet. One is Xerces, from the Apache open-source project.
  9. Java 1.4 also supports an open-source parser.
Advantages of xml over sgml
  1. Though XML is using most of the functionality in SGML, it provides a number of distinct advantages.
  2. XML permits well-formed documents to be parsed without the need for a DTD, whereas SGML implementations require some DTD for processing
  3. XML is much simpler and more permissive in its syntax than SGML.
  4. Implementation of SGML over the internet is more difficult than in XML.
Advantages of XML over HTML (and differences)
  1. XML is not a replacement for HTML.
  2. XML and HTML were designed with different goals:
  3. XML was designed to transport and store data, with focus on what data is.
  4. HTML was designed to display data, with focus on how data looks.
  5. HTML is about displaying information, while XML is about carrying information.
Advantages of xml over EDI(Electronic Data Interchange)
  1. XML requires less cost for data transaction and maintenance than EDI (which uses Millions of dollars for transactions).
  2. XML uses Internet for data exchange whereas EDI over Internet does not meet much success.
  3. XML has many built in components like validity checking, data mapping, Extensible style sheet etc.,
  4. XML supports internationalization and localization but EDI doesn’t provide it.
Drawbacks of XML
  1. XML is huge – takes lot of space to represent data (3 to 20 times greater than file formats).
  2. XML editors often lack the detail and helpfulness found in common EDI editors.
  1. A well-formed document has a tree structure and obeys all the XML rules.
  2. A particular application may add more rules in either a DTD (document type definition) or in a schema.
  3. Many specialized DTDs and schemas have been created to describe particular areas.
  4. These range from disseminating news bulletins (RSS) to chemical formulas.
  5. DTDs were developed first, so they are not as comprehensive as schema.
Thanks for reading.