What is XML?
- XML stands for Extensible Markup Language.
- XML is a markup language much like HTML.
- XML was designed to carry the data but not to display it.
- XML tags are not predefined. You must define your own tags.
- XML is designed to be self-descriptive.
Why XML is popular?
- Our machines are now only capable of processing requirements of this data format.
- It supports data processing, data storage, and bandwidth requirements for the exchange of XML documents.
- Driving force for the use of a technology, like XML, is the desire to exchange information in Open Systems or Open Software.
- Development of the internet.
XML
- XML is text (Unicode) based; Takes up less space; Can be transmitted efficiently.
- 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.
- XML documents can be modularized and its parts can be reused.
SGML (Standard Generalized Markup Language)
- Forefather of all markup languages.
- In 1969, it Introduced the notion that data processing and document processing could be one and the same thing.
- Introduced the notion of a generalized document format.
- SGML specification can communicate between systems.
- Provides DTD specification to improve the standard of the document.
Example of an HTML Document
- <html>
- <head><title>Example</title></head.
- <body>
- <h1>This is an example of a page.</h1>
- <h2>Some information goes here.</h2>
- </body>
- </html>
OUTPUT
Write the HTML code in notepad and save it with .html extension(EX:sample.html). Click the file to run in the browser.
Example
- <?xml version=“1.0”/>
- <mymessage>
- <message> Welcome to XML </message>
- </mymessage>
An XML document contains one root element and its child elements.
Example of an XML Document
- <?xml version=“1.0”/>
- <address>
- <name>Alice Lee</name>
- <email>[email protected]</email>
- <phone>212-346-1234</phone>
- <birthday>1985-03-22</birthday>
- </address>
Demo
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
- 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.
- HTML tags are used for display while the XML tags are used to describe the documents and the data.
Benefits of XML
- Simplifies Data Sharing.
- Simplifies Data Transport.
- Simplifies Platform Changes.
- Separates Data from HTML.
- Makes Your Data More Available.
- Represents the information and the metadata about the information.
- XML is referred as future-proof or loosely coupled, since it has the capability of separating process and data content.
- XML is used to create new internet languages.
- An XML document is said to be well-formed if it follows all the rules.
- An XML parser is used to check that all the rules have been obeyed.
- Parser is a software to process XML Document.
- It reads the XML Document, Checks its syntax, reports errors and allows programmatic access to documents contents.
- XML document is considered well formed if the syntax is correct.
- Single root, start and end tag, attribute values in quotes.
- Recent browsers such as Internet Explorer 5 and Netscape 7 come with XML parsers.
- Parsers are also available for free download over the Internet. One is Xerces, from the Apache open-source project.
- Java 1.4 also supports an open-source parser.
Advantages of xml over sgml
- Though XML is using most of the functionality in SGML, it provides a number of distinct advantages.
- XML permits well-formed documents to be parsed without the need for a DTD, whereas SGML implementations require some DTD for processing
- XML is much simpler and more permissive in its syntax than SGML.
- Implementation of SGML over the internet is more difficult than in XML.
Advantages of XML over HTML (and differences)
- XML is not a replacement for HTML.
- XML and HTML were designed with different goals:
- XML was designed to transport and store data, with focus on what data is.
- HTML was designed to display data, with focus on how data looks.
- HTML is about displaying information, while XML is about carrying information.
Advantages of xml over EDI(Electronic Data Interchange)
- XML requires less cost for data transaction and maintenance than EDI (which uses Millions of dollars for transactions).
- XML uses Internet for data exchange whereas EDI over Internet does not meet much success.
- XML has many built in components like validity checking, data mapping, Extensible style sheet etc.,
- XML supports internationalization and localization but EDI doesn’t provide it.
Drawbacks of XML
- XML is huge – takes lot of space to represent data (3 to 20 times greater than file formats).
- XML editors often lack the detail and helpfulness found in common EDI editors.
Validity
- A well-formed document has a tree structure and obeys all the XML rules.
- A particular application may add more rules in either a DTD (document type definition) or in a schema.
- Many specialized DTDs and schemas have been created to describe particular areas.
- These range from disseminating news bulletins (RSS) to chemical formulas.
- DTDs were developed first, so they are not as comprehensive as schema.
Thanks for reading.