CLASS X
CHAPTER-11 XML
I.
A. Fill ups:-
1. HTML,XML
2. Data
3. .xml
4. User
5. XML
B. True or False:-
1.True
2.False
3.True
4.False
5.True
C. MCQ:-
1.(d)both a and c.
2.(d)both a and c
3.(b)markup language
4.(c)<!--This is my
comment-->
5.(c)the document should have a DTD
II.
A. Very short answers:-
1. Extensible Markup Language
2. The XML document structure is
like a tree. It has a root element, which is the parent of all other elements.
An element can have sub-elements or child elements.
3.'The white spaces are not
truncated' is XML.
4.It is a sequence of characters
used to represent other sequence of characters.
5.The two types of DTD are as
follows:-
a. Internal DTD
b. External DTD
B. Short Answers:-
1. XML was created so that richly
structured documents could be used over the web and to overcome the problems
associated with HTML.
2.<!--It stores a record-->
3.An XML element is everything from
the element's start tag to the element's end tag, including the start tag, end
tag and the content.
4. DTD stands for Document Type
Definition. It provides a list of the elements contained in an XML document and
their relationships to one another.
5. XML Parser is a software that
reads an XML document, identifies all the XML tags, and passes the data to
various applications.
C. Long answers :-
1. Naming rules for XML are the
following:
(a) Names can contain letters, numbers
and other characters.
(b) Element names cannot start with
a number or punctuation character.
(c) They cannot start with the
letters xml (or Xml,XML,etc.)
(d) ELEMENT names cannot contain
spaces.
2.
DATA SEPARATION:- In HTML,the static text
content is placed between tags and is never modified by any process.In XML,
data is stored in a separate XML file and can be updated with a few lines of
JAVA script.
DATA SHARING:- XML provides a way
of sharing data that is independent of the software and hardware used. Such
independence makes the data available to more users. In HTML data is a part of
the .html document. It is not store separately and therefore such sharing of
data is not possible.
DOCUMENT STRUCTURE:- The XML
document structure is like a tree. It has a root element, which is the parent
of all other elements. An element can have sub-elements or child elements. In HTML, such a document structure is not
present.
TAGS:-
In XML, tags are user-defined. In
HTML, they are predefined.
In XML, every opening tag must have
a corresponding closing tags. Tags are paired in HTML too, but in some cases
pairing is optional.
In XML, a nested tag pair can't
overlap with another tag. In HTML, tags may appear without satisfying the rules
of proper nesting.
In XML tag names are case
sensitive. In HTML tags are not case sensitive.
ATTRIBUTE:- In HTML, we can change
the background color by BGCOLOR attribute, text color by TEXT attribute, link
color by LINK attribute, visited link color by VLINK attribute, and active link
color ALINK attribute. In XML, all elements can have associative attributes
which specify their characteristics.
ATTRIBUTE VALUE:-In HTML, the
attribute value can be written without quotes, with double quotes or with single quotes. In XML, the attribute
value should be surrounded by double quotes.
3. Requirements for well-formed XML
document are:-
(1) the root and child elements must be
nested in a proper way.
(2) each start tags must have a
corresponding end tag.
(3)
all empty tags must be enclosed properly.
4. The two types of DTD are: -
A. Internal DTD - it is contained within the document. It defines the
components of only 1 document, the one in which it is included.
B. External DTD - it is a separate file
that defines the elements and other document components of the current XML
document.
5. The two types of XML Parser are:
-
(a) Non-validating XML Parser: it checks
whether an XML document is well-formed, i.e., if the document is properly
marked up according to XML syntax rules.
(b) 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.
D. Applications based questions: -
1.
a. <message>
b. <from>, <to>, <subject>
and < body>
c.<name>, <telephone>and<
residence>
2.
a. In this, <? xml
version="1.0"?>. Is the processing instruction. A processing
instruction gives instructions to the application.
b. <car ID ="S1">
<model
color="Blue"> Santro CS </ model>
c. Yes.
3. <?xml
version="1.0"?>
<!DOCTYPE salarydata
[
<! ELEMENT data (code, name, salary)>
<! ELEMENT code (# PCDATA)>
<! ELEMENT name ( # PCDATA)>
<! ELEMENT salary (# PCDATA)>
]>
<code>E001</code>
<name>Deepa Chugh</name>
<salary>19000</salary>
<code>E002</code>
<name>Parth Jain</name>
<salary>22500</salary>
4.
a.
Club
|
Member
______________|________________
| | |
No name charges
b.
hostel
|
__________________________________
| |
groundfloor
firstfloor
|
|
____________
________________
| | | |
room rent room rent
5. a. <clubdetails>
b. There is only one child element
and it is <member>.
c. It signifies that atleast once
or any time should appear.
d. Name ID has an attribute with it
and that is REQUIRED.
e. The ',' sign signifies that the
element should appear strictly in the order in which they are defined in the
element declaration.
f. If you will change',' sign to
'|' then, the elements first were strictly in order but now they may appear
only once or more than once.
6. <?xml
version="1.0"?>
<!DOCTYPE student[
<!ELEMENT student(
lastname,firstname*,dob?,gender,(sc|st)?)>
<!ELEMENT lastname (#PCDATA)>
<!ELEMENT firstname
(#PCDATA)>
<!ELEMENT dob (#PCDATA)>
<!ELEMENT gender (#PCDATA)>
<!ELEMENT sc (#PCDATA)>
<!ELEMENT st (#PCDATA)>
<lastname>Jaiswal</lastname>
<firstname>ram</firstname>
<firstname>madan</firstname>
<gender>male</gender>
<sc>SCHEDULED CASTE</sc>