Contents:
a. …………………. is the extension of an XML file name.
ans: .xml
b. XML attribute value should always be enclosed in ………………….
ans: double quotes
c. An XML document can only have one …………………. element.
ans: parent
d. Some characters that have a special meaning in XML are called ………………….
ans: entity
e. PCDATA stands for Parsed …………………. Data.
ans: Character
a. An XML document can have only a limited number of child elements.
ans: False
b. XML is not case sensitive.
ans: False
c. XML is designed to replace HTML.
ans: False
d. XML is a software and hardware dependent language used for carrying information.
ans: True
e. XML was developed as per W3C’s recommendation.
ans: True
a. Which one of the following is a valid name for an XML element?
i. <xmldocument>
ii.. <12rollno>
iii. <customer number>
iv. <student>
ans: iv. <student>
b. Which of the following is the correct element type declaration for the occurrence of the ‘FirstName’ element and the ‘LastName’ element in order, as the child element of the ‘Name’ Element?
i.<!ELEMENT Name (FirstName)>
<!ELEMENT Name (LastName)>
ii.<!ELEMENT Name (FirstName, LastName )>
iii. <!ELEMENT Name (FirstName | LastName )>
iv. <!ELEMENT Name (FirstName / LastName )>
ans: iii. <!ELEMENT Name (FirstName | LastName )>
c. Which of the following is used to specify the attribute list of an element?
i. #ATTLIST
ii. !ATLIST
iii. *ATTLIST
iv. ?ATTLIST
ans: ii. !ATLIST
d. The characters associated with elements that control how many times an element may appear in the XML document are
i. ?
ii. *
iii. +
iv.all of these
ans: iv.all of these
e. The statement for associating external DTD declaration with ‘item.dtd’ is
i. <!DOCTYPE “item.dtd”›
ii. <!DOCTYPE SYSTEM “item.dtd”›
iii. <!DOCTYPE item SYSTEM “item.dtd”›
iv. <!DOCTYPE root SYSTEM “item.dtd”›
ans: iii. <!DOCTYPE item SYSTEM “item.dtd”›
a. What is DTD? List the two types of DTD?
ans: DTD stands for Document Type Definition. A DTD provides a list of elements contained in an XML document and their relationship with one another
The two types of DTD are: (1) Internal DTD & (2) External DTD
b. What is an XML parser? Define the two types of XML parsers.
ans: XML parser is a software that reads an XML document, identifies all the XML tags, and passes the data to various applications (interprets or parses the code according to the XML standard). The two types of XML parser are:
(1) Non-validating XML parser: It checks if an XML document is well-formed, i.e., if the document is properly marked up according to XML syntax rules. All browsers are non-validating XML parsers. A few other examples are OpenXML, Lark, XP, expat, XParse, and xmllib.
(2) Validating XML parser: It checks if an XML document is well-formed and also ensures that all elements in the document are exactly as specified in the DTD to which the document is bound, i.e., it checks the validity of the XML document. A few examples of validating XML parser are XML4C, XML4J, MSXML, ,Tc1XML, and xmlproc.
c. What does an attribute list declaration contain?
ans: The attribute list declaration contains the following information:
• The element to which an attribute is associated
• The name of the attribute
• The type of the attribute
• The default value of the attribute
d. What are the four default values of an attribute?
ans: The for default values of an attribute are:
• REQUIRED: The value of the attribute must be supplied.
• IMPLIED: The XML application decides which value of the attribute to use if no value is supplied.
• FIXED: The value of the attribute is included in the declaration itself. The XML document must either supply the same value or nothing.
• SUPPLIED: The DTD supplies the default value of the attribute if it is not provided in the XML document. If the value is supplied, the supplied value is used.
e. What is an entity? What are its two types?
ans: An entity is a sequence of characters used to represent another sequence of characters. There are some characters that have special interpretations in XML. For example, the greater than (>) and less than (<) characters are used to delimit tags and, therefore, cannot be placed inside the data directly.
There are two types of entities:
• Pre-defined entity
• User-defined entity
a. List five differences between HTML and XML.
ans:
| HTML | XML |
1. | The static text content is placed between the tags and is never modified by any process. | The data is stored in a separate XML file and can be updated with a few lines of JavaScript. |
2. | No document structure is present. | The document structure is like a tree. The root element is the parent of all other elements. |
3. | HTML tags are pre-defined. | XML tags are user-defined. |
4. | There are empty tags in HTML. | In XML, to satisfy the requirement for a pair of tags, the opening and closing tags are combined. |
5. | Tags are not case-sensitive. | Tags are case-sensitive. |
6. | The attribute values can be written without quotes, with single quotes(‘) or with double quotes(“) | The attribute value should be surrounded by double quotes only |
b. What are the rules for defining a well-formed XML document?
ans: A well-formed XML document must meet the following requirements:
1) The ‘root’ and ‘child’ elements must be nested in a proper way.
2) Each start tag must have the corresponding end tag.
3) All empty tags must be enclosed properly.
4) As XML tags are case-sensitive, the start and end tags must be of the same spelling and case.
5) XML’s attribute values are enclosed within double quotation marks.
c. Explain the difference between comma and pipe symbols in deciding how child elements are used within an XML document.
ans: Using the comma (,) symbol the elements must appear strictly in the order in which they are defined in the element declaration.
Whereas, using the pipe (|) symbol, the elements may appear one or more times in any order.
d. What is the difference in using the character ?(question mark), *(asterisk), and +(plus) to control how many times an element appears in the XML document?
ans: • ? (Question mark) This symbol indicates that an element may not appear at all or may appear once in the XML document (0 or 1).
• * (Asterisk) This symbol indicates that an element may not appear at all or may appear any number of times in the XML document (0 or many).
• + (Plus) This symbol indicates that an element must appear at least once or any number of times in the XML document (1 or many).
e. Explain the four variations in specifying the value of an attribute by using an example each.
ans: The four default values of an attribute are:
• REQUIRED: The value of the attribute must be supplied.
• IMPLIED: The XML application decides which value of the attribute to use if no value is supplied.
• FIXED: The value of the attribute is included in the declaration itself. The XML document must either supply the same value or nothing.
• SUPPLIED: The DTD supplies the default value of the attribute if it is not provided in the XML document. If the value is supplied, the supplied value is used.
Examples:
Attribute Type Declaration in DTD code:
XML Code:
1. Draw the XML tree for the code given below:
3. Write any two possibilities of the XML document validated against the DTD given below:
4. Consider the XML document and answer the following questions:
a. What is the use of the first line of code?
ans: The first line is called the processing instructions line. It passes specific information to the browser on how to deal with the XML document.
b. Name the element that has an attribute in the above code?
ans: The customer element has an attribute in the above code
c. Name the root element in the code.
ans: <customer> is the root element in the code.
d. List the child elements of <address>.
ans: The child elements of <address> are <addl>, <city> and <country>
5. Consider the XML code given below and answer the questions following it:
a. How many elements are present in the above code?
ans: Three elements are present in the above code.
b. How many attributes are there in the above code? Name them.
ans: Only one attribute is there in the above code. It is the category attribute.
Marketing is a multifaceted discipline, often categorized into various specialized areas to achieve specific goals.…
In today’s fast-paced business landscape, efficient document management is critical for success. Traditional methods of…
Duplicate and plagiarized content works like a Trojan horse. You think it's a blessing, but…
In today’s fast-paced and dynamic social media environment, having a social media account with high…
In the early days of the web, static websites were common. They presented repetitive material,…
Are you ready to publish your work online? Wait a second! Is your content unique…
View Comments
Tq soo much .. I got much help from this website ..
Thank you so much, it means a lot for us. As a support gesture you can spread the word with your friends. You can also share your view at google here – https://g.page/r/Ca8xfSF3B8QrEAg/review