XML is a markup language that allows data to be stored and transmitted in a structured, hierarchical manner. It has similarities in markup style to HTML, but whereas HTML has a fixed list of element definitions and is designed primarily to allow you to define how a document should be displayed, XML elements may be defined within a particular XML document to suit the data being described there.
In common with HTML, markup elements (normally referred to as tags) enclosed by < and > are used to annotate the contents of a text file, describing the information it contains.
Unlike the tags in HTML, though, whose definitions are fixed, XML tags can be defined to be anything you want, allowing you to describe virtually any kind of data. Consider this example of an XML document:
This short XML document describes a yacht race, including the two competing yachts and their respective personnel. Note how the tag names are descriptive of the data they contain, and how the tag structures are hierarchical.You may also notice that XML tags, like those of HTML, can also have attributes. The end effect is that the XML file is quite readable—that is, the meaning of the data may be readily inferred by a human reader.
XML Document Structure
The permitted structure of an XML document has only one mandatory element, the so-called document element. In the preceding yacht race example, this would be the <race> element.
Document Prolog ;
Other information may be optionally included before the document element, forming the document’s prolog. An example is the XML declaration:
The prolog may also contain, in addition to various comments and rocessing instructions, a Document Type Declaration.
Document Type Declaration
The optional Document Type Declaration (often referred to as a DOCTYPE declaration) is a statement of the permitted structure of an XML document. It usually contains (or refers to another file that contains) information about the names of the elements in the document and the relationships between those elements.
Let’s look at an example Document Type Declaration for the yacht race document:
This declaration, which would appear in the document before the <race> element, specifies that the document element will be called <race> and that document structure definitions may be found in an external file, race.dtd, which would perhaps contain something like the following:
Alternatively, this information could be quoted in the DOCTYPE Declaration itself, placed between [ and ] characters:
In either case we define four elements—namely, race, yacht, skipper, and helm—and one attribute list.
declares that the <race> element will contain elements of type <yacht>, whereas the + character indicates that there may be any number of occurrences from one upward of such <yacht> elements. Alternatively, we could use the character * to indicate any number of occurrences including zero, or the character ? to indicate zero or one occurrence. The absence of all of these characters indicates that there should be exactly one <yacht> element within <race>.
The <yacht> element is declared to contain three further elements,<name>, <skipper>, and <helm>. The #PCDATA term contained in thedeclarations for those elements stands for parsed character data and indicates that these elements must contain character-based data and may not contain further elements. Other possible content types include MIXED (text and elements) and ANY (any valid content).
Attribute List Declarations
Our example also contains the line
Such declarations are used to specify what attributes are permitted or required for any given element. In our example, we specify that the<yacht> element has an attribute called raceNo, the value of which is comprised of #CDATA (character data).
The term #REQUIRED indicates that, in this example, the <yacht> element must have such an attribute. Other possibilities include #IMPLIED, specifying that such an attribute is optional; #DEFAULT followed by a value in quotation marks, specifying a default value for the attribute should none be declared in the XML document; or #FIXED followed by a value in quotation marks, fixing the value of the attribute to that quoted.
If an XML document contains a DOCTYPE Declaration and compliesfully with the declarations it contains, it is said to be a valid XML document.
AJAX Related Interview Questions
|XML Interview Questions||HTML Interview Questions|
|Java Script Interview Questions||Android Interview Questions|
|CSS Interview Questions||Web Developer Guide Interview Questions|
|XSLT Interview Questions||Java XML Interview Questions|
|XML DOM Interview Questions|
Anatomy Of A Website
Writing Web Pages In Html
Sending Requests Using Http
Server-side Programming In Php
A Brief Introduction To Xml
Anatomy Of An Ajax Application
The Xmlhttprequest Object
Talking With The Server
Using The Returned Data
Our First Ajax Application
Returning Data As Text
Ahah-asynchronous Html And Http
Returning Data As Xml
Web Services And The Rest Protocal
Web Services Using Saop
The Prototype.js Toolkit
Using Xoad 193
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.