83
PCCOE, Nigdi Department of Computer Engineering INDEX Assignment No. 1 Setting up a small network (2PC’s, 4 PC’s) and configuration for sharing resources. 2 Stud of protocol anal!er ("thereal) Packet analsis ( wireshark) # $nstalling and conf iguring %&CP ser'er (windows 2# ser'er) 4 Studing inu* network conf iguration and commands. + $nstallation and configuration we ser'er(Client-ser'er ased) /rite a program using socket programming for 0CP pref eral in C. /rite a program using socket programming for %P preferal in C. 3 %esign a wesite using &0 for an application. 5 %esign dnamic we pages and 'alidate them using 67 script or 896 9 scri pt. 1 /r ite a P&P script to access the data from assignment no 5 11 /rite a program to create 0CP:$P packet using standard 0CP:$P include files and send it to the ser'er ;inu* platform< 12 Create a %0% for a catalog of cars, where each car has the child el ements and tw o or th re e chil d el ements ha 'e thei r own child elements, each of these elements are re=uired and has the possile 'alues >es or ?o. Create an @ document with instances of the car elements defined in the %0% and process this document using the %0% and produce a displa of raw @ document. Create an @ schema and CSS stle sheet for the ao'e-mentioned @ document. Create an @S0 stle sheet for one car element of the @ document and use it to create a displa of that element.

Computer Network Lab Manual Comp Dept

Embed Size (px)

DESCRIPTION

Computer Network Lab

Citation preview

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    1/83

    PCCOE, Nigdi Department ofComputer Engineering

    INDEXAssignment

    No.

    1 Setting up a small network (2PCs, 4 PCs) and configuration forsharing resources.

    2 Stud of protocol anal!er ("thereal) Packet analsis (wireshark)

    # $nstalling and configuring %&CP ser'er(windows 2# ser'er)

    4 Studing inu* network configuration and commands.

    + $nstallation and configuration we ser'er(Client-ser'er ased)

    /rite a program using socket programming for 0CP preferal in C.

    /rite a program using socket programming for %P preferal in C.

    3 %esign a wesite using &0 for an application.

    5%esign dnamic we pages and 'alidate them using 67 script or8969 script.

    1 /rite a P&P script to access the data from assignment no 5

    11/rite a program to create 0CP:$P packet using standard 0CP:$Pinclude files and send it to the ser'er ;inu* platformes or ?o. Create an @ document with instances of thecar elements defined in the %0% and process this document usingthe %0% and produce a displa of raw @ document. Create an@ schema and CSS stle sheet for the ao'e-mentioned @document. Create an @S0 stle sheet for one car element of the@ document and use it to create a displa of that element.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    2/83

    PCCOE, Nigdi Department ofComputer Engineering

    Assignment No.: 01

    AimA

    Setting up a small network (2PCs, 4 PCs) and configuration for sharingresources.

    Objective:

    9fter going through this assignment ou will e in a position toA

    1. Purpose of ?$C card and crimping the B84+ connector2. Sol'e asic network design prolems.

    #. %esign and uild a simple local area network, and implement appropriatenetwork operating sstem client and ser'er software in a /indows andinu* en'ironment.

    4. %efine and descrie the function of a 9C address.+. %escrie the different classes of $P addresses.. &ow to setup $P an addressing scheme using class 9:7:CD networks. nderstand the purpose of the network mask.3. 9pplications, merits and demerits of this assignment.

    Pre-Requisites:

    1. 7asic knowledge of 0ransmission media.2. 0pes of transmission media.#. 0pes of internetworking de'ices4. 0CP:$P model.

    Teor!:

    "laorate the following points.

    1. Choosing the 7est Computer ?etwork.2. Connector crimping for simple cale and cross cale with diagram#. Client ser'er network ( client, ser'er , diagram )4. 9C address and $P address ( all classes )+. Sunetting ( %efinition, re=uirement). 9pplications

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    3/83

    PCCOE, Nigdi Department ofComputer Engineering

    Activities:

    1. %ecide which topolog is going to use.2. ist out all the hardware and software re=uired for network.#. %ecide which class $P addresses are a'ailale.4. %ecide the numer of user.

    "A#:

    1. %efine $P address.2. %efine Eatewa.

    #. ist the different tpes of topologF4. /hich transmission media used in star topologF+. %efine a protocolF. /hat is sunet maskF. /hat is 9C addressF3. /hat is the difference etween 9C address and $P addressF9. /hat is the use of simple cale and cross o'er caleF10. /hat is the difference etween logical address and phsical

    addressF

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    4/83

    PCCOE, Nigdi Department ofComputer Engineering

    Assignment No.: 0$

    Aim:

    Stud of protocol anal!er ("thereal) Packet analsis (wireshark)

    Objective:

    0his la will introduce the network protocol anal!er (ethereal:wireshark). /ewill also e concentrating onA

    1. ?etwork anal!ing process.2. Packet capturing process.

    Pre-Requisites:

    7asic knowledge of ocal 9rea ?etwork

    7asic knowledge of protocols

    Teor!:

    1. /hat is a protocol anal!erF2. "*plore different packet headers with the anal!er. /rite in rief aout the

    same.

    In%ut:

    Steam of data packets using diff. protocols

    &te%s to be 'o((o)e*:

    1. "*ecute the /ireshark setup2. Select the CaptureD option. Select $nterfacesD under the same

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    5/83

    PCCOE, Nigdi Department ofComputer Engineering

    #. Select the ?$C card and click on StartD

    4. 0he packets flowing in the network can e seen.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    6/83

    PCCOE, Nigdi Department ofComputer Engineering

    +. Click on StopD the capture and start e*ploring the frames

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    7/83

    PCCOE, Nigdi Department ofComputer Engineering

    . Select a frame and e*plore the protocol. &ere is an e*ample of how thee*plored 9BP protocol packet will look likeA

    Out%ut: BesultA-packets captured

    "A#s:

    1. /hat protocols are currentl supported on /iresharkF2. /hat tpe of sockets does ethereal use to capture packetsF#. Can the contents of the message e seen on the anal!erF4. Can we use "thereal with inu*F+. Can a protocol anal!er e used as a hacking toolF. /hat de'ices can a network anal!er use to capture packetsF

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    8/83

    PCCOE, Nigdi Department ofComputer Engineering

    Assignment No.: 0+

    Aim:

    $nstalling and configuring %&CP ser'er (windows 2# ser'er)

    Teor!:

    "laorate the following points.

    1. /hat is %namic &ost Configuration ProtocolF2. /h it is usedF

    $nstalling %&CP Ser'er is 'er eas in win ser'er 2#

    Girst ou need to go to StartHI9ll ProgramsHI9dministrati'e 0oolsHIanage>our Ser'er

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    9/83

    PCCOE, Nigdi Department ofComputer Engineering

    &ere ou need to select 9dd or remo'e a role

    6erif the following steps click on ?e*t

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    10/83

    PCCOE, Nigdi Department ofComputer Engineering

    Select Ser'er Bole as %&CP Ser'er option click on ?e*t

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    11/83

    PCCOE, Nigdi Department ofComputer Engineering

    Summar selection click on ?e*t

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    12/83

    PCCOE, Nigdi Department ofComputer Engineering

    $nstalling %&CP Ser'er in progress

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    13/83

    PCCOE, Nigdi Department ofComputer Engineering

    ?ow this will prompt new scope welcome screen click ne*t

    9 scope is a collection of $P addresses for computers on a sunet that use %&CP.enter the name and description of our scope click ne*t

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    14/83

    PCCOE, Nigdi Department ofComputer Engineering

    ?ow ou need to define the range of addresses that the scope will distriuteacross the network, the sunet mask for the $P address . "nter the appropriatedetails and click ne*t.

    "nter the $P address range that ou want to e*clude and click on ne*t

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    15/83

    PCCOE, Nigdi Department ofComputer Engineering

    Select lease duration how long a client can use an $P address assigned to itfrom this scope. $t is recommended to add longer leases for a fi*ed network (inthe office for e*ample) and shorter leases for remote connections or laptop

    computersand click ne*t

    >ou are gi'en a choice of whether or not ou wish to configure the %&CPoptions for the scope now or later. >ou can select >es, $ want toJ radion uttonand click ne*t.

    http://www.windowsreference.com/windows-server-2003/install-and-configure-dhcp-server-in-win-server-2003-step-by-step-guide/#%23http://www.windowsreference.com/windows-server-2003/install-and-configure-dhcp-server-in-win-server-2003-step-by-step-guide/#%23
  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    16/83

    PCCOE, Nigdi Department ofComputer Engineering

    "nter the router, or gatewa, $P address click ne*t. 0he client computerswill then know which router to use and click ne*t.

    "nter the %?S and domain name settings can e entered. 0he %?S ser'er$P address will e distriuted the %&CP ser'er and gi'en to the client clickne*t.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    17/83

    PCCOE, Nigdi Department ofComputer Engineering

    $f ou ha'e /$?S setup then here is where to enter the $P 9ddress of the/$?S ser'er. >ou can Kust input the ser'er name into the appropriate o* and

    press Besol'eD to allow it to find the $P address itself click ne*t.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    18/83

    PCCOE, Nigdi Department ofComputer Engineering

    ?ow ou need to acti'ate this scope now and click ne*t.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    19/83

    PCCOE, Nigdi Department ofComputer Engineering

    %&CP Ser'er new scope installation was finished and click finish.

    ?ow our ser'er is now a %&CP ser'er message and click finish.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    20/83

    PCCOE, Nigdi Department ofComputer Engineering

    ,on'iguring D,P

    ?ow ou need to go to StartLI9dministrati'e 0oolsLI%&CP

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    21/83

    PCCOE, Nigdi Department ofComputer Engineering

    Bight Click on our ser'er click on 9uthori!e our %&CP Ser'er.

    9uthori!ation completed now our %&CP ser'er is up and running.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    22/83

    PCCOE, Nigdi Department ofComputer Engineering

    %&CP ser'ers permit ou to reser'e an $P address for a client. 0his meansthat the specific network client will ha'e the same $P for as long as ou wanted itto. 0o do this ou will ha'e to know the phsical address (9C) of each networkcard. "nter the reser'ation name, desired $P address, 9C address anddescription H choose whether ou want to support %&CP or 7MM0P and pressadd. 0he new reser'ation will e added to the list.

    http://www.windowsreference.com/windows-server-2003/install-and-configure-dhcp-server-in-win-server-2003-step-by-step-guide/#%23http://www.windowsreference.com/windows-server-2003/install-and-configure-dhcp-server-in-win-server-2003-step-by-step-guide/#%23
  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    23/83

    PCCOE, Nigdi Department ofComputer Engineering

    &etu%

    Click %&CP in the 9dministrati'e 0ools or in the anager >our Ser'ersD/indow.

    $n the Scope window, enter the scope name and description and click ne*t. $n the ne*t window, ou will e asked to define the range of the $P

    addresses that the scope will distriute to the network computers. "nter the start $P address, end $P address, length and sunet mask and click

    ne*t. $n the ne*t /indow, ou will need to add e*clusions i.e. ou can add an

    $P addresses that ou dont want to e distriuted to the networkcomputers. 9fter adding the range of the e*clusi'e $P addresses click ne*t.(>ou can assign the e*clusi'e $P address manuall to the compans router,

    gatewa or an other de'ice. 0hese $P addresses will not e distriuted tothe network computers.)

    $n the ne*t window, ou need to enter the lease duration. $t isrecommended that ou add longer lease duration for the fi*ed computernetworks and the shorter leased time for the remote connections andaptops.

    Mn the ne*t screen, ou will e gi'en the choice to configure these optionsfor the %&CP scope now or later. Check >es $ want to configure theseoptions nowD and click ne*t.

    Mn the ne*t screen, ou need to enter the Bouters $P address from thee*clusi'e list, which we defined on the ao'e steps. 9fter ou add therouters address click ne*t.

    $n the ne*t window, %?S settings can e entered i.e. $P address, domainname and ser'er name.

    Mn the screen ne*t to %?S, /$?S ser'er settings can e entered. Mn the ne*t window, ou need to acti'ate the scope. Click >es $ want to

    acti'ate the scope nowD. 0hats all. >ou ha'e successfull setup the %&CP in our /indows 2#

    Ser'er.

    ,on'igurtions

    9fter ou ha'e successfull setup the %&CP ser'er, ou ma need toconfigure the multiple options ased up the re=uirements of our network. Gorconfiguring the "*clusions after setting up the %&CP ser'er, please follow the

    elow steps.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    24/83

    PCCOE, Nigdi Department ofComputer Engineering

    $n the %C&P main windows right click the 9ddress Pool on the left sideand click 9dd "*clusionsD. &ere ou can define the range of the $P addresseswhich ou dont want to distriute among the network computers.

    $f ou want to reser'e an $P address for a client computer, ou canconfigure it the following steps. Gor reser'ing the $P addresses for clientcomputer, ou need to know the 9C address of that client.

    $n the %&CP main window, right click Beser'ations in the left side.Pro'ide the re=uired parameters for fi*ing the $P addresses for the clientcomputers.

    >ou need to e*plore the 'arious features of the %&CP ser'er as ou can

    configure multiple other options.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    25/83

    PCCOE, Nigdi Department ofComputer Engineering

    Assignment No.: 0/

    Aim:

    Studing inu* network configuration and commands.

    Teor!:

    Discus n* eecute 'o((o)ing inu commn*s:

    1. $fconfig2. 0raceroute#. Ping4. route

    Deti(s o' ,on'iguring inu

    TIP 1./hen ou need to find a particular file:director then use the NlocateNcommand (on Gedora slocate works well too) to find things on our ser'er. ike,tpingA locate *inetd

    TIP $.$f ou did not know this alread, all of the we ser'er html files forGedora are placed underA :'ar:www:html

    &te% 1./hich Processes are Bunning Mn >our Ser'erF$f ou donNt know, then ou need to find out asapO se the commandA2sbin2c3con'ig --(ist

    0he output would look something likeAJ

    httpd Aoff 1Aoff 2Aoff #Aoff 4Aoff +Aoff AofftelnetA offJ

    0he ao'e command will gi'e ou a long list of processes with info esidethem like off. 9n process with the word off ne*t to it can e assumeddisaled default during startup. >ou should look for our processes that are

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    26/83

    PCCOE, Nigdi Department ofComputer Engineering

    usuall needed for running a weser'er like httpd, telnet, wu-ftp, ms=ld. 9ll ofthese should e on default.

    &te% $. 4et Processes &trte*Starting up our weser'er (httpd), ms=l (ms=ld), sendmail, etc. is eas solong as ou follow the directions from the steps elow. Gor our weser'er and ms=l, ou can enale these things right awa foruse during this session. Change to the initiali!ation (aka init) directorAc* 2etc2rc.*2init.*2

    0his director (when listed) shows all processes ou can start like httpd andms=ld. Gor now letNs start our we ser'er with the command A

    .2tt%* strt

    >ou should then seeAStarting httpdA ; MQ ouNll notice forinstance the file telnet.

    2nd "dit the telnet file and change two linesA< *e'u(t: on

    ...

    *isb(e* = no

    0hese lines are not adKacent, ut usuall the first and last lines of theconfiguration file (in our case telnet). >ou need to e*it (( con'igurtion 'i(esthat appl to things ouNre tring to start. an processes come default turnedoff and disaled Res. >ou can edit files like telnet, wu-ftp, etc.

    #rd Mnce ou ha'e edited and sa'ed the files with the default on and disaled Rno, ou can force an automatic restart of the *inetd to load without reootingA2etc2rc.*2init.*2inet* restrt

    Ginall, ou should seeAStopping *inetdA ; MQ < Starting *inetdA ; MQ ou can use these same steps ao'e to get ms=l and ftp running. Beplace httpdwith ms=l, and telnet with wu-ftpd. 9lwas rememer there is a difference

    etween configuration and startup files under initd and *inetd.

    &opes this helps ou get goingO Special thanks to 8ohn for his inspiration and to0om for catching a tpo that could ha'e mislead readersO

    9ll of these commands should work from our command prompt(regardless which shell ouNre using). 8ust in case some folks were not aware, ou

    S0 press enter to in'oke the command and the "@A stands for e*ample and isnot part of the command. Commands are denoted in courier tpe font. 9nd ofcourse, if the donNt work or help ou, we appologi!eO

    >sic inu ,ommn*s NOTEA9ll of these commandsshouldwork from our command prompt (regardlesswhich shell ouNre using).

    Command Summar se

    se cd to changedirectories

    0pe cd followed the name of a director to accessthat director.Qeep in mind that ou are alwas in a director andallowed access to an directories hierarchicall ao'eor elow. "*Acd games$f the director games is not located hierarchicall

    elow the current director, then the complete pathmust e written out. "*Acd :usr:games

    0o mo'e up one director, use the shortcut command."*Acd ..

    se finger to see whoNson the sstem

    0ping finger allows ou to see who else is on thesstem or get detailed information aout a person whohas access to the sstem.0pe finger followed the name of a userNs account to

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    29/83

    PCCOE, Nigdi Department ofComputer Engineering

    get information aout that user. Mr, tpe finger andpress enter to see whoNs on the sstem and what theare doing. "*A

    finger Kohndoe

    se logout to =uit usingthe sstem

    >ep, ou guessed it, tping logout will log ouraccount out of the sstem.0pe logout at the prompt to disconnect from ourinu* machine or to logout a particular user sessionfrom the sstem. Qeep in mind that althoughrudimentar, lea'ing our critical account logged onma e a securit concern. /e alwas recommend

    promptl using logout when ou are finished usingour root accountO "*A

    logout

    se ls to list files anddirectories

    0pe ls to see a list of the files and directories locatedin the current director. $f oure in the directornamed games and ou tpe ls, a list will appear thatcontains files in the games director and su-directories in the games director. "*amplesAls aills :usr:in0pe ls -alt to see a list of all files (including .rc files)

    and all directories located in the current director. 0helisting will include detailed, often useful information."*amplesAls -altls -alt :usr:in$f the screen flies and ou miss seeing a numer offiles, tr using the more at the end likeAls -alt more

    T $n 7ash (inu* shell) often the are'iated command is a'ailale. 0o get a 'erose listing of files anddirectories ou could therefore simpl tpeA l

    se man to pull upinformation aout ainu* command

    0pe man followed a command to get detailedinformation aout how to use the command. "*Aman ls0pe man -k followed a word to list all of the

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    30/83

    PCCOE, Nigdi Department ofComputer Engineering

    commands and descriptions that contain the word ouspecified. "*Aman -k finger

    se more to read thecontents of a file

    0pe more followed the name of a te*t file to readthe files contents. /h do we e*mphasi!e using thison a te*t fileF 7ecause most other tpes of files willlook like garageO "*Amore testfile.t*t

    se passwd to changeour current password

    0pe passwd and press enter. >ouNll see the messageChanging password for ourname.9t the Mld passwordA prompt, tpe in our old

    password .0hen, at the "nter new passwordA prompt, tpe in ournew password .0he sstem doule checks our new password. 7esidethe 6erifA prompt, tpe the new password and pressagain.

    Create a secure password that comines parts of wordsand numers. Gor instance, our dogNs name ma eBufus. &e ma ha'e een orn in 1555. Create a

    password that uses parts of oth the name and date of

    irth, such as 55rufu. 0his is a fairl secure passwordand eas to rememer.

    se print to print a file. 0pe print filename . 7e sure to replace the wordfilename with a name of a te*t file. Printing the filedoesnt take 'er long, so run o'er to the printer andsee if it worked.

    Some alternati'e optionsA/ant to print to a lan printerF >oull ha'e to refer tothe network configuration section to make sure ourinu* is read for printing across the network. Mfcourse, ou could tr and see what happens holdingshift and pressing Print Screen when 'iewing a file tosee if it works.

    /ant to print out on our own personal printerF sing

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    31/83

    PCCOE, Nigdi Department ofComputer Engineering

    the printscreen ke or a screen capture command ismost con'enient.

    se pwd to list thename of our currentdirector

    0pe pwd and hit enter. >ouNll see the full name of thedirector ou are currentl in. 0his is our directorpath and is 'er hand. 0his is especiall hand whenou forget which director ou'e changed to and aretring to run other commands.

    ?ni%u(ting "i(es

    CommandSummar se

    Chmod 0he chmod command allows ou to alter access rights to files anddirectories. 9ll files and directories ha'e securit permissions thatgrant the user particular groups or all other users access.

    0o 'iew our filesN settings, at the shell prompt tpeA ls -alt

    >ou should see some files with the following in front of them (ane*ample follows)Atotal 4

    drw*rwsr-* reallli reallli 124 9pr 14A# .drw*r-s--* 22 reallli reallli 124 ar # 13A2 ..d-w*-w*-w* # reallli reallli 124 9pr 14A# contentdrw*r-*r-* 2 reallli reallli 124 ar 2+ 2A4# files

    /hat do the letters mean in front of the files:directories meanFr indicates that it is readale (someone can 'iew the files contents)w indicates that it is writale (someone can edit the files contents)* indicates that it is e*ecutale (someone can run the file, ife*ecutale)

    - indicates that no permission to manipulate has een assigned

    /hen listing our files, the first character lets ou know whetheroure looking at a file or a director. $ts not part of the securitsettings. 0he ne*t three characters indicate >our access restrictions.0he ne*t three indicate our groupNs permissions, and finall otherusersN permissions.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    32/83

    PCCOE, Nigdi Department ofComputer Engineering

    se chmod followed the permission ou are changing. $n 'ersimple form this would eAchmod ++ filename0he e*ample ao'e will grant ou full rights, group rights to e*ecuteand read, and all others access to e*ecute the file.

    U Permission

    Gull

    read and write

    +read ande*ecute

    4 read onl

    #write ande*ecute

    2 write onl

    1 e*ecute onl

    ?one

    Still confusedF se the tale ao'e to define the settings for thethree users. $n the command, the first numer refers to our

    permissions, the second refers to group, and the third refers to

    general users.

    0ping the commandA chmod +1 filename

    gi'es ou full access, the group read and e*ecute, and all otherse*ecute onl permission.

    cp 0pe cp followed the name of an e*isting file and the name of thenew file.

    "*Acp newfile newerfile0o cop a file to a different director (without changing the files name), specif the director instead of the newfilename. "*A

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    33/83

    PCCOE, Nigdi Department ofComputer Engineering

    cp newfile testdir0o cop a file to a different director and create a new file name, ouneed to specif a director:a new file name. "*A

    cp newfile testdir:newerfilecp newfile ..:newerfile0he .. represents one director up in the hierarch.

    Gile 0pe file followed the name of an e*isting file in the director.

    "*Afile emergenc#Vdemo.e*e

    M0P0A S-%MS e*ecutale ("@")

    0his command allows ou to figure out what the file tpe is and howto use it. Gor instance the command will tell ou whether it is ane*ecutale, a compressed file and which tpe, or something unusual.

    0his command is simplistic, ut often can allow ou to determinewh a file does not respond the wa ou e*pect.

    ' 0pe m' followed the current name of a file and the new name ofthe file.

    "*Am' oldfile newfile

    0pe m' followed the name of a file and the new director whereouNd like to place the file. "*Am' newfile testdir0his mo'es the file named newfile to an e*isting director namedtestdir. 7e certain oure specifing a directorname or the m' command alters the name of the file instead ofmo'ing it.

    rm 0pe rm followed the name of a file to remo'e the file.

    "*Arm newfilese the wildcard character to remo'e se'eral files at once. "*A

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    34/83

    PCCOE, Nigdi Department ofComputer Engineering

    rm nT0his command remo'es all files eginning with n.0pe rm -i followed a filename if oud like to e prompted

    efore the file is actuall remo'ed. "*Arm -i newfilerm -i nT7 using this option, ou ha'e a chance to 'erif the remo'al ofeach file. 0he -i option is 'er hand when remo'inga numer of files using the wildcard character T.

    Director! Re(te* ,ommn*s

    CommandSummar se

    Cd se cd to change directories. 0pe cd followed the name of adirector to access that director. Qeep in mind that ou are alwasin a director and can na'igate to directories hierarchicall ao'e or

    elow. "*Acd games$f the director games is not located hierarchicall elow the currentdirector, then the complete path must ewritten out. "*A

    cd :usr:games0o mo'e up one director, use the shortcut command. "*Acd ..

    se cp -r to cop a director and all of its contents0pe cp -r followed the name of an e*isting director and thename of the new director. "*Acp -r testing newdir>ou must include the -r or oull see the following messageAcpA testing is a director and -r not specified.

    0his command sa'es ou time if ou need to make a mirror image ofa director packed with files.

    kdir se mkdir to make:create a rand new director0pe mkdir followed the name of a director. "*Amkdir testdir

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    35/83

    PCCOE, Nigdi Department ofComputer Engineering

    ' se m' to change the name of a director0pe m' followed the current name of a director and the newname of the director. "*A

    m' testdir newnamedir

    Pwd

    0ring to find out where on our inu* ser'er ou currentl arelocatedF 0he pwd (print working director) command will show outhe full path to the director ou are currentl in. 0his is 'er handto use, especiall when performing some of the other commands onthis pageO

    Bmdir se rmdir to remo'e an e*isting director (assuming ou ha'epermissions set to allow this).0pe rmdir followed a directorNs name to remo'e it. "*Armdir testdir

    >ou C9?N0 remo'e a director that contains files with thiscommand. 9 more useful command is rm -r that remo'es directoriesand files within the directories. >ou can read more aout this inCommands for 7eginning 9dmins

    0he rmdir command is used mostl to remo'e empt directories. $fou ha'e a desire to use this command then ouNll need to delete ormo'e the files efore attempting to remo'e a full director. Gor more

    help please read the m' command and also Gile Belated Commands.

    &ome ?ore commn*s

    CommandSummar se

    %u

    0he du command prints a summar of the amount ofinformation ou ha'e stored in our directories on themounted disks.snta*A du ;options< pathe*A du -a :?ews

    MptionsA-s print the sum of tes in our directories-a print a line for each file in our director

    Erep 0he grep command searches te*t files for a particular

    http://www.reallylinux.com/docs/admin.shtmlhttp://www.reallylinux.com/docs/files.shtmlhttp://www.reallylinux.com/docs/admin.shtmlhttp://www.reallylinux.com/docs/files.shtml
  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    36/83

    PCCOE, Nigdi Department ofComputer Engineering

    word or string of words. 6er helpful when tring tofind that needle in a hastack, like a particular line in alarge log file.

    snta*A grep te*tstring filename(s)e*A grep centur histor.te*t.doc

    &ead

    0ail

    headA prints the eginning of a te*t filetailA prints the end of a te*t file0hese commands allow ou to 'iew parts of a te*t file.e*A tail -+ te*tfile.t*t0he e*ample ao'e will print the last + lines of the filete*tfile.t*t.

    ocate

    0ring to find out where on our inu* ser'er aparticular file residesF &a'ing a real nast time doingitF $f ou ha'e the 7ash shell ou can tr using thelocate command to identif where it is on our mounteddri'es.0peA locate filename and press enter. Beplace filenamewith the name of the file ou are looking for. 0his is areal time sa'ing command as ou start na'igating ourinu* ser'erO$f locate does not work for ou tr using which.

    ?ice

    ?ohup

    ?iceA runs programs:commands at a lower sstem

    priorit?ohupA runs nice programs e'en when oure loggedoff the sstem7 using the two commands simultaneousl, our large

    processes can continue to run, e'en when ou ha'elogged off the sstem and are rela*ing."*A nice nohup c program.c .0his command will allow the c compiler to compile

    program.c e'en when ou ha'e logged off the sstem.

    ps

    related to stoppedKos

    0he ps command displas all of the e*isting processes.0his command is also directl linked to issues withstopped processes (also known as stopped Kos).Mccasionall, ou ma see the message 0here areStopped 8os.$f ou log off the sstem without properl stopping our

    Kos, some Kos:processes ma remain in memor ting

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    37/83

    PCCOE, Nigdi Department ofComputer Engineering

    up the sstem and drawing unnecessar processingandwidth.

    0pe ps and hit enter. 0his will list all of our currentprocesses running, or stopped.

    P$% 00 S090 0$" CM9?%2## pl S A -csh2# pl B A 'i

    0he numer under P$% is the process identificationnumer. 0o kill a process that is stopped, tpeA kill pid.Beplace pid with the e*act numer of the process.

    "*A /hile in 6i, ou accidentall press the wrong kes.6iNs operation is stopped and ou are kicked ack to the

    prompt. 0o kill the stopped 6i command, ou ma tpeAkill 2#.

    St

    0he stt command allows ou to 'iew a listing of ourcurrent terminal options. 7 using this command, oucan also remap keoard kes, tailoring to our needs."*A stt and hit enter. 0his lists our terminal settings."*A stt eraseWXh . 0his remaps our erase ke

    (ackspace) to the Ctrl and h kes. Grom now on,holding down Ctrl and pressing h will cause a

    ackspace. So ouNre scratching our head asking whis this handF >ouNll see at some point how stt is alsoused for a numer of other useful settings.

    0alk

    $n order to contact someone who is on the sstem, at theprompt ou tpeA talk accountname . Beplaceaccountname with the full account name of the person.$f ou dont want anone to distur ou using the talkcommand, at the prompttpeA mesg n. 0his pre'ents others from using talk toreach ou.

    tar

    also related to g!ip

    >ouNre ound to come across files that are g-!ipped andtarred. Mka, now whatF 0hese are methods ofcompressing and storing directories and files in a singlefile. ost new inu* programs come off the we as

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    38/83

    PCCOE, Nigdi Department ofComputer Engineering

    something like coolnew-game.4-4-1.g!. 0his file islikel a tar file that has then een g!ipped forcompression. 0he wa to handle these files is simple,

    ut re=uires that ou put the file into an appropriatedirector. $n other words, donNt plop the file in our rootor :in unless it elongs there.

    ?ow ou can do a one fell swoop un-g!ip it and untar itinto its original form (usuall multiple files in man sudirectories) tpingA tar -*'!f T.g!

    0his will programmaticall un-g!ip and then untar allfiles in the current director into their full original form

    including su-directories etc. Please e careful whereand how ou run thisO

    /

    0his command allows ou to list all users and theirprocesses who are currentl logged in to the inu*ser'er, or a particular users processes. 0peA w to 'iewall users processes. 0peA w Ksmith to 'iew Ksmiths

    processes. /e use this all the time from a sstem adminstandpoint. Please also see more commands to get userinformation on this page. >ou need to know who logs

    on to our sstemO Mka, so ou ha'e a stand aloneinu* o* and no one else uses itF 0r this commandKust to e sure. Y)

    OO %ont waste time and energ retping commands at theprompt. $nstead, use the O option. 0o automaticall re-displa the last command ou tped at the prompt, tpeAOO and press enter. Press again to in'oke the command.>ou can also automaticall re-displa a command outped earlier using the O and the first few letters ofthe command."*A 9t the inu* prompt ou had tped the commandclear, followed the command pico, followed thecommand ftp. $n order to re-displa the clear commandou tpeA Ocl and press enter. $n order to re-displa thelast command ou tped, simpl tpeA OO . 0r it out.>oull find this a time sa'er when dealing with long

    http://www.reallylinux.com/docs/admin.shtmlhttp://www.reallylinux.com/docs/admin.shtml
  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    39/83

    PCCOE, Nigdi Department ofComputer Engineering

    commands. "speciall commands like tarO

    Assignment No.: 07

    Aim:

    $nstallation and configuration we ser'er (Client-ser'er ased)

    Objective:

    0o understand

    1. Concept of we ser'er2. /orking of we ser'er#. $nstallation of the $$S ser'er4. Configuration of $$S ser'er

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    40/83

    PCCOE, Nigdi Department ofComputer Engineering

    Teor!:

    "laorate the following points

    1. /e ser'er2. %ifferent we se'ers a'ailale in market.#. $nstillation steps of 9pache.4. Configuration of 9pache.

    Inst(( A%ce

    1.Bun %ce@$.0.77-)in+$-B-no@ss(.msi.

    2.Choose $ accept the terms in the license agreement, and then click Net C.

    #.Click Net C.

    4.Gill in the appropriate information. Select for 9ll sers, on Port 3, as aSer'ice, and then click Net C. $f ou do not know what to enter, ou can put inlocalhost for the network domain and ser'er name.

    +.Choose 0pical, and then click Net C.

    .Click Net C.

    . Click Inst((.

    3. Click "inis

    5. $f ou ha'e /indows Girewall enaled, select 5nb(oc3on the /indowsSecurit 9lert. Gor other firewalls, make sure port 3 is open.

    APPI,ATION&

    1.sed to de'elop the client ser'er applications using differenttechnologies.

    ,onc(usion:

    Succeful install 9pache Ser'er.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    41/83

    PCCOE, Nigdi Department ofComputer Engineering

    "A#&

    1. 9t is *i''erence II& 2 P9& A%ce &erver

    $. o) to run A%ce on 9in*o)s O%erting &!stem

    +. 9ic is better server 'or )eb *eve(o%ment

    Assignment No.: 0B

    Aim:

    /rite a program using socket programming for 0CP preferal in C.

    Objective:

    0o understand

    1. /hat is Socket

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    42/83

    PCCOE, Nigdi Department ofComputer Engineering

    2. /hat is 0CP#. Client and Ser'er connecti'it

    1. &ow to create Socket2. &ow to estalish connection with socket

    Teor!:

    "laorate the following points

    1. 0CP2. Socket#. Client and ser'er operation

    4. %ifferent sstem calls used in program

    Procedure for 0CP for client A

    1. Create a socket on client side.2. 9ssign destination address Z port to sockaddrVin structure.#. Client connects to the ser'er using connectD function.4. $t sends message to ser'er using D writeD function.+. Becei'e repl from echo ser'er using readD function... Close the socket.

    Procedure for 0CP for ser'er A

    1. Create a socket on client side.2. 9ssign destination address Z port to sockaddrVin structure.#. Ser'er inds to the source address Z port.4. Ser'er listens clients re=uest using listenD function.+. Ser'er will accept re=uest from the client using acceptD function

    Z it will create new socket for further communication etweenclient Z ser'er.

    . Ser'er will read the message sent client using readD function.. Sends repl to the Client using writeD function.

    In%ut:

    Send an file.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    43/83

    PCCOE, Nigdi Department ofComputer Engineering

    Out%ut:

    Betrie'e the data and ask from ser'er socket.

    A(goritm2"(o)crt:

    1. Create socket the SMCQ"0 ( ) sstem call2. 7ind the socket 7$?%( ) sstem call#. sing CM??"C0( ) sstem call to connect client to the ser'er4. %ata transfer etween ser'er and client

    ,onc(usion:

    Succesful implemented 0CP socket.

    "A#s:

    1. 9t is &oc3et

    $. Di''erence bet)een T,P n* 5DP

    +. E%(in ,ONNE,T F G n* >INDF G

    Assignment No.: 0H

    Aim:

    /rite a program using socket programming for %P preferal in C.

    Objective:

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    44/83

    PCCOE, Nigdi Department ofComputer Engineering

    0o understand

    1. /hat is Socket2. /hat is %P#. Client and Ser'er connecti'it4. %ifference etween 0CP and %P+. 9pplications

    Teor!:

    "laorate the following points

    1. %P

    2. Socket#. %ifference etween 0CP and %P4. Client and ser'er operation+. %ifferent sstem calls used in program

    Proce*ure:

    Procedure for %P for client A

    1. Create a socket on client side.

    2. 9ssign destination address Z port to sockaddrVin structure.#. Client sends the string using Sentto function.4. Becei'e repl from echo ser'er.+. Close the socket.

    Procedure for %P for ser'er A

    1. Create a socket on client side.2. 9ssign destination address Z port to sockaddrVin structure.#. Ser'er inds to the source address Z port.

    4. Ser'er recei'es re=uest from client usig rece'prompt function.+. Sends repl to client using Send to function.

    In%ut:

    Send an file.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    45/83

    PCCOE, Nigdi Department ofComputer Engineering

    Out%ut:

    Betrie'e the data and ask from ser'er socket.

    A(goritm2"(o)crt:

    1. Create socket the SMCQ"0 ( ) sstem call2. 7ind the socket 7$?%( ) sstem call#. sing CM??"C0( ) sstem call to connect client to the

    ser'er4. %ata transfer etween ser'er and client

    ,onc(usion:

    Succesful implemented %P socket.

    Assignment No.: 0

    Aim:

    %esign a wesite using &0 for an application.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    46/83

    PCCOE, Nigdi Department ofComputer Engineering

    Objectives:

    1. 0o learn Z understand the asic concepts of we page designing.2. 0o design we page using different tpes of tags.

    Teor!:

    What is an HTML File?

    &0 stands for per Te*t ?arkup anguage 9n &0 file is a te*t file containing small mr3u% tgs 0he markup tags tell the /e rowser o) to *is%(!the page 9n &0 file must ha'e an tmor tm(file e*tension

    9n &0 file can e created using a sim%(e tet e*itor

    HTML Tags

    &0 tags are used to mark-up &0 e(ements &0 tags are surrounded the t)o crcters n* C 0he surrounding characters are called ng(e brc3ets &0 tags normall come in %irslike [I and [:I 0he first tag in a pair is the strt tg;the second tag is the en* tg 0he te*t etween the start and end tags is the e(ement content

    &0 tags are not cse sensitive;[I means the same as [7I

    &0 0e*t Gormatting

    &0 defines a lot of elements for formatting output, like old or italic te*t.

    Text Formatting Tags

    0ag Descri%tion

    [I %efines old te*t

    [igI %efines ig te*t

    [emI %efines emphasi!ed te*t

    [iI %efines italic te*t

    [smallI %efines small te*t

    [strongI %efines strong te*t

    http://www.w3schools.com/tags/tag_font_style.asphttp://www.w3schools.com/tags/tag_font_style.asphttp://www.w3schools.com/tags/tag_phrase_elements.asphttp://www.w3schools.com/tags/tag_font_style.asphttp://www.w3schools.com/tags/tag_font_style.asphttp://www.w3schools.com/tags/tag_phrase_elements.asphttp://www.w3schools.com/tags/tag_font_style.asphttp://www.w3schools.com/tags/tag_font_style.asphttp://www.w3schools.com/tags/tag_phrase_elements.asphttp://www.w3schools.com/tags/tag_font_style.asphttp://www.w3schools.com/tags/tag_font_style.asphttp://www.w3schools.com/tags/tag_phrase_elements.asp
  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    47/83

    PCCOE, Nigdi Department ofComputer Engineering

    [suI %efines suscripted te*t

    [supI %efines superscripted te*t

    [insI %efines inserted te*t

    [delI %efines deleted te*t

    [sI %eprecated. se [delI instead

    [strikeI %eprecated. se [delI instead

    [uI %eprecated. se stles instead

    T? Tb(es :

    0ales are defined with the [taleI tag. 9 tale is di'ided into rows (with the

    [trI tag), and each row is di'ided into data cells (with the [tdI tag). 0he letterstd stands for tale data, which is the content of a data cell. 9 data cell cancontain te*t, images, lists, paragraphs, forms, hori!ontal rules, tales, etc.

    Table Tags

    Tg Descri%tion

    [taleI %efines a tale

    [thI %efines a tale header

    [trI %efines a tale row

    [tdI %efines a tale cell

    [captionI %efines a tale caption

    [colgroupI %efines groups of tale columns

    [colI %efines the attriute 'alues for one or more columns in a tale

    [theadI %efines a tale head

    [todI %efines a tale od

    [tfootI %efines a tale footer

    9it T? !ou cn *is%(! imges in *ocument.

    Image Tags

    Tg Descri%tion

    http://www.w3schools.com/tags/tag_sup.asphttp://www.w3schools.com/tags/tag_sup.asphttp://www.w3schools.com/tags/tag_ins.asphttp://www.w3schools.com/tags/tag_del.asphttp://www.w3schools.com/tags/tag_strike.asphttp://www.w3schools.com/tags/tag_strike.asphttp://www.w3schools.com/tags/tag_u.asphttp://www.w3schools.com/tags/tag_th.asphttp://www.w3schools.com/tags/tag_tr.asphttp://www.w3schools.com/tags/tag_td.asphttp://www.w3schools.com/tags/tag_caption.asphttp://www.w3schools.com/tags/tag_colgroup.asphttp://www.w3schools.com/tags/tag_col.asphttp://www.w3schools.com/tags/tag_thead.asphttp://www.w3schools.com/tags/tag_tbody.asphttp://www.w3schools.com/tags/tag_tfoot.asphttp://www.w3schools.com/tags/tag_sup.asphttp://www.w3schools.com/tags/tag_sup.asphttp://www.w3schools.com/tags/tag_ins.asphttp://www.w3schools.com/tags/tag_del.asphttp://www.w3schools.com/tags/tag_strike.asphttp://www.w3schools.com/tags/tag_strike.asphttp://www.w3schools.com/tags/tag_u.asphttp://www.w3schools.com/tags/tag_th.asphttp://www.w3schools.com/tags/tag_tr.asphttp://www.w3schools.com/tags/tag_td.asphttp://www.w3schools.com/tags/tag_caption.asphttp://www.w3schools.com/tags/tag_colgroup.asphttp://www.w3schools.com/tags/tag_col.asphttp://www.w3schools.com/tags/tag_thead.asphttp://www.w3schools.com/tags/tag_tbody.asphttp://www.w3schools.com/tags/tag_tfoot.asp
  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    48/83

    PCCOE, Nigdi Department ofComputer Engineering

    [imgI %efines an image

    [mapI %efines an image map

    [areaI %efines a clickale area inside an image map

    T? "orms n* In%ut

    &0 Gorms are used to select different kinds of user input.

    Forms

    9 form is an area that can contain form elements.

    Gorm elements are elements that allow the user to enter information (like te*tfields, te*tarea fields, drop-down menus, radio uttons, checko*es, etc.) in aform.

    Form Tags

    Tg Descri%tion

    [formI %efines a form for user input

    [inputI %efines an input field

    [te*tareaI %efines a te*t-area (a multi-line te*t input control)[laelI %efines a lael to a control

    [fieldsetI %efines a fieldset

    [legendI %efines a caption for a fieldset

    [selectI %efines a selectale list (a drop-down o*)

    [optgroupI %efines an option group

    [optionI %efines an option in the drop-down o*

    [uttonI %efines a push utton

    [isinde*I %eprecated. se [inputI instead

    Proce*ure:

    %esign said form using re=uired tags.

    http://www.w3schools.com/tags/tag_img.asphttp://www.w3schools.com/tags/tag_map.asphttp://www.w3schools.com/tags/tag_area.asphttp://www.w3schools.com/tags/tag_form.asphttp://www.w3schools.com/tags/tag_input.asphttp://www.w3schools.com/tags/tag_textarea.asphttp://www.w3schools.com/tags/tag_label.asphttp://www.w3schools.com/tags/tag_fieldset.asphttp://www.w3schools.com/tags/tag_legend.asphttp://www.w3schools.com/tags/tag_select.asphttp://www.w3schools.com/tags/tag_optgroup.asphttp://www.w3schools.com/tags/tag_option.asphttp://www.w3schools.com/tags/tag_button.asphttp://www.w3schools.com/tags/tag_img.asphttp://www.w3schools.com/tags/tag_map.asphttp://www.w3schools.com/tags/tag_area.asphttp://www.w3schools.com/tags/tag_form.asphttp://www.w3schools.com/tags/tag_input.asphttp://www.w3schools.com/tags/tag_textarea.asphttp://www.w3schools.com/tags/tag_label.asphttp://www.w3schools.com/tags/tag_fieldset.asphttp://www.w3schools.com/tags/tag_legend.asphttp://www.w3schools.com/tags/tag_select.asphttp://www.w3schools.com/tags/tag_optgroup.asphttp://www.w3schools.com/tags/tag_option.asphttp://www.w3schools.com/tags/tag_button.asp
  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    49/83

    PCCOE, Nigdi Department ofComputer Engineering

    A%%(ictions:

    1.5se* to *esign te )eb %ges 'or )eb-bse* %%(ictions.

    "A#&:

    1. /hat are the different tpes of tags supported &0 F2. /hat are the different issues used to design a we page F#. /hether the components of a we page affects the speed of accessF

    &ow F

    Assignment No.: 0J

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    50/83

    PCCOE, Nigdi Department ofComputer Engineering

    Aim:

    %esign dnamic we pages and 'alidate them using 67 script or 8969script.

    Objectives:

    1. 0o learn Z understand client side 'alidation of we page using 8969script.

    Teor!:

    What is JavaScript?

    8a'aScript was designed to add interacti'it to &0 pages 8a'aScript is a scripting language (a scripting language is a lightweight

    programming language) 9 8a'aScript consists of lines of e*ecutale computer code 9 8a'aScript is usuall emedded directl into &0 pages 8a'aScript is an interpreted language (means that scripts e*ecute without

    preliminar compilation) "'erone can use 8a'aScript without purchasing a license

    What can a JavaScript Do?

    Kv&cri%t gives T? *esigners %rogrmming too( - &0 authorsare normall not programmers, ut 8a'aScript is a scripting language witha 'er simple snta*O 9lmost anone can put small snippets of code intotheir &0 pages

    Kv&cri%t cn %ut *!nmic tet into n T? %ge - 9 8a'aScriptstatement like thisA document.write([h1I \ name \ [:h1I) can write a'ariale te*t into an &0 page

    Kv&cri%t cn rect to events - 9 8a'aScript can e set to e*ecute when

    something happens, like when a page has finished loading or when a userclicks on an &0 element

    Kv&cri%t cn re* n* )rite T? e(ements - 9 8a'aScript can readand change the content of an &0 element

    Kv&cri%t cn be use* to v(i*te *t - 9 8a'aScript can e used to'alidate form data efore it is sumitted to a ser'er, this will sa'e theser'er from e*tra processing

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    51/83

    PCCOE, Nigdi Department ofComputer Engineering

    Kv&cri%t cn be use* to *etect te visitorLs bro)ser - 9 8a'aScriptcan e used to detect the 'isitorNs rowser, and - depending on the rowser- load another page specificall designed for that rowser

    Kv&cri%t cn be use* to crete coo3ies- 9 8a'aScript can e used to storeand retrie'e information on the 'isitorNs computer

    JavaScript Functions

    0o keep the rowser from e*ecuting a script as soon as the page is loaded, oucan write our script as a function.

    9 function contains some code that will e e*ecuted onl an e'ent or a call

    to that function.

    >ou ma call a function from anwhere within the page (or e'en from otherpages if the function is emedded in an e*ternal .Ks file).

    Gunctions are defined at the eginning of a page, in the [headI section.

    Em%(e

    [htmlI

    [headI

    [script tpeRte*t:Ka'ascriptI

    function displamessage()

    ]

    alert(&ello /orldO)

    ^

    [:scriptI

    [:headI

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    52/83

    PCCOE, Nigdi Department ofComputer Engineering

    [odI

    [formI

    [input tpeRutton 'alueRClick meO

    onclickRdisplamessage() I

    [:formI

    [:odI

    [:htmlI

    $f the lineA alert(&ello worldOO), in the e*ample ao'e had not een writtenwithin a function, it would ha'e een e*ecuted as soon as the line was loaded.

    ?ow, the script is not e*ecuted efore the user hits the utton. /e ha'e added anonClick e'ent to the utton that will e*ecute the function displamessage() whenthe utton is clicked.

    How to Define a Function

    0he snta* for creating a function isA

    functionfunctionname(var1var!...var")

    ]

    some code

    ^

    'ar1, 'ar2, etc are 'ariales or 'alues passed into the function. 0he ] and the ^defines the start and end of the function.

    Note:9 function with no parameters must include the parentheses () after thefunction nameA

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    53/83

    PCCOE, Nigdi Department ofComputer Engineering

    functionfunctionname()

    ]

    some code

    ^

    Note:%o not forget aout the importance of capitals in 8a'aScriptO 0he wordfunction must e written in lowercase letters, otherwise a 8a'aScript error occursO9lso note that ou must call a function with the e*act same capitals as in thefunction name.

    The return Statement

    0he return statement is used to specif the 'alue that is returned from thefunction.

    So, functions that are going to return a 'alue must use the return statement.

    Em%(e

    0he function elow should return the product of two numers (a and )A

    function total(a,)

    ]

    *RaT

    return *

    ^

    /hen ou call the function ao'e, ou must pass along two parametersA

    productRtotal(2,#)

    0he returned 'alue from the total() function is , and it will e stored in the'ariale called product.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    54/83

    PCCOE, Nigdi Department ofComputer Engineering

    Events

    7 using 8a'aScript, we ha'e the ailit to create dnamic we pages. "'ents areactions that can e detected 8a'aScript.

    "'er element on a we page has certain e'ents which can trigger 8a'aScriptfunctions. Gor e*ample, we can use the onClick e'ent of a utton element toindicate that a function will run when a user clicks on the utton. /e define thee'ents in the &0 tags.

    "*amples of e'entsA

    9 mouse click

    9 we page or an image loading ousing o'er a hot spot on the we page Selecting an input o* in an &0 form Sumitting an &0 form 9 kestroke

    0he following tale lists the e'ents recogni!ed 8a'aScriptA

    Note:"'ents are normall used in comination with functions, and the functionwill not e e*ecuted efore the e'ent occursO

    onloa an on!nloa

    0he onload and onnload e'ents are triggered when the user enters or lea'es thepage.

    0he onload e'ent is often used to check the 'isitorNs rowser tpe and rowser'ersion, and load the proper 'ersion of the we page ased on the information.

    7oth the onload and onnload e'ents are also often used to deal with cookies

    that should e set when a user enters or lea'es a page. Gor e*ample, ou couldha'e a popup asking for the userNs name upon his first arri'al to our page. 0hename is then stored in a cookie. ?e*t time the 'isitor arri'es at our page, oucould ha'e another popup saing something likeA /elcome 8ohn %oeO.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    55/83

    PCCOE, Nigdi Department ofComputer Engineering

    onFocus" on#lur an on$hange

    0he onGocus, on7lur and onChange e'ents are often used in comination with'alidation of form fields.

    7elow is an e*ample of how to use the onChange e'ent. 0he check"mail()function will e called whene'er the user changes the content of the fieldA

    [input tpeRte*t si!eR#idRemail onchangeRcheck"mail()IY

    onSu%mit

    0he onSumit e'ent is used to 'alidate 9 form fields efore sumitting it.

    7elow is an e*ample of how to use the onSumit e'ent. 0he checkGorm()function will e called when the user clicks the sumit utton in the form. $f thefield 'alues are not accepted, the sumit should e cancelled. 0he functioncheckGorm() returns either true or false. $f it returns true the form will esumitted, otherwise the sumit will e cancelledA

    [form methodRpost actionR***.htmonsumitRreturn checkGorm()I

    onMouse&ver an onMouse&ut

    onouseM'er and onouseMut are often used to create animated uttons.

    7elow is an e*ample of an onouseM'er e'ent. 9n alert o* appears when anonouseM'er e'ent is detectedA

    [a hrefRhttpA::www.w#schools.com

    onmouseo'erRalert(N9n onouseM'er e'entN)Yreturn falseI

    [img srcRw#schools.gif widthR1 heightR#I

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    56/83

    PCCOE, Nigdi Department ofComputer Engineering

    [:aI

    Proce*ure :

    1.Create an &0 form for Koining report to the new class.

    2. $dentif the different e'ents Z write down the script with differentfunctions.

    #. Call the re=uired functions using suitale e'ents in the form for'alidation.

    Assignment No.: 10

    Aim:

    /rite a P&P script to access the data from assignment no 5 .

    Teor!:

    P&P is a powerful tool for making dnamic and interacti'e /e pages.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    57/83

    PCCOE, Nigdi Department ofComputer Engineering

    What is 'H'?

    P&P stands for P&PA perte*t Preprocessor P&P is a ser'er-side scripting language, like 9SP P&P scripts are e*ecuted on the ser'er P&P supports man dataases (S_, $nformi*, Mracle, Sase, Solid,

    PostgreS_, Eeneric M%7C, etc.) P&P is an open source software (MSS) P&P is free to download and use

    What is a 'H' File?

    P&P files ma contain te*t, &0 tags and scripts

    P&P files are returned to the rowser as plain &0 P&P files ha'e a file e*tension of .php, .php#, or .phtml

    Wh( 'H'?

    P&P runs on different platforms (/indows, inu*, ni*, etc.) P&P is compatile with almost all ser'ers used toda (9pache, $$S, etc.) P&P is GB"" to download from the official P&P resourceA www.php.net P&P is eas to learn and runs efficientl on the ser'er side

    Where to Start?

    $nstall an 9pache ser'er on a /indows or inu* machine $nstall P&P on a /indows or inu* machine

    #asic 'H' S(ntax

    9 P&P file normall contains &0 tags, Kust like an &0 file, and some P&Pscripting code.

    7elow, we ha'e an e*ample of a simple P&P script which sends the te*t &ello/orld to the rowserA

    [htmlI

    [odI

    http://www.php.net/http://www.php.net/
  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    58/83

    PCCOE, Nigdi Department ofComputer Engineering

    [Fphp echo &ello /orldY FI

    [:odI

    [:htmlI

    9 P&P scripting lock alwas starts with %% and ends with C. 9 P&Pscripting lock can e placed anwhere in the document.

    "ach code line in P&P must end with a semicolon. 0he semicolon is a separatorand is used to distinguish one set of instructions from another.

    0here are two asic statements to output te*t with P&PA ecoand %rint. $n thee*ample ao'e we ha'e used the echo statement to output the te*t &ello /orld.

    'H' Form Hanling

    0he most important thing to notice when dealing with &0 forms and P&P isthat an form element in an &0 page will utomtic((!e a'ailale to ourP&P scripts.

    ook at the following e*ample of an &0 formA

    [htmlI

    [odI

    [form actionRwelcome.php methodRPMS0I

    "nter our nameA [input tpeRte*t nameRname :I

    "nter our ageA [input tpeRte*t nameRage :I

    [input tpeRsumit :I

    [:formI

    [:odI

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    59/83

    PCCOE, Nigdi Department ofComputer Engineering

    [:htmlI

    0he e*ample &0 page ao'e contains two input fields and a sumit utton.

    /hen the user fills in this form and hits the sumit utton, the welcome.phpfile is called.

    0he welcome.php file looks like thisA

    [htmlI

    [odI

    /elcome [Fphp echo `VPMS0;nameou are [Fphp echo `VPMS0;age

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    60/83

    PCCOE, Nigdi Department ofComputer Engineering

    Assignment No.: 11

    Aim:

    /rite a program to create 0CP:$P packet using standard 0CP:$P include filesand send it to the ser'er ;inu* platformou must *e'ine !our o)n tgs @ uses a Document T!%e De'inition(%0%) or an X? &cem to

    descrie the data @ with a %0% or @ Schema is designed to e se('-*escri%tive @ is a /#C Becommendation

    &ow can @ e sedF

    @ was designed to store, carr, and e*change data. @ was not designed todispla data.

    )ML can Separate Data from HTML

    @ is used to "*change %ata

    @ can e used to Share %ata

    )ML can %e use to Store Data

    )ML can ma*e (our Data more !seful

    )ML can %e use to $reate new Languages

    X? &!nt

    0he snta* rules of @ are 'er simple and 'er strict. 0he rules are 'er easto learn, and 'er eas to use.

    7ecause of this, creating software that can read and manipulate @ is 'ereas.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    64/83

    PCCOE, Nigdi Department ofComputer Engineering

    +n example )ML ocument

    X? *ocuments use se('-*escribing n* sim%(e s!nt.

    [F*ml 'ersionfilteredR1. encodingR$SM-33+5-1FI

    [noteI

    [toI0o'e[:toI

    [fromI8ani[:fromI

    [headingIBeminder[:headingI

    [@7M%>I%M?N0 p weekendO[*odI[ this me forgetI

    [:noteI

    0he first line in the document - the @ declaration - defines the @ 'ersionand the character encoding used in the document. $n this case the documentconforms to the 1. specification of @ and uses the $SM-33+5-1 (atin-1:/est"uropean) character set.

    0he ne*t line descries the root element of the document (like it was saingA thisdocument is a note)A

    [noteI

    0he ne*t 4 lines descrie 4 child elements of the root (to, from, heading, andod)A

    [toI0o'e[:toI

    [fromI8ani[:fromI

    [headingIBeminder[:headingI

    [@7M%>I%M?N0 p weekendO[*odI[ this me forgetI

    9nd finall the last line defines the end of the root elementA

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    65/83

    PCCOE, Nigdi Department ofComputer Engineering

    [:noteI

    Can ou detect from this e*ample that the @ document contains a ?ote to

    0o'e from 8aniF %onNt ou agree that @ is prett self-descripti'eF

    X? E(ements

    @ "lements are e*tensile and the ha'e relationships.

    @ "lements ha'e simple naming rules.

    @ "lements are "*tensile

    @ documents can e e*tended to carr more information.

    ook at the following @ ?M0" e*ampleA

    [noteI

    [toI0o'e[:toI

    [fromI8ani[:fromI

    [@7M%>I%M?N0 p weekendO[*odI[ this me forgetI

    [:noteI

    o) to )rite n X? Document

    9ll @ elements must ha'e a closing tag.

    @ tags are case sensiti'e.

    9ll @ elements must e properl nested.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    66/83

    PCCOE, Nigdi Department ofComputer Engineering

    +ll )ML ocuments must have a root element,

    +ttri%ute values must alwa(s %e -uote,

    With )ML" white space is preserve,

    With )ML" $. / LF is converte to LF,

    )ML ocuments are Extensi%le,

    )ML Elements have .elationships

    Elements are relate as parents an chilren,

    Elements have $ontent

    Elements can have ifferent content t(pes,

    9n X? e(ement is e'erthing from (including) the elementNs start tag to(including) the elementNs end tag.

    9n element can ha'e e(ementcontent, mie*content, sim%(econtent, or em%t!content. 9n element can also ha'e ttributes.

    $n the e*ample ao'e, ook has e(ement content, ecause it contains otherelements. Chapter has mie* content ecause it contains oth te*t and otherelements. Para has sim%(e content (or tet content) ecause it contains onlte*t. Prod has em%t! content, ecause it carries no information.

    @ 9ttriutes

    @ elements can ha'e attriutes in the start tag, Kust like &0.

    9ttriutes are used to pro'ide additional information aout elements.

    #lement $aming

    X? e(ements must 'o((o) tese nming ru(es:

    ?ames can contain letters, numers, and other characters ?ames must not start with a numer or punctuation character

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    67/83

    PCCOE, Nigdi Department ofComputer Engineering

    ?ames must not start with the letters *ml (or @ or @ml.) ?ames cannot contain spaces

    "ML %T%

    A DTD *e'ines te (eg( e(ements o' n X? *ocument.

    Te %ur%ose o' DTD is to *e'ine te (eg( bui(*ing b(oc3s o' n X?

    *ocument. It *e'ines te *ocument structure )it (ist o' (eg( e(ements

    0he purpose of a %ocument 0pe %efinition is to define the legal uilding locksof an @ document. $t defines the document structure with a list of legalelements.

    9 %0% can e declared inline in our @ document, or as an e*ternalreference.

    0nternal D&$T1'E eclaration

    $f the %0% is included in our @ source file, it should e wrapped in a%MC0>P" definition with the following snta*A

    [O%MC0>P" root-element ;element-declarations

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    68/83

    PCCOE, Nigdi Department ofComputer Engineering

    P" definition with the following snta*A

    [O%MC0>P" root-element S>S0" filenameI

    0his is the same @ document as ao'e, ut with an e*ternal %0%

    [F*ml 'ersionfilteredR1.FI

    [O%MC0>P" note S>S0" note.dtdI

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    69/83

    PCCOE, Nigdi Department ofComputer Engineering

    [noteI

    [toI0o'e[:toI

    [fromI8ani[:fromI

    [headingIBeminder[:headingI

    [@7M%>I%M?N0 p weekendO[*odI[ this me forgetI

    [:noteI

    9nd this is a cop of the file note.dtd containing the %0%A

    [O"""?0 note (to,from,heading,od)I

    [O"""?0 to (UPC%909)I

    [O"""?0 from (UPC%909)I

    [O"""?0 heading (UPC%909)I

    [O"""?0 od (UPC%909)I

    &h' use a %T%(

    /ith %0%, each of our @ files can carr a description of its own format withit.

    /ith a %0%, independent groups of people can agree to use a common %0% forinterchanging data.

    >our application can use a standard %0% to 'erif that the data ou recei'e fromthe outside world is 'alid.

    >ou can also use a %0% to 'erif our own data.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    70/83

    PCCOE, Nigdi Department ofComputer Engineering

    %0% - @ uilding locks

    0he main uilding locks of oth @ and &0 documents are tags like[@7M%>I....[@7M%>I.[ pI

    The %uiling %loc*s of )ML ocuments

    Seen from a %0% point of 'iew, all @ documents (and &0 documents) aremade up the following simple uilding locksA

    "lements 0ags 9ttriutes

    "ntities PC%909 C%909

    0he following is a rief e*planation of each of the uilding locksA

    Elements

    "lements are the min bui(*ing b(oc3sof oth @ and &0 documents.

    "*amples of &0 elements are od and tale. "*amples of @elements could e note and message. "lements can contain te*t, otherelements, or e empt. "*amples of empt &0 elements are hr, r andimg.

    Tags

    0ags are used to mr3u% e(ements.

    9 starting tag like [elementVnameI marks up the eginning of an element, and

    an ending tag like [:elementVnameI marks up the end of an element.

    "*amplesA

    od element marked up with od tagsA

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    71/83

    PCCOE, Nigdi Department ofComputer Engineering

    [@7M%>I7M%> p etween[*odI.[ in te*tI

    message element marked up with message tagsA

    [messageIsome message in etween[:messageI

    )ttributes

    9ttriutes pro'ide etr in'ormtion bout e(ements.

    9ttriutes are alwas placed inside the starting tag of an element. 9ttriutesalwas come in name:'alue pairs. 0he following img element has additional

    information aout a source fileA

    [img srcRhttpA::mail.ahoo.com:config:loginF:computer.gif :I

    0he name of the element is img. 0he name of the attriute is src. 0he 'alueof the attriute is computer.gif. Since the element itself is empt it is closed a :.

    #ntities

    "ntities are 'ariales used to *e'ine common tet. "ntit references arereferences to entities.

    ost of ou will know the &0 entit referenceA ZnspY. 0his no-reaking-space entit is used in &0 to insert an e*tra space in a document. "ntities aree*panded when an @ parser parses a document.

    0he following entities are predefined in @A

    Entit! Re'erences ,rcterZltY [

    ZgtY I

    ZampY Z

    Z=uotY

    ZaposY N

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    72/83

    PCCOE, Nigdi Department ofComputer Engineering

    '$D+T+

    PC%909 means parsed character data.

    0hink of character data as the te*t found etween the start tag and the end tag ofan @ element.

    P,DATA is tet tt )i(( be %rse* b! %rser . 0ags inside the te*t will etreated as markup and entities will e e*panded.

    $D+T+

    C%909 also means character data.

    ,DATA is tet tt )i(( NOT be %rse* b! %rser . 0ags inside the te*t will?M0 e treated as markup and entities will not e e*panded

    DTD 2 Elements

    $n a %0%, @ elements are declared with a %0% element declaration.

    Declaring an Element

    $n the %0%, @ elements are declared with an element declaration. 9n elementdeclaration has the following snta*A

    [O"""?0 element-name categorI

    or

    [O"""?0 element-name (element-content)I

    Empt( elements

    "mpt elements are declared with the categor keword "P0>A

    [O"""?0 element-name "P0>I

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    73/83

    PCCOE, Nigdi Department ofComputer Engineering

    e*ampleA

    [O"""?0 r "P0>I

    @ e*ampleA

    [r :I

    Elements with onl( character ata

    "lements with onl character data are declared with UPC%909 insideparenthesesA

    [O"""?0 element-name (UPC%909)I

    e*ampleA

    [O"""?0 from (UPC%909)I

    Elements with an( contents

    "lements declared with the categor keword 9?>, can contain an comination

    of parsale dataA

    [O"""?0 element-name 9?>I

    e*ampleA

    [O"""?0 note 9?>I

    Elements with chilren 3se-uences4

    "lements with one or more children are defined with the name of the childrenelements inside parenthesesA

    [O"""?0 element-name

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    74/83

    PCCOE, Nigdi Department ofComputer Engineering

    (child-element-name)I

    or

    [O"""?0 element-name

    (child-element-name,child-element-name,.....)I

    e*ampleA

    [O"""?0 note (to,from,heading,od)I

    /hen children are declared in a se=uence separated commas, the childrenmust appear in the same se=uence in the document. $n a full declaration, thechildren must also e declared, and the children can also ha'e children. 0he fulldeclaration of the note element will eA

    [O"""?0 note (to,from,heading,od)I

    [O"""?0 to (UPC%909)I

    [O"""?0 from (UPC%909)I

    [O"""?0 heading (UPC%909)I

    [O"""?0 od (UPC%909)I

    %0% - 9ttriutes

    $n a %0%, 9ttriutes are declared with an 900$S0 declaration.

    Declaring +ttri%utes

    9n attriute declaration has the following snta*A

    [O900$S0 element-name attriute-name

    attriute-tpe default-'alueI

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    75/83

    PCCOE, Nigdi Department ofComputer Engineering

    e*ampleA

    %0% e*ampleA

    [O900$S0 pament tpe C%909 checkI

    @ e*ampleA

    [pament tpeRcheck :I

    0he ttribute-t!%ecan ha'e the following 'aluesA

    (ue E%(ntionC%909 0he 'alue is character data

    (en1en2..) 0he 'alue must e one from an enumerated list

    $% 0he 'alue is a uni=ue id

    $%B"G 0he 'alue is the id of another element

    $%B"GS 0he 'alue is a list of other ids

    ?0MQ"? 0he 'alue is a 'alid @ name

    ?0MQ"?S 0he 'alue is a list of 'alid @ names

    "?0$0> 0he 'alue is an entit

    "?0$0$"S 0he 'alue is a list of entities

    ?M090$M? 0he 'alue is a name of a notation

    *mlA 0he 'alue is a predefined *ml 'alue

    0he *e'u(t-v(uecan ha'e the following 'aluesA

    (ue E%(ntion

    6alue 0he default 'alue of the attriute

    UB"_$B"% 0he attriute 'alue must e included in the element

    U$P$"% 0he attriute does not ha'e to e included

    UG$@"% 'alue 0he attriute 'alue is fi*ed

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    76/83

    PCCOE, Nigdi Department ofComputer Engineering

    Enumerate attri%ute values

    Snta*A

    [O900$S0 element-name

    attriute-name (en1en2..) default-'alueI

    %0% e*ampleA

    [O900$S0 pament tpe (checkcash) cashI

    @ e*ampleA

    [pament tpeRcheck :I

    or

    [pament tpeRcash :I

    se enumerated attriute 'alues when ou want the attriute 'alues to e one ofa fi*ed set of legal 'alues

    )ML Schema

    X? &cem is n X? bse* (terntive to DTD.

    /#C supports an alternati'e to %0% called @ Schema. .

    @ Schema is an @ ased alternati'e to %0%.

    9n @ schema descries the structure of an @ document.

    0he @ Schema language is also referred to as @ Schema %efinition(@S%).

    What is an )ML Schema?

    0he purpose of an @ Schema is to define the legal uilding locks of an @document, Kust like a %0%.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    77/83

    PCCOE, Nigdi Department ofComputer Engineering

    An X? &cem:

    defines elements that can appear in a document defines attriutes that can appear in a document defines which elements are child elements defines the order of child elements defines the numer of child elements defines whether an element is empt or can include te*t defines data tpes for elements and attriutes defines default and fi*ed 'alues for elements and attriutes

    @ Schemas - /hF

    0here are a numer of reasons wh @ Schema is etter than %0%.

    )ML Schema has Support for Data T(pes

    @ Schemas use @ Snta*

    @ Schemas Secure %ata Communication

    @ Schemas are "*tensile

    /ell-Gormed is not "nough

    X&D o) To

    @ documents can ha'e a reference to a %0% or an @ Schema.

    + Simple )ML Document

    ook at this simple @ document called note.*mlA

    [F*ml 'ersionfilteredR1.FI

    [noteI

    [toI0o'e[:toI

    [fromI8ani[:fromI

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    78/83

    PCCOE, Nigdi Department ofComputer Engineering

    [headingIBeminder[:headingI

    [@7M%>I%M?N0 p weekendO[*odI[ this me forgetI

    [:noteI

    + Simple DTD

    0his is a simple %0% file called note.dtd that defines the elements of the @document ao'e (note.*ml)A

    [O"""?0 note (to, from, heading, od)I

    [O"""?0 to (UPC%909)I

    [O"""?0 from (UPC%909)I

    [O"""?0 heading (UPC%909)I

    [O"""?0 od (UPC%909)I

    ine 1 defines the noteelement to ha'e four elementsA to, from, heading, od.

    ine 2-+ defines the toelement to e of the tpe UPC%909, the 'romelementto e of the tpe UPC%909, and so on...

    + Simple )ML Schema

    0his is a simple @ Schema file called note.*sd that defines the elements ofthe @ document ao'e (note.*ml)A

    [F*ml 'ersionfilteredR1.FI

    [*sAschema *mlnsA*sRhttpA::www.w#.org:21:@Schema

    target?amespaceRhttpA::www.w#schools.com

    *mlnsRhttpA::www.w#schools.com

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    79/83

    PCCOE, Nigdi Department ofComputer Engineering

    elementGorm%efaultR=ualifiedI

    [*sAelement nameRnoteI

    [*sAcomple*0peI

    [*sAse=uenceI

    [*sAelement nameRto tpeR*sAstring:I

    [*sAelement nameRfrom tpeR*sAstring:I

    [*sAelement nameRheading tpeR*sAstring:I

    [*sAelement nameRod tpeR*sAstring:I

    [:*sAse=uenceI

    [:*sAcomple*0peI

    [:*sAelementI

    [:*sAschemaI

    0he note element is said to e of a com%(e t!%e ecause it contains otherelements. 0he other elements (to, from, heading, od) are said to e sim%(et!%esecause the do not contain other elements.

    @S% - 0he [schemaI "lement

    0he [schemaI element is the root element of e'er @ SchemaO

    The 5schema6 Element

    0he [schemaI element is the root element of e'er @ SchemaA

    [F*ml 'ersionfilteredR1.FI

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    80/83

    PCCOE, Nigdi Department ofComputer Engineering

    [*sAschemaI

    ...

    ...

    [:*sAschemaI

    0he [schemaI element ma contain some attriutes

    Examples of $omplex )ML Elements

    9 comple* @ element, product, which is emptA

    [product pidR1#4+:I

    9 comple* @ element, emploee, which contains onl other elementsA

    [emploeeI

    [firstnameI8ohn[:firstnameI

    [lastnameISmith[:lastnameI

    [:emploeeI

    9 comple* @ element, food, which contains onl te*tA

    [food tpeRdessertI$ce cream[:foodI

    9 comple* @ element, description, which contains oth elements and te*tA

    [descriptionI

    $t happened on [date langRnorwegianI#.#.55[:dateI ....

    [:descriptionI

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    81/83

    PCCOE, Nigdi Department ofComputer Engineering

    How to Define a $omplex Element

    ook at this comple* @ element, emploee, which contains onl otherelementsA

    [emploeeI

    [firstnameI8ohn[:firstnameI

    [lastnameISmith[:lastnameI

    [:emploeeI

    /e can define a comple* element in an @ Schema in different wasA.

    1. 0he emploee element can e declared directl naming the element, likethisA

    [*sAelement nameRemploeeI

    [*sAcomple*0peI

    [*sAse=uenceI

    [*sAelement nameRfirstname tpeR*sAstring:I

    [*sAelement nameRlastname tpeR*sAstring:I

    [:*sAse=uenceI

    [:*sAcomple*0peI

    [:*sAelementI

    $f ou use the method descried ao'e, onl the emploee element can use thespecified comple* tpe. ?otice that the child elements, firstname andlastname, are surrounded the [se=uenceI indicator. 0his means that thechild elements must appear in the same order as the are declaredY firstnamefirst and lastname second.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    82/83

    PCCOE, Nigdi Department ofComputer Engineering

    2. 0he emploee element can ha'e a tpe attriute that refers to the name of thecomple* tpe to useA

    [*sAelement nameRemploee tpeRpersoninfo:I

    [*sAcomple*0pe nameRpersoninfoI

    [*sAse=uenceI

    [*sAelement nameRfirstname tpeR*sAstring:I

    [*sAelement nameRlastname tpeR*sAstring:I

    [:*sAse=uenceI

    [:*sAcomple*0peI

    Common @ Schema %ata 0pes

    @ Schema has a lot of uilt-in data tpes. &ere is a list of the most commontpesA

    *sAstring *sAdecimal *sAinteger *sAoolean *sAdate *sAtime

    Proce*ure :

    1. $dentif the appropriate elements for the gi'en prolem statement Zwrite a %0%.

    2. /rite an @ document for the same.#. Check the @ document for /ell- Gormed %ocumentation.

  • 5/21/2018 Computer Network Lab Manual Comp Dept.

    83/83

    PCCOE, Nigdi Department ofComputer Engineering

    4. 6alidate the @ document against a %0%, against a schema Zappl CSS.

    +. See the @ output in a rowser.

    A%%(ictions:

    1. sed to de'elop we ased applications.

    "A#&:

    1. /hat is the different etween @ Z &0 F2. &ow @ is used to de'elop we applicationsF#. /hich is etter @ %0% or @ schema for we de'elopmentF