XML(Extensible Markup Language)
What is XML?
XML, a text-based markup language developed by the W3C used to describe the structure of data. XML, a metalanguage, used to describe other languages is becoming a fast standard for information interchange on the web. XML is a subset of the Standardized Generalized Markup Language (SGML). Unlike HTML, the tags in XML are not predefined, rather user can create custom, self-descriptive tags related to that context. XML allows data to be displayed in different ways according to the tags specified.
Importance of XML
- XML is free and tags are unlimited.
- XML file can be created using a simple text editor; No separate software is required.
- With XML, any complex data structures like news feeds, invoices etc., can be defined in a easy manner.
- XML do not specify the way to display the data instead tells the type of data.
- XML is style-free, which provides flexibility in producing output in some new format like html, pdf etc.
- XML is a emerging standard for information interchange between different computer systems.
Parts of a XML file
XML file consists of four parts namely, XML Document(Content), XML Document Type Definition(DTD), XML Parser(Conformity Checker) and XML Application. XML document in turn consists of five Classes; Elements, Entities, Comments, Processing Instructions and CData Definitions.
XML File - Example
<?xml version="1.0"?>
<class>
<student type="regular">
<name>Carl</name>
<id>20014917</id>
<grade>A</grade>
</student>
<student type="lateral">
<name>Mark</name>
<id>20054917</id>
<grade>D</grade>
</student>
</class>
XML File Example - Explanation
- <?xml version="1.0"?> - refers to Processing Instructions.
- Each student as a whole refers to the document.
- Student is a parent element; Name, Id, Child are child elements of student element Student.
- Type is an attribute.
- XML parser is one which reads and validates a XML document.
- Text placed inside a XML parser will be ignored by a parser. Syntax of CDATA section is included between "<![CDATA[" and "]]>".