Professional Documents
Culture Documents
NAME
PROGRAM
SEMESTER
3rd Sem
Roll No
1408025004
CODE NO
03458
for transferring electronic mail across the Internet in that, like these technologies,
FTP uses the Internets TCP/IP protocols to enable data transfer.
When you take a file from a remote machine down to your own machine, it is
called a download. When the opposite happens and you place a file on a remote
machine, it is called on upload. FTP is most commonly used to download a file
from a server using the Internet or to upload a file to a server.
SMTP (Simple Mail Transfer Protocol)
SMTP is used for sending E-mail messages between servers. Most e-mail systems
that send mail over the internet use SMTP to send messages from one server to
another, the messages can then be retrieved with an e-mail client. In addition,
SMTP is generally used to send messages from a mail client to mail server.
Q-2 Describe the features of XML. What are the important rules to keep in
mind about the XML declaration?
Ans.
Features of XML:
XML is popular for many features and few of them are listed here
1.Easy Data Exchange: In XML, data and markup are stored as text
that we can configure. If we like, we can use XML editors to create
XML documents but if something goes wrong we can examine and
modify document directly because its all just text.XML provides a
very efficient way of storing most data. In addition, when we
standardize markup languages, many different people can use them.
2. Customizing markup language: We can create customized
markup languages using XML, and that represents its extraordinary
power. we can create a customized browsers to handle that language.
3. Self describing data: The data in XML document is self
describing. We can create our own tags in XML so that if we will go
back to our document years later, we can figure out whats going on.
4. Structured and integrated data: In XML document we can
specify not only data but the structure of that data can also be
<Education>
<University>...</University>
<Books>...</Books>
</education>
Q-3
Ans.
Components of XML processor
a) Parser
Every XML processor has a parser. An XML parser converts an XML
document into an XML DOM object - which can then be manipulated
with a JavaScript. The parser's job is to translate XML markup and
data into a stream of bite-sized nuggets, called tokens, to be used for
processing. A token may be an element start tag, a string of character
content, the beginning delimiter of a processing instruction, or some
other piece of markup that indicates a change between regions of the
document.
In the following figure. We have conversed about XML parsing
process operates in three phases:
The event switcher receives a stream of tokens from the parser and
sorts them according to function, like a switchboard telephone
operator of old. Some tokens signal that a change in behavior is
necessary. These are called events. One event may be that a
processing instruction with a target keyword significant to the XML
processor has been found. Another may be that a <title> element has
been seen, signaling the need for a font change. What the events are
and how they are handled are up to the particular processor. On
receiving an event, it routes processing to a subroutine, which is
called an event handler or sometimes a call-back procedure. This is
often all that the XML processor needs to do, but sometimes more
complex processing is required, such as building and operating on an
internal tree model.
c) Tree representation
The tree representation can take many forms, but there are two main
types. i) The first is a simple structure consisting of a hierarchy of
node lists. This is the kind of structure you would find in a non-objectoriented approach. ii) The other kind is called an object model, where
every node is represented as an object. In a programming phrase, an
object is a package of data and routines in a rigid, cloudy framework.
This style is preferred for large programs, because it minimizes certain
types of bugs and is usually easier to visualize. Object trees are
expensive in terms of speed and memory, but for many applications
this is an acceptable trade-off for convenience of development.
d) Tree processor
The tree processor is the part of the program that operates on the tree
model. It can be anything from a validity checker to a full-blown
transformation engine. It traverses the tree, usually in a methodical,
depthfirst order in which it goes to the end of a branch and backtracks
to find the last unchecked node. Often, its actions are controlled by a
list of rules, where a rule is some description of how to handle a piece
of the tree. For example, the tree processor may use the rules from a
style sheet to translate XML markup into formatted text.
Q-4 Describe the procedure of fetching data from XML to HTML. Give
an example.
Ans.
The process of fetching data from an XML files to be filled in an
HTML table, using DSO (Data Source Object) and JavaScript. DSO is an
object that operates like a database on the client side. It will accept
information that is organized in a certain way and will manipulate it with
its own database engine.
DSO allows data binding to HTML table elements. When a table element
is bound there is no need to write out the code for individual rows for
each record in the recordset. The DSO will automatically do this for each
record.
To bind the XML data to an HTML table, add a datasrc attribute to the
table element, and add the datafld attribute to the span elements inside
the table data.
For example
<table width="80%" id=nbbeqdatasrc="#equipdet" border="1">
<caption>
<span class="style1">example</span>
</caption>
<thead>
<tr>
......
</tr>
</thead>
<tbody>
<tr>
....
</tr>
</tbody>
</table>
Example using scripting:
Using JavaScript to load the XML file data to the HTML file using
DSO
First we create a new DSO via code:
<object id="nb_equip" CLASSID="clsid:550dda30-0541-11d29ca90060b0ec3d39" width="0" height="0">
</object>
Next we make a DOM object.This is done using the XMLDocument
property of the DSO.
var doc=nb_equip.XMLDocument;
Once a DOM object has been created use the load method of the
DOM object to load a file:
doc.load("equip.xml");
The following JavaScript function is used to load the XML file to
DSO objects. When the user calls this function it will load the XML
file and bind the data to the HTML table based on datasrc and datafld
attributes:
<html>
<body>
<script type="text/javascript">
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
Xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} xmlhttp.open("GET","cd_catalog.xml",false); xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
document.write("<table border='1'>");
var x = xmlDoc.getElementsByTagName("CD");
for (i=0;i<x.length;i++)
{
document.write("<tr><td>");
document.write(x[i].getElementsByTagName("ARTIST")
[0].childNodes[0].no deValue);
document.write("</td><td>");
document.write(x[i].getElementsByTagName("TITLE")
[0].childNodes[0]. nodeValue);
document.write("</td></tr>");
}
document.write("</table>");
</script>
</body>
</html>
English
Addition
Subtraction
Multiplication
Division
Modulus
Example
4+4
64
5*4
16 / 4
43 % 10
statements and evaluate to either true or false. Here are the most important
comparison operators of PHP. Assume: $x = 4 and $y = 5; Table 2 shows all the
comparison operators.
Table 2: Comparison Operator
Operato
r
==
!=
<
>
<=
>=
Meaning
Equal To
Not Equal To
Less Than
Greater Than
Less Then or Equal To
Greater Then or Equal
To
Exampl
e
$x == $y
$x != $y
$x < $y
$x > $y
$x <= $y
$x >= $y
String Operators As we have already seen in the Echo statement, the period "." is
used to add two strings together, or more technically, the period is the
concatenation operator for strings. By the following program you can see the
function of string operator.
PHP Code:
$a_string = "Distance";
$another_string = " Education!";
$new_string = $a_string .
$another_string;
echo $new_string . "!";
Output
Distance Education!
The Concatenation Operator There is only one string operator in PHP. The
concatenation operator (.) is used to put two string values together. To concatenate
two string variables together, use the concatenation operator:
<?php $txt1="Hello World!";
$txt2="Distance education!";