XML

7
visit @ http://www.infotechcomputer.in INFOTECH Computer Education, Kishangarh (Raj) 9829171122 Page 1 Chapter 13 - XML Q1. What is EDI ? Ans. EDI stands for Electronic Data Interchange. In it data to be shared first assembled and then transformed in the EDI standard format using a specific software. In E-Commerce all of the transaction are performed using EDI. Q2. What is XML ? Ans. XML stands for Xtensible Markup Language. it is a set of rules/tags just like HTML that define the structure and format of text while presenting text in a records like structure. Q3. What is a meta language ? Ans. A meta language is a language that is used to define other language. XML is a meta language. Q4. What is a Markup Language Ans. A markup language is a set of rules/tags that define a strucutre and format to represent text. it is called markup language bcoz we write it within <> symbols. Q5. What is Meta Data Ans. Data about Data is called Meta data. Q6. Write Full forms of the following a. SGML b. HTML c. XML d. WML e. EDI Ans. a. Standard Generalized Markup Language b. Hyertext Markup Language c. Extensible Markup Language d. Wireless Markup Language e. Electronic Data Interchange

description

Chapter 13 - Sumita AroraCBSE Informatics Practices

Transcript of XML

Page 1: XML

visit @ http://www.infotechcomputer.in

INFOTECH Computer Education, Kishangarh (Raj) 9829171122 Page 1

Chapter 13 - XML

Q1. What is EDI ?

Ans.

EDI stands for Electronic Data Interchange. In it data to be shared first assembled and then transformed

in the EDI standard format using a specific software. In E-Commerce all of the transaction are performed

using EDI.

Q2. What is XML ?

Ans.

XML stands for Xtensible Markup Language. it is a set of rules/tags just like HTML that define the

structure and format of text while presenting text in a records like structure.

Q3. What is a meta language ?

Ans.

A meta language is a language that is used to define other language. XML is a meta language.

Q4. What is a Markup Language

Ans.

A markup language is a set of rules/tags that define a strucutre and format to represent text. it is called

markup language bcoz we write it within <> symbols.

Q5. What is Meta Data

Ans.

Data about Data is called Meta data.

Q6. Write Full forms of the following

a. SGML b. HTML c. XML d. WML e. EDI

Ans.

a. Standard Generalized Markup Language

b. Hyertext Markup Language

c. Extensible Markup Language

d. Wireless Markup Language

e. Electronic Data Interchange

Page 2: XML

visit @ http://www.infotechcomputer.in

INFOTECH Computer Education, Kishangarh (Raj) 9829171122 Page 2

Important Differences

1. XML vs SGML

XML SGML

XML is newer language than SGML SGML is older generic markup language.

XML is based on SGML SGML is first markup language

XML is called Xtensible Markup Language SGML is called Standard Generalized Markup Lang.

New tags can be created Not possible

2. XML vs HTML

XML HTML

XML is called Xtensible Markup Language HTML is called Hypertext Markup Language

New tags can be created Not Possible

It is a document reprentation language it is a web page layout design language

It is necessary to close each tag few tags of HTML does not have closing tag

XML is case sensitive HTML is not case sensitive

XML is not viewable indepently HTML document can be viewed independently

3. XML vs EDI

XML EDI

It does not requires costly technology costly technology is required

New tags can be created Not Allowed

XML documents can be easily implemented Not easy implementation

XML is platform Independent Low platform independency

Features of XML

1. It is designed to carry data, not to display data

2. XML does not do anything itself

3. XML is designed to be self descriptive language

4. XML is free and extensible

5. XML is platform Independent

6. XML can seperate data from HTML

7. XML can be used to create new languages like ADML, BrainML, GML, WML etc.

8. XML is a W3C recommendation

XML Structure

1. A style sheet presentation through CSS or XSL

2. A grammar structure throught DTD

3. Semantics of data through XML file

Naming Rules in XML

1. Names in XML must start either with a letter or underscore

Page 3: XML

visit @ http://www.infotechcomputer.in

INFOTECH Computer Education, Kishangarh (Raj) 9829171122 Page 3

2. Rest of the name can consist of letters, digits, underscore character, the dot or hyphen

3. Spaces are not allowed in names

4. XML is case sensitive

5. Names cant start with a string xml. it is a reserved keyword

6. By convention HTML elements in XML are written in uppercase, and XML elements are written in

lowercase.

Q7. Question. Create a XML Document to represent the data of following table

Student

---------------------------------------------------------------------------

roll name class sec city

----------------------------------------------------------------------------

101 ram xi a ajmer

102 shyam xii b jaipur

103 kalu x a kishangarh

Ans.

<studentdata>

<student>

<roll>101</roll>

<name>ram</name>

<class>xi</class>

<sec>a</sec>

<city>ajmer</city>

</student>

<student>

<roll>102</roll>

<name>shyam</name>

<class>xii</class>

<sec>b</sec>

<city>jaipur</city>

</student>

<student>

<roll>103</roll>

<name>kalu</name>

<class>x</class>

<sec>a</sec>

<city>kishangarh</city>

</student>

</studentdata>

Page 4: XML

visit @ http://www.infotechcomputer.in

INFOTECH Computer Education, Kishangarh (Raj) 9829171122 Page 4

Q8. What is XML Document System and what are its components ?

Ans. XML document system is the way to process a xml document on the web in a desired manner. it

has three main components

a. CSS or XSL - Cascading Style Sheet or Xtensible Style Sheet

b. DTD - Document Type Defination

c. Semantics (rules)

Q9. What is InkML ?

Ans.

It is a popular Markup Language. it provides a simple and platform neutral data format to promote the

interchange of digital ink between software applications. All content of a InkML document is contained

whthin a single <ink> element. The fundamental data element in an InkMl file is the trace

In the simplest form an INKML file looks like this

<ink>

<trace>

2344,56,68,56,344,2,45,45,34,56,68,78

</trace>

<trace>

34,4,6,89,78,45,23,23,565,8,89,56,34,23

</trace>

</ink>

Q10. What is RecipeML

Ans.

It is a popular markup language for representing recipes on computer. for e.g if we want to represent

the following recipe -

Tea

* 1 cup water

* 2 cup milk

* 1 teaspoon tea

* 2 teaspoon sugar

* 5 gr ginger

place 1 cup water into canister

boil it for 5 minutes

add 2 cup milk

boil it for 2 minutes

add 1 teaspoon tea and 2 teaspoon sugar

boil it for 2 minute

add 5 gr ginger

boil for 1 minute

Page 5: XML

visit @ http://www.infotechcomputer.in

INFOTECH Computer Education, Kishangarh (Raj) 9829171122 Page 5

<recipe>

<head>

<title>Shahi Indian Tea</title>

</head>

<ingredients>

<ing>

<name>water</name>

<qty>1 cup</qty>

</ing>

<ing>

<name>Milk</name>

<qty>2 cup</qty>

</ing>

<ing>

<name>Tea Powder</name>

<qty>1 spoon</qty>

</ing>

<ing>

<name>Sugar</name>

<qty>2 spoon</qty>

</ing>

<ing>

<name>Ginger</name>

<qty>5 gram</qty>

</ing>

</ingredients>

<directions>

<step>place 1 cup water into canister</step>

<step>boil it for 5 minutes</step>

<step>add 2 cup milk </step>

<step>boil it for 2 minutes</step>

<step>add 1 teaspoon tea and 2 teaspoon sugar</step>

<step>boil it for 2 minute</step>

<step>add 5 gr ginger</step>

<step>boil for 1 minute</step>

</directions>

</recipe>

Q11. What is prolog ?

Ans.

It is a preface or introduction to the XML document. It has five types of components

Page 6: XML

visit @ http://www.infotechcomputer.in

INFOTECH Computer Education, Kishangarh (Raj) 9829171122 Page 6

a. An XML Declaration b. Processing Instructions

c. Document Type Declaration d. Comments

e. White space

Q12. What is DTD ?

Ans. The grammar rules for creating a XML Document are called DTD. it begins with !Doctype

Declaration. A Sample DTD is <!doctype Animals system="WIDAnim.dtd">

Q13. What are comments?

Ans.

Comments are the additional descriptive statemens that are not processed by XML parsers. they are

used to add notes about document structure or to break a document into sections.

comments in XML or HTML starts with <!-- ........ -->

Q14 What is a Element ? explain following types of elements ?

a. root element b. child element

Ans.

Elements are means to define individual data items. An element begins with a start tag and ends with an

end tag. The parent element of all other elements in data instance is known as root element or

document element. The elements nested inside other elements are called the child elements.

for eg.

<employee>

<name>ramkumar</name>

<code>235</code>

<address>

<hno>34/4a</hno>

<city>Ajmer</city>

</address>

</employee>

In the above example EMPLOYEE is root element

Name , code , address are child elements of employee

hno, city are child elements of address element

Q15. What are XML Naming rules ?

Ans.

1. Names in XML must start with a letter or underscore

2. name can contain leters, digits, dot, hyphen or underscore

3. spaces are now allowed in names

4. xml is case sensitive

5. names cannot start with string "xml"

Page 7: XML

visit @ http://www.infotechcomputer.in

INFOTECH Computer Education, Kishangarh (Raj) 9829171122 Page 7

Q16. What is a attribute in XML ?

Ans. Attributes are the properties of elements for example

<account type="saving">

here type is an attribute of element account

Q4. What is a Well formed document

Ans. The XML document that obeys XML grammar rules is called well formed document

Properties of a Well formed docuemnt

1. at least one element

2. unique opening and closing tag

3. tags must be closed properly

4. tags must be nested properly

5. attribute values must be quoted

Q17. What is a Valid Document

Ans. A Valid XML document is one that is well formed as well as confirms to the DTD schema of the

document

Properties of a Valid document

1. Must be a well formed document

2. Follows its DTD (document type defination)

3. Validation can be done only if th XML document has valid DTD

Q18. What is CSS ?

Ans.

CSS stands for Cascading Style Sheet. it is a collection of formatting rules that control appearance of

content in a web page.

Advantages of XML

1. It is easy than HTML

2. It is fully compatible with various applications like JAVA, Asp.net and other languages

3. It is extremely Portable Language

4. We can create our own tags, that is whey it is extremely expandable language

5. It is platform Independent language

6. It can be deployed on any network.

7. Size of a XML document is very small

8. XML can represent hierarchically rich data in plain text

9. It represents and store the data in a very easy and human readable format

10. It can be used to share data over wide variety of networks.