Download presentation
Presentation is loading. Please wait.
Published byEaster Dickerson Modified over 9 years ago
1
Lesson 16
2
Extensible Markup Language (XML) World Wide Web Consortium (W3C) – non-profit organizations that maintains standards for the web presented the draft of XML in late 1990’s Inlcudes data management capabilities that HTML cannot provide Consider example of a list of planets –Same HTML tags are decided to be used for information of each planet – actual list can be longer- nine planets –Explain the HTML code –Show the browser result –Shortcoming of HTML – only 6 levels of headings – problem if each planet item has more information elements like color or size of planet –In late 1990’s web professionals considered XML as a list formatting alternative of
3
Planets Planets PlanetName DistanceFromSun Moons DayLength Mercury 36 million miles None 176 Days Venus 67 million miles None 117 days Earth 93 million miles One 24 Hours
5
XML differs from HTML in two important respects –XML not a markup language with defined tags- can create own set of tags - –Tags do not provide information how text would appear on a web page, rather tags convey meaning of information included within them-tags define the meaning of facts To understand distinction consider the example of planets again – XML code for it
6
36 million miles None 176 days 67 million miles None 117 days 93 million miles One 24 Hours
7
First line of code – declaration – version 1 Root element tags – 2 nd & last line – contains other elements – assigned a name that describes purpose of file Other elements are child elements – country is child element of countrylist – each attribute is child element of country element Names of child elements can be different between two organizations- how share information – capital or capitalcity Many companies have agreed to follow common standards for XML tags – these standards in the form of data type definitions (DTDs) or XML schemas are available for different industries – accounting information, legal information standards etc. In 2001 W3C released a set of rules for XML documents
8
All elements must be properly nested – content All attribute values must be quoted – All elements with empty content must be identified by ending in /> – All elements must be cased consistently – must not be closed as Certain characters having reserved meanings cannot be used –&, < XML has its rules!
9
Embedding XML into HTML documents – element can be used anywhere within HTML document to enclose XML content - – element can also be used
10
XML-example HTML text here spicy
12
Basic way to render XML is to translate it into html – server side program translates xml documents to html documents at delivery time We write XSL rules that match various xml elements and output the appropriate html XML files are translated using another file which contains formatting instructions Formatting instructions are often written in Extensible Stylesheet Language (XSL) These formatting instructions are read over by special programs – usually these programs are written in Java programming language- called XML Parsers Diagram how web server might process http request for an XML page – explain it
13
Web Server PC A web client sends an HTTP request for an XML document XML Database Web server requests an XML document from the XML database The XML parser program, which can run on the XML database server or on the Web server, formats the data using a style sheet XSL style sheet XML parser 1 6 5 4 3 2 The XML parser sends the newly formatted XML document to the web server The web server delivers the document to the client
14
Switch A very efficient device Rs. 1000 …… ….
15
………
16
HTML and XML Editors General purpose text-editors, Notepad etc. HTML editors available help create web pages more easily Web site design and creation programs or web page builder softwares – result in one window and code in another Edit in one window and the result is reflected in other Drag and drop images on web browser view page and program automatically generates HTML tags to position it Macromedia Dreamweaver generates the HTML brackets automatically Microsoft FrontPage Xml also in any text editor – programs include Epic Editor, TurboXML – tag validation and editing job becomes easy
17
Web Server A computer that delivers (serves up) web pages with an IP address and possibly a domain. Any computer can be turned into a Web server by installing server software and connecting the machine to the internet.
18
Introduction to ASP ASP – Active Server Pages –Used to create web sites that provide user with individualized data, Access to file system and databases and much more… Runs best on IIS - Internet Information Server IIS is available free with windows NT option pack and more popular Windows 2000 ASP engine works with any scripting language (that is compatible with Microsoft Scripting Host requirements) but VBscript is most popular and recommended
19
Intrinsic Objects To use most objects from a programming language, you must first create an instance of the object you want to use. An object instance is a single copy of an object. You create an instance of an object by creating an object variable, then assigning a new copy of an object to the variable. The process is called instantiation. You don’t have to instantiate ASP objects. The seven objects that ASP exposes are called intrinsic objects because you don’t have to create them. They are always available for you to use on any ASP page.
20
Intrinsic Objects of ASP Response Object : Used to send information to the client Request Object : Used to retrieve information included with the request from the client Server Object : Used to communicate with the server Application Object : Used to store (cache) information about you application Session Object : Used to cache information about a specific browser instance ( which usually, but not always corresponds to a single user) ObjectContext Object ASPError Object
21
Variables in VBscript VBSript has only one type of variables – the Variant type, but it can hold any of three kind of values: –scalar values (meaning Boolean, Integer, long, Single, double, Date, curreny, String) –Arrays –object pointers To create a scalar variable, you define varialbe using Dim statement, then you assign values to the variable Dim x x=100 VBscript by default assumes that any symbol that is not a keyword is a variable. This might cause serious problems when you are writing an ASP application. What if you mistype a variable name and it will be considered by the server as a new variable. To avoid this you must write Option Explicit at top of your each ASP file
22
Response When a browser requests data from the server, the server responds, either with a redirect message, the requested data, or an error message. For HTML requests, the response data comes directly from the Web server, which reads and returns the content of an HTML page. For ASP pages, the response data comes from the ASP object called the response object. The process the web server uses to return a response might be complex but returning a response using a response object couldn’t be easier.
23
<%Dim lastname Dim firstname Dim myage lastname=“abc” firstname=“xyz” myage=30 %> It is easy My name is and my age is
24
Response.Write This function of response object can be used to write anything you like on the server side, to create dynamic contents of a web page (even HTML). The Write method accepts a text string. You must surround the text with double quotes
25
More of Response Object Response Object is not restricted to write function only it has much more to it. Response.Redirect: to redirect the page on submission or otherwise. Like Reponse.Redirect http://vu.pk.eduhttp://vu.pk.edu Response.Expires property when set tells the browser when it need to reload the page for example Response.Expire=10 in a page will tell the browser to reload the page after 10 minutes have passed
26
Request.Form Collection The Request object contains information that the browser sends to the server. The request Object offers five different collection of information one of them is Form which contains information user enters into input controls and information your application has stored in form variables When a browser submits form data using post method, the ASP engine parses the raw HTTP form data and stores it in the Request.Form collection
27
Name: Address: Login: Password: Confirm Password: Email:
28
Request.Form(“userlogin”) will give you what user has typed in userlogin text box. Userlogin is the key for request.Form collection to retreive information For example (let it be regcheck.asp) <%Dim loginname Dim name loginname=Request.Form(“userlogin”) name=Request.Form(“username) %> It is easy My name is and I am going to use as my login
29
Using other programming operatives VB script offers a lot of flexibility to program If statements Loops Many functions to handle your strings Much more…
30
Test1 <% Dim myString=“ecommerce” %> =#12:00 AM# and Time Good Morning Pakistan Hello Everyone <% Dim j For j=1 to 3 response.write myString response.write “ ” Next %>
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.