What is XML? XML: Full name Extensible markup language, it is a set of rules that structured data in a representational manner. Extensible meaning- tags, markup meaning- collection of tags and XML tags indicating data content. It was designed to describe data and is a cross platform, hardware and software independent tool for exchanging information. It is readable by both machine and human.
The first version of XML "1.0" was announced by w3c in 1998. Version 1.1 came out in early 200
XML tree: With a tree structure you can say which children belong to which parents, which grandchildren belongs to which grandparents and many other relationships. Similarly XML also form a tree structure called XML tree. XML documents contain a root element this element is parent of other elements. All elements can have sub(child) elements. The parent, child and subchild are used to describe the relationships between element. All elements can have text content and attributes just like in HTML.
XML syntax: XML syntax refers to the rules that determine how an XML application cab be written. The XML syntax is very straight forward and the makes XML very easy to learn.
The following elements provides good explanation of XML syntax-
XML Declaration:- The XML declaration indicates that the document is written in XML and specifies which version of XML. The XML declaration, if included, must be on the first line of the document. The XML declaration can also specify the language encoding for the document. Generally XML uses UTF-8 encoding. Although the XML declaration is optional, it is recommended that you include it in your XML documents.
Processing Instructions:- Processing instructions began less than symbol? and end with ? greater than symbol. Processing instructions are instructions for the XML processor. The instructions to the processor is to use an external style sheet.
Root Element Opening Tag:- All XML documents must have one and only one root element. All other elements must be nested inside this root element. In other words, the root element must contain all other elements within the document. Therefore, the first tag in the document will always be the opening tag of the root element. The closing tag will always be at the bottom of the document.
Child Element and Content:- These are the elements that are contained within the root element. Elements are usually represented by an opening and closing tag. Data and other elements reside between the opening and closing tag of an element. Elements can also contain one or more attributes. An attributes is a name/value pair that you place within an opening tag, where allows you to provide extra information about an element. These are same as you have used in HTML and XHTML.
Root Element Closing Tag:- The last tag of the document will always be the closing tag of the root element. This is because all other elements are nested inside the root element.