You are on page 1of 13

SIKKIM MANIPAL UNIVERSITY, DE

Student Name: GEETIKA AWASTHI Course: MCA
Registration No: 1305006674 LC Code: 00918
Subject Name: web technologies Subject Code: MCA 5010

Q1. Differentiate between TCP and UDP ?

Ans TCP (Transmission Control Protocol)
The TCP corresponds to the transport layer of OSI reference model, The TCP is
known as a connection-oriented protocol, which means that a connection is
established and maintained until such time as the message or messages to be
exchanged by the application programs at each end have been exchanged. TCP
makes sure data gets to the destination without errors. It is also responsible for
disassembling and assembling the data. it divides large messages into smaller
packets of at the most 15KB size. Each of this packet is called a segment. TCP
numbers these segments and hand it over to IP layer.
TCP is used along with the Internet Protocol (IP) to send data in the form of message
units between computers over the Internet. While IP takes care of handling the actual
delivery of the data, TCP takes care of keeping track of the individual units of data
(called packets) that a message is divided into for efficient routing through the Internet.

IP (Internet Protocol):
IP is the protocol that controls how data moves around on the network. After TCP
divides the message into segment, IP labels them with source and destination. These
packets are now called IP datagrams. IP is the primary protocol in the Internet Layer
of the Internet protocol suite and has the task of delivering datagrams from the source
host to the destination host solely based on their addresses. IP also takes care of
sending the datagrams by determining the route. These datagrams may hop several
networks before reaching the destination. Below diagram 1.3 shows TCP/IP
Communications.

1

UDP adds no reliability. UDP (User Datagram Protocol) UDP is connection-less transport layer protocol. If any of the segments are missing it informs this to the source TCP and requests the segment to be sent again. The UDP port identifies various applications running on a device. the TCP assembles the message from these data segments and supplies to the destination program. It is called retry. Each datagram is independent of others. DE In the above diagram 1. A receiving system remains unaware of the sending of a datagram unless it arrives. flow control or error recovery. at the destination the IP verifies the labels and passes them to the TCP. UDP is used in situations where reliability is not required and it is helpful in multimedia and multicasting applications. and they may be lost by the networks or arrive out of order. After verification. The TCP checks if all the segments have been received. SIKKIM MANIPAL UNIVERSITY.3. 2 .

for example if in any example of XMl we are opening a tag but not closing the same then it is not a well formed XML document. Valid XML document: An XML document is valid if there is a document type definition (DTD) associated with it and if the document complies with that DTD. Structured and integrated data: In XML document we can specify not only data but the structure of that data can also be specified. Each element also must nest inside any enclosing elements properly.XML provides a very efficient way of storing most data. If we like. so you cannot guarantee that the document will actually use the encoding provided in the XML declaration. 5. we can use XML editors to create XML documents but if something goes wrong we can examine and modify document directly because it’s all just text. In addition. 2. 3 . and that represents its extraordinary power. we can figure out what’s going on. when we standardize markup languages. d) Elements may not overlap: an end tag must always have the same name as the most recent unmatched start tag. data and markup are stored as text that we can configure. DE Q2 Describe the features of XML. Customizing markup language: We can create customized markup languages using XML. When we are dealing with complex and important data we can integrate various elements in to other elements. 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. 6. There are few other important rules to keep in mind about the XML declaration: a) The XML declaration is case sensitive: it may not begin with “<?XML” or any other variant. we can create a customized browsers to handle that language. 4. Easy Data Exchange: In XML. b) If the XML declaration appears at all. Well-formed XML documents: XML document must follow the syntax rules set up properly. many different people can use them. SIKKIM MANIPAL UNIVERSITY. it must be the very first thing in the XML document: not even whitespace or comments may appear before it. The following example is well-formed XML document. and c) It is legal for a transfer protocol like HTTP to override the encoding value that you put in the XML declaration. 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.

.. DE The following example shows the tags properly nested: <Education> <student> distance education </student> SMUDE </Education> e) An XML document has exactly one root element. the following example is not a well-formed XML document. because both the university and books elements occur at the top level: <! -... Figure 4. we can easily understand the flow of our information in our document...</University> <Books>.</university> <Books>.1 shows a tree structure of an XML document is similar to the structure of Sikkim Manipal University..WRONG! --> <University>.</Books> </education> If we use the structure of Sikkim Manipal University as a model for understanding the structure of an XML document. 4 .</Books> The following example fixes the problem by including both the University and Books elements within a new Education root element: <Education> <University>. SIKKIM MANIPAL UNIVERSITY.. As a result.

which is called an event handler or sometimes a call-back procedure. 5 . signalling the need for a font change. This is often all that the XML processor needs to do. DE Q3. Some tokens signal that a change in behaviour is necessary. the application parses and validates the source document.? Ans: Components of XML processor a) Parser Every XML processor has a parser. On receiving an event. What the events are and how they are handled are up to the particular processor. b) Event switcher The event switcher receives a stream of tokens from the parser and sorts them according to function. such as building and operating on an internal tree model. and. but sometimes more complex processing is required. An XML parser converts an XML document into an XML DOM object . In the following figure 7.which can then be manipulated with a JavaScript. It then either applies XSLT style sheets or directly serializes to XML. to be used for processing. SIKKIM MANIPAL UNIVERSITY. One event may be that a processing instruction with a target keyword significant to the XML processor has been found.1 we have conversed about XML parsing process operates in three phases: Figure 7. or some other piece of markup that indicates a change between regions of the document. maps and binds the retrieved information to business objects.List and explain the component of XML processor.1: Three Stages of XML Parsing Process Stage 1: In this stage. The parser's job is to translate XML markup and data into a stream of bite- sized nuggets. A token may be an element start tag. These are called events. Another may be that a <title> element has been seen. like a switchboard telephone operator of old. It might result in the generation of output information. it routes processing to a subroutine. optionally. the beginning delimiter of a processing instruction. a string of character content. Stage 3: XML output processing. This is the stage in which the actual processing of the input information takes place. the application constructs a model of the document to be generated with the Document Object Model (DOM). called tokens. Stage 2: Business logic handling. recognizes and searches for relevant information based on its location or its tagging in the source document. extracts the relevant information when it is located. In this stage.

using DSO (Data Source Object) and JavaScript. When a table element is bound there is no need to write out the code for individual rows for each record in the recordset.. Ans: Loading XML Data into an HTML Page The process of fetching data from an XML files to be filled in an HTML table... d) Tree processor The tree processor is the part of the program that operates on the tree model. </tr> </thead> <tbody> <tr> . This is the kind of structure you would find in a non-object. DE c) Tree representation The tree representation can take many forms. usually in a methodical. Object trees are expensive in terms of speed and memory. an object is a package of data and routines in a rigid. its actions are controlled by a list of rules. To bind the XML data to an HTML table.oriented approach.. Q4. where a rule is some description of how to handle a piece of the tree. </tr> </tbody> </table> 6 . It will accept information that is organized in a certain way and will manipulate it with its own database engine. the tree processor may use the rules from a stylesheet to translate XML markup into formatted text. It can be anything from a validity checker to a full-blown transformation engine. In a programming phrase. add a datasrc attribute to the table element. and add the datafld attribute to the span elements inside the table data. cloudy framework. ii) The other kind is called an object model. For example <table width="80%" id=nbbeq datasrc="#equipdet" border="1"> <caption> <span class="style1">example</span> </caption> <thead> <tr> . i) The first is a simple structure consisting of a hierarchy of node lists. Often.. where every node is represented as an object. SIKKIM MANIPAL UNIVERSITY. DSO allows data binding to HTML table elements. This style is preferred for large programs. but for many applications this is an acceptable trade-off for convenience of development... because it minimizes certain types of bugs and is usually easier to visualize. DSO is an object that operates like a database on the client side. Describe the procedure of fetching data from XML to HTML give an example.first order in which it goes to the end of a branch and backtracks to find the last unchecked node.. The DSO will automatically do this for each record. For example. depth. but there are two main types. It traverses the tree.

document.i++) { document.xml". 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. } else { Xmlhttp = new ActiveXObject("Microsoft.XMLDocument."cd_catalog.send(). nodeValue).length.open("GET". The following JavaScript function is used to load the XML file to DSO objects.write("<table border='1'>"). } xmlhttp.childNodes[0].write(x[i]. document. </script> </body> </html> 7 .XMLHTTP").write("</td></tr>").load("equip. xmlDoc = xmlhttp. xmlhttp.xml"). var x = xmlDoc.i<x. document.getElementsByTagName("CD").0060b0ec3d39" width="0" height="0"> </object> Next we make a DOM object.write("</td><td>").write("<tr><td>").responseXML. var doc=nb_equip.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(). DE 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-11d2-9ca9. This is done using the XMLDocument property of the DSO.childNodes[0]. for (i=0.getElementsByTagName("ARTIST")[0].false). document.no deValue). } document. document.write("</table>").getElementsByTagName("TITLE")[0]. SIKKIM MANIPAL UNIVERSITY. Once a DOM object has been created use the load method of the DOM object to load a file: doc.write(x[i].

1 shows all the arithmetic operators. DE Q5. Such an assignment of value is done with the "=". There are many operators used in PHP. Arithmetic operators are used to perform mathematical operations like addition. Table 11. Table 11. so we have separated them into the following categories to make it easier to learn them all. Assignments can also be used in conjunction with arithmetic operators. or equal character. multiplication.Describe the five different categories of PHP operator. Assume: $x = 4 and $y = 5.  Assignment Operators  Arithmetic Operators  Comparison Operators  String Operators  The Concatenation Operator Assignment operators are used to set a variable equal to a value or set a variable to another variable's value. subtraction. Comparison operators are used inside conditional statements and evaluate to either true or false. operators are used to manipulate or perform operations on variables and values. SIKKIM MANIPAL UNIVERSITY.  $another_data = $my_data Now both $my_data and $another_data contain the value 2. division and Modulus. Here are the most important comparison operators of PHP. Example:  $my_data = 2.2 shows all the comparison operators 8 . Table Comparison operators Comparisons are used to check the relationship between variables and/or values.? Ans: PHP – Operators In all programming languages.

To concatenate two string variables together. use the concatenation operator: <?php $txt1="Hello World!". ?> The output of the code above will be: Hello World! Distance education! 9 . SIKKIM MANIPAL UNIVERSITY. $txt2="Distance education!". $txt2. " " .) is used to put two string values together. echo $txt1 . The concatenation operator (. DE The Concatenation Operator There is only one string operator in PHP.

asp. 3.asp" extension. The basic difference between HTML and ASP is that ASP is used to design user-interactive pages or dynamic pages with database access whereas HTML is used to design static Pages. When we type a URL in the Addressbox or click a link on a Web page it means we are asking a Web server to send a file to the Web browser on our computer. The user brings up a Web site where the default page has the extension . If that file is a normal HTML file. and produces an HTML Web page. on the pages that are being viewed. except there's an extra processing step that takes place just before the Web server sends the file. To distinguish them from normal HTML pages. SIKKIM MANIPAL UNIVERSITY. it looks exactly the same when your Web browser receives it as it did before the Web server sent it. the process is similar. executes any script commands contained in the file. 5. Following figure 13. The server-side script begins to run with ASP. After receiving the file. Active Server Pages are given the ". Before the Web server sends the Active Server Page to the Web browser. and sounds. How ASP Works? Following are some steps that will help us to know about ASP working: 1. Because our script runs on the server. images. Instead. the Web server does all of the processing and standard HTML pages can be generated and sent to the browser. The browser requests the ASP file from the Web server. The Web page is sent to the browser. your Web browser displays its contents as a combination of text. Server-side scripts are special code that is put in Web Pages and that code is processed before it is sent to the Web browser of someone who's visiting your Web site. the user sees only the generated HTML as well as non-HTML content. such as XML. it runs all server-side scripts contained in the page.1 shows the working of ASP page 10 .? Ans: Introduction of ASP Active Server Pages (ASPs) are Web pages that contain server-side scripts in addition to the usual mixture of text and HTML (Hypertext Markup Language) tags. Another benefit of having our script reside on the server is that the user cannot "view source" on the original script and code.Describe about ASP. This means that our Web pages are limited only by what our Web server supports. 2. In the case of an Active Server Page. DE Q6. ASP processes the requested file sequentially (top-down). 4.

The <% is called an opening tag. instead of starting and ending with lesser-than ( < ) and greater-than ( > ) brackets. However. SIKKIM MANIPAL UNIVERSITY. You can insert server-side scripts anywhere in your Web page-. and the %> is called a closing tag. In between these tags are the server.even inside HTML tags a 11 . they typically start with <% and end with %>.side scripts. DE Server-side scripts look a lot like HTML tags.

DE 12 .SIKKIM MANIPAL UNIVERSITY.

DE 13 .SIKKIM MANIPAL UNIVERSITY.