‘
Students Database
Name
Address
Standard
Marks
>Internet Programming 8-39
‘ i See ee
See a seem pg onminn @ catntatens
gine ary eet
Students Database
‘
Students Database
Name
Address
Standard
Marks
>
*pink">
¥ Technical Publications" - An up thrust for knowledgeInternet Programming -40
6. The
The element is used along with and to
multiple conditional tests.
XML
express
Step 1: Keep the same xml[[Link]] file which you have created in section 8.9.2 (1)
Step 1.
Step 2: Create the xsl file as follows —
<®anl version="1.0" encoding="IS0-8859-1"7>
Students Database
Name
Marks
‘
Step 2: Create a CSS file and name it as [Link]
Catalog
il
font-family:arial;
color:red;
font-size:16pt
iy
Book
{
display:block;
font-family:times new roman;
color:blue;
font-size:14pt
}
Title
{
font-family-arial;
color:maroon;
font-size:12pt
}
Author
{
font-family:arial;
color:magenta;
17
- Technical Publications - An up thrust for knowledgedeems Prvgeemetons
Sea Ratitlon,SAN,Price
{
aigplay block,
font-famnitysarial;
color:black;
font-size:10pt
margin-loft: 20pt
}
Step 3: Finally create a XML document and name it as [Link] as follows -
XML Document
XML Bible
Winston
Wiely
Fifth Edition
0-7645-4760-7
$40.5
Artificial Intelligence
[Link]
Princeton hall
Sixth Edition
0-13-1038-5-2
$63
Java 2
Watson
BPB Publications
Third Edition
0-41-1058-7-2
$63
An,
Here both CSS and DTD.
files are used externally
‘HTML in 24 hours
Sam Peter
‘SAM Publications
Fifth Edition
0-672-32841-0
a Techical Publican’ «an up trust for knowledgeInternet
Hernet Programming XML.
$50
Step 4: Finally execute the XML document on the web browser and you can see
following sort of output -
Cree
le Et Mew Hetery Gookrhs Tooth te
QB Se 1 tease eters “(GF ,
as wo ted @ cng ated hte des) Girton ke een |} wow
Fith Eaton
07646-47607
05
Artifical inteligence [Link]
Princeton hall
Sixth Edition
0-13-103852
$63
|Java 2 Watson
{BPE Publications
Thied Edtion
0-41-1058-7-2
33
FTML in 24 hours Sam Peter
‘SAM Publications
Fith Edition
oa723041.0
50
Doe
[ERIM News Feed (RSS and ATOM)
News feed or Web feed is a kind of document(or some data format) which is provit jing updated
contents to its users. The news feed lets web sites continuously feed you the updated news.
in Cricket. You could visit the websites that show information on
information about the players and so on. Depending on
| websites to get the information you want. By
Suppose you are interested i
Cricket, Cricket match schedule, Score,
your interests you may have to visit several
subscribing to a News feed or web feed, you can conveniently get a feed on the topic “ericker”
without having to go to particular website as well as catch up on all the history sites you are
interested in without visiting each site.
How it works ?
«There are content providers or distributors.
«Several web feeds are collected together at one spot. This s
«The end users can register with an aggregator program running on
as dragging the link from the web browser to the aggregator.
They publish feed links on their sites.
pot is called aggregator.
their own machines. This
is just similar to the task
ar
* Technical Publications" - An up thrust for knowledgeInternet Programming 8-44 XML
+ When instructed, the aggregator asks all the servers in its feed list if they have new content; if
0, the aggregator either makes a note of the new content or downloads it.
+ Aggregators can be scheduled to check for new content periodically.
+ Web feeds are an example of pull technology although they may appear to push content to the
user.
+ The kinds of content delivered by a web feed are typically HTML (webpage content) or links to
webpages and other kinds of digital media,
+ These Web sites are operated by many news websites and web blogs.
+ Thus news feeds work like newsletters by delivering the latest news to your desktop.
EREEI Rss
+ RSS is a kind of web feed. It stands for
o Really Simple Syndication
© Rich Site Summary
© Real time Simple Summary
* RSS is used to publish frequently updated information. For instance - blog entires, news
headlines, videos all these can be RSS feeds.
* The RSS format can be specified using XML. A standardized XML format allows the
information to be published once. Then it is viewed by many different programs.
How it works 7
+ RSS headlines are simple text files.
+ The web master submits these files to a special feed server.
+ This RSS feed server, in turn, pushes the text file to the screens of its subscribers.
+ Time span is usually 30 seconds to 30 minutes before the subscribers see the updates, In most
cases, the lag is not even noticeable.
+ Most RSS readers are free to use and easy to lear, User can setup the screen using the reader
tool. The users subscribe to a feed by using the feed’s URL or by clicking the RSS icon. Thus
the subscription process is initiated.
* Various examples of RSS reader are - [Link], Google Reader, My Yahoo Reader.
Example of RSS element
+ The most commonly used elements in RSS are ,, and .
+ The element describes the RSS feed. This element has three child elements,
+ : This element is for defining the title of channel element.
a
Technical Publications” - An up teust for knowledgeInternet Programming ; has XML
* slink> : This clement defines the hyperlink to channel.
‘Sdescription> : This clement describes the channel,
* Each clement has one or more - elements. The item element defines the article
or story in RSS field.
* Following is a simple XML document which makes used of RSS
to describe the book
store collection.
‘“
‘
The syntax of writing any closing element for closing tag is
Every XML must have a single root element.8-49 XML
programming ~
Innere
go way DTDs?
ans. : The document type definition is used to define the basic building block of any xml
document. Using DTD we can specify the various elements types, attributes and their
relationship with one another. Basically DTD is used to specify the set of rules for structuring
data in any XML file.
For example : If we want to put some information about some students in XML file then,
generally we use tag student followed by his/her name, address, standard and marks. That means
we are actually specifying the manner by which the information should be arranged in the XML
file. And for this purpose the Document Type Definition is used.
Q9 What is meant by namespace ?
Ans. : The xml document allows us to create different elements which are having the common
name. This technique is known as namespace.
For example : Consider the following XML document
XML Document
It is a text file
It is an image file
The above document does not produce any error although the element text is used for two
different attribute values.
Q.10 What is CDATA ?
Ans. : The CDATA stands for Character Data. The character data will be parsed by the parser.
Q.11 What is PCDATA ?
Ans. : It stands for Parsed Character Data (i.e. text). Any Parsable character data should not
contain the markup characters. The markup characters are < or > or &. If we want to use less
than, greater than or ampersand characters then make use of < , > or &
Q.12 What are the merits of DTD ?
Ans. :
1, DTDs are used to define the structural components of XML document
2. These are relatively simple and compact.
3. DTDs can be defined inline and hence can be embedded directly in the XML document.
a Technical Publications” - An up thrust for knowledgeXML
Internet Programming 8-50 x
Q.13 What are the demerits of DTD ?
Ans. :
13
3
The DTDs are very basic and hence cannot be much specific for complex documents.
. The language that DTD uses is not an XML document. Hence various frameworks used by
XML cannot be supported by the DTDs.
The DTD cannot define the type of data contained within the XML document. Hence using
DTD we cannot specify whether the element is numeric, or string or of date type.
4.
5
There are some XML processor which do not understand DTDs.
The DTDs are not aware of namespace concept.
Q.14 What is XSL and why it is used ?
Ans. : XSL stands for eXtensible Stylesheet Language. The XSL decided how an XML
document should look on web browser.
Q.15 What is the difference between DOM and SAX ? [Refer section 8.8.1]
(VERE)
Q.16 What are the two methods of parsing the XML document ?
Ans. : The XML document is parsed using two approaches -
1) Tree based 2) Event based.
‘The tree based parsing is done using DOM and th Event based parsing is done using SAX.
Q.17 What is the importance of SAX ?
Ans.
he SAX stands for Simple API for XML. It allows to access the information of XML
document using sequence of events. This API is basically used for parsing the XML document.
Q.18 How is XML parsing done with SAX ?
Ans. : The XML parsing can be done with SAX using following steps -
A Java program can make use of following steps.
1) Using the BufferedReader class the contents of XML document are read,
7) Then using XMLReadFactory XML reader is created. This reader parses the XML
document using appropriate callbacks,
3) Using ereateXMLReader an object reader is created,
4) With the help of this object the method parse is invoked for parsing the XML document.
Q.19 What does XSLT mean ?
(ESE
Ans. : The XSLT stands for eXtensible Stylesheet Language Transformation. It is a W3C
recommendation,
ap! mie 7Internet Programming
2
Q.20 What is the purpose of XSLT aaa
Ans. : The purpose of XSLT is to define the XML document transformations and presentations.
Thus using XSLT the XML document can be transformed into XHTML documents or some
other XML document.
Q.21 What is Xpath ? TE
Ans. : The XSLT uses the Xpath to navigate in XML document. In other words we can reach to
any node of XML document using XPath.
Q.22 What is XSL-FO ?
Ans. : The XSL-FO is a language for formatting XML document for displaying it in desired
manner.
Q.23 What is the use of CSS for XML document ?
Ans. : In XML user defined tags are used. The cascading style sheet can be embedded within
the XML document using which the desired style can be applied to the user defined tags. Thus
the XML document can be presented in the desired style using the CSS.
Q.24 What is XML Parse Tree ?
Ans. : The XML document form a tree structure that starts from root node to branches.
The XML parse tree is a DOM model in which everything from XML is treated as node.
This tree is created for parsing the XML document.
Various properties such as nodeName, nodeValue, parentNode, childNodes and so on are
used while parsing the XML document.
Q.25 Why is XSLT an important tool in development of web applications ?
Ans. : The XSLT stands for XSL Transformations. It is used for defining the XSL document
transformations and presentations. Thus XSLT decides how an XML document should look on
web browser.
Q.26 What is XML parser ?
LURDE
XML parser is a parser that is designed to read XML and check the well formedness of
Ans.
the document, The XML parser also validates the document.
Q.27 What is Well formed XML document ?
Ans. : Refer section 8.3.Internet Programming & -52 XML
Q.28 What are the different data types used in XML Schema ?
Ans. :
DataTypes | Description
String The string is a collection of characters. This data type is used to define
the elements containing characters, lines, tabs or white spaces. It is
denoted by type=xs:string
Date For specifying the date we use this data type. The format is yyyy-mm-
dd where y denotes year, m denotes month and d denotes the day. It is
specified using type=xs:date
Numeric For specifying the numeric values this data type is used. This can be
denoted as cither type=xs:decimal or type=xs:integer
Boolean For specifying the true or false values the Boolean data type is used. It
is denoted as type=xs:boolean
Q.29 Compare DTD and Schema.
Ans. :
1. Both the schemas and DTDs are useful for defining structural components of XML.
But the DTDs are basic and cannot be much specific for complex operations. On the
other hand schemas are more specific.
2. The schemas provide support for defining the type of data. The DTDs do not have this
ability. Hence content definition is possible using schema.
3. The schemas are namespace aware and DTDs are not.
4, The XML schema is written in XML itself and has a large number of built in and
derived types.
5. The schema is the W3C recommendation. Hence it is supported by various XML
validator and XML processors but there are some XML processors which do not
support DTD.
6. Large number of web applications can be built using XML schema. On the other hand
relatively simple and compact operations can be built using DTD.
Q.30 What is the purpose of XML schema ? CUES
Ans. : The XML schemas are used to represent the structure of XML document. The purpose of
XML schema is to define the building blocks of an XML document,
Q.31 Explain the term XML schema.
Ans. : The XML schema are used to represent the structure of XML document, The goal of
XML schema is to define building blocks of an XML document.
=m Technical Publications» - An up thrust for knawdedlge: