Table of Contents
XML (Extensible Markup Language) is derived from Standard Generalized Markup Language (SGML) and is a text based markup language used for exchanging messages among different applications
XMl markup language is independent of platform and technology languages and primarily used to store and transfer data among systems irrespective of their hardware and software compatibilitie
The Tutorial provides the insight for XML Basics, Advanced XML, and XML tools by providing the relevant XML examples.
What is a Markup Language ?
XML being the markup language provides the certain set of rules for encoding the documents. XML is the Simple Document with representation of application data structured in the used defined self-descriptive XML tags.
Characteristics of XML
- XML is developed by World Wide Web Consortium (W3C) and is available as the Open standard.
- XML does not provide pre-defined tags like HTML
- XMl markup language is independent of platform and software and thus makes it a common and most popular way of interacting and sharing message data.
- XML provides the mechanism to store and transport data rather than how data is presented
- XML is Extensible as it provides developers to create self-descriptive tags
How XML can be useful ?
- XML can be used to store and arrange the data as per the application need
- Applications uses XML for exchanging message data among different applications
- Style Sheet can be applied to XML data
- XML uses the Public Standard and thus supported by many languages ( java,.Net, Php, Python,Perl,etc)
- XML document syntax correction can be validated using DTD or XML schema
- XML supports Unicode and thus makes it easier to communicate the information
- XML being the common standard for data exchange eliminates the data conversion issue with incompatible formats.
The below mention line should be the first line in the XML and termed as XML Prolog. This depicts the XML version and the encoding used in the XML document.
<?xml version="1.0" encoding="UTF-8"?>
XML Document is case-sensitive and thus cannot be considered Valid. In the below XML document if the <firstName>Mohit Sharma</FirstName> are not same then XML validation fails. Consider the 2nd tag, where the 1st letter is mentioned as Capital.
XML should have a open and close tag
The XML Document follows the Tree Structure where each element should have and open and close tag. This requires to ensure the correct interpretation of the XML data for each specified tag.
<student> <firstName>Mohit</firstName> <lastName>Sharma</lastName> <registered>Yes<registered> </student>
Comments in XML
The bellow syntax allows to provide comments in the XML Document.
<!-- This is just a comment -->
There is another way to comment the XML Tag
<student> <firstName>Mohit</firstName> <lastName>Sharma</lastName> <!--registered>Yes<registered--> </student>
Let’s consider the sample student XML Record. XML Records looks like a Tree structure or document where the top most element in the XML Tree is termed as the ROOT element and other element(s) are termed as CHILD element(s) also. The CHILD element could have sib-child elements.
In the below given XML Document, lets categorize the elements
root element– oracleappshelp.
Child element – student, firstName, lastName, Address,registered
Sub-Child element – street, city,state, pincode, country
<?xml version="1.0" encoding="UTF-8"?> <oracleappshelp> <student> <firstName>Mohit</firstName> <lastName>Sharma</lastName> <address> <street>347 Pitt St </street> <city>Sydney</city>city> <state>New South Wales </state> <pincode>2000</pincode> <country>Australia<country> </address> <registered>Yes<registered> </student> <student> <firstName>Rahul</firstName> <lastName>Jain</lastName> <address> <street>243 George St</street> <city>Sydney</city>city> <state>New South Wales </state> <pincode>2000</pincode> <country>Australia<country> </address> <registered>Yes<registered> </student> </oracleappshelp>