Introduction to XML
(Questions and Answers)
Answer: XML is short for Extensible Markup Language, which describes a document. It is a text-based markup language that allows storing data in a structured format. It is also a type of metalanguage.
XML is a markup language like HTML. But XML is different from HTML in the sense that HTML describes how to display and format the data text and images in the browser whereas XML is used to describe the data.
To store self-describing data, XML allows us to create our own tags.
Q2: Is XML structured language or unstructured?
Answer: Structured language
Q3: What is a meta-language?
Answer: A Meta Language is a language that is used to define another language.
Q4: What are the two components of an XML document? Explain by giving an example?
Answer: To store self-describing data, XML allows us to create our own tags or elements. There are two main parts to an XML document: elements and attributes.
Elements, also sometimes referred to as nodes, are the backbone of XML and are what is used to describe the structure.
The attribute goes on an element and can help describe that element.
Example: Here is a record of an employee stored as XML document. Tags <id>, <name>, <department> <dob> are the elements. While "category" is an atrribute of <department> element.
<day>, <month> and <year> are the child elements of <dob> elements.
<?xml version="1.0" encoding="UTF-8"?> <employee> <id>1001</id> <name> Amit Gupta </name> <department catgegory="management"> Accounts </department> <dob> <day>1</day> <month>10</month> <year>1998</year> </dob> </employee>
In addition to elements and attributes, an XML document may contain Style Sheet (CSS or XSL) and Grammar Structure (DTD).
Q5: What is 'XML prolog'?
Answer: The first line in the code is the XML declaration which should always be included. This is called the 'XML prolog'. The prolog in this example specifies that the XML code confirms to version 1.0 of the XML standard, and the encoding scheme used is "UTF-8".
<?xml version="1.0" encoding="UTF-8"?>
Q6: What are the features of XML?
Answer: Features of XML are as follows:
1. XML is Free.
2. XML can be used to store data. The application can be written to store and retrieve information.
3. XML is extensible. XML allows the user to create his own tags and documents structure.
4. XML is W3C recommendation.
5. XML is platform independent.
1. XML is Free.
2. XML can be used to store data. The application can be written to store and retrieve information.
3. XML is extensible. XML allows the user to create his own tags and documents structure.
4. XML is W3C recommendation.
5. XML is platform independent.
Q7: What are the advantages of XML?
Answer:
Advantages of XML:
1. It is easy as HTML.
2. It is fully compatible with an application like Java.
3. It is a portable language. It can be used on a network with multiple platforms.
4. It is platform independent.
5. It is extensible language. You can create your own tags and document structure.
Q8: Differentiate between HTML and XML?
Answer:
SN | HTML | XML |
---|---|---|
1. | HTML document formats and displays web pages data. | XML documents carry data along with their description. |
2. | HTML tags are predefined. | XML tags are not predefined. You can create and define new tags as per your needs. |
3. | HTML tags may not have a closing tag. | XML tags must have a closing tag. |
4. | HTML tags are not case-sensitive. | XML tags are the case – sensitive. |
5. | HTML documents are directly viewable in a browser. | XML documents can be viewed only if proper style sheet file is also available along with XML file. |
Q9: What is the Style Sheet (CSS or XSL)?
Answer: A XML Document is intended to display data like HTML. An XML document system may comprise of another document called Style Sheet (CSS or XSL), which defines the style (How it would appear i.e. font,
colour, size alignment etc.) of the elements.
Q10: What is DTD?
Answer: DTD stands for Data Type Definition. It is the 'Grammar Structure' of an XML document. It is an optional component in the XML document system and defines the Rules of the document (Tag/element and attribute definitions).
Q11: What is XSLT?
Answer: XSLT stands for Extensible Stylesheet Language. An XSLT file is an XML document that
transforms an XML document into HTML document or XML document or any other document format (including simple text file).
See also:
Informatics Practices - Solved Sample Question Paper with Marking Scheme(2017-18)
Informatics Practices - Sample Question Paper + Marking Scheme (2018-19)
Networking (Q & A)
Networking - Data Transmission Media (Q & A)
Informatics Practices (2016-17) - Delhi Region - Question Paper
Database Concepts (Important Terms)
Java - Inheritance (Q & A)
IT Applications (Q & A)
SQL Commands (Summary)
HTML Basics (1 Mark Based Q & A)
What is XML? (Q & A)
No comments:
Post a Comment
We love to hear your thoughts about this post!
Note: only a member of this blog may post a comment.