HTML
HTML stands for Hypertext Markup Language It’s a markup language used to structure text and multimedia documents and to set up hypertext links between documents, used extensively on the World Wide Web.
HTML was invented in 1990 by a scientist called Tim Berners-Lee
Different versions of HTML:• HTML 2.0(1995) • HTML 3.2(1997) • HTML 4.0(1998) • HTML 4.0.1(1999) • HTML 5 (2008)
The normal forms (NF) of relational database theory provide criteria for determining a table’s degree of vulnerability to logical inconsistencies and anomalies.
Loops in Java. Looping in programming languages is a feature which facilitates the execution of a set of instructions/functions repeatedly while some condition evaluates to true.
The normal forms (NF) of relational database theory provide criteria for determining a table’s degree of vulnerability to logical inconsistencies and anomalies.
Loops in Java. Looping in programming languages is a feature which facilitates the execution of a set of instructions/functions repeatedly while some condition evaluates to true.
Ever wondered how google.com was made? How our own college website is made?🤔
The recipe is simple: Web Development is all you need for creating such awesome and interactive websites. Just add HTML, CSS and JavaScript to the mix and watch the magic happen!
Want to learn this all but don’t know where to start?
Worry not, for GDSC VJTI hereby presents Introduction to Web Development!
Ever wondered how google.com was made? How our own college website is made?🤔
The recipe is simple: Web Development is all you need for creating such awesome and interactive websites. Just add HTML, CSS and JavaScript to the mix and watch the magic happen!
Want to learn this all but don’t know where to start?
Worry not, for GDSC VJTI hereby presents Introduction to Web Development!🌐
Ever wondered how google.com was made? How our own college website is made?🤔
The recipe is simple: Web Development is all you need for creating such awesome and interactive websites. Just add HTML, CSS and JavaScript to the mix and watch the magic happen!
Want to learn this all but don’t know where to start?
Worry not, for GDSC VJTI hereby presents Introduction to Web Development!🌐
Mastering Search Engine Optimization (SEO) in 2023: A Comprehensive Guide
In the ever-evolving landscape of the digital world, Search Engine Optimization (SEO) remains a critical component of any successful online presence. As we step into 2024, SEO has become even more complex and sophisticated, demanding a fresh perspective on strategies and techniques. In this guide, we will explore the latest trends, tools, and best practices for SEO in 2023 to help you stay ahead in the digital marketing game.
Content of SEO in 202 PPT
1. The State of SEO in 2023
1.1 The Evolution of Search Engines
1.2 The Importance of SEO in the Modern Digital Landscape
1.3 The Role of AI in SEO
2. On-Page SEO
2.1 Optimizing for User Experience
2.2 High-Quality Content Creation
2.3 Structured Data Markup
2.4 Mobile Optimization
3. Off-Page SEO
3.1 Building High-Quality Backlinks
3.2 Social Signals and Branding
3.3 Online Reputation Management
4. Technical SEO
4.1 Core Web Vitals
4.2 Website Speed and Performance
4.3 Mobile-First Indexing
4.4 Schema Markup
5. Local SEO
5.1 Google My Business Optimization
5.2 Local Citations
5.3 Customer Reviews and Ratings
7. Video SEO
7.1 The Popularity of Video Content
7.2 Optimizing Video Content for SEO
8. Content Marketing and SEO
8.1 Content Strategy for SEO
8.2 Content Distribution and Promotion
9. SEO Tools in 2023
9.1 SEO Analytics Tools
9.2 Keyword Research Tools
9.3 SEO Plugin and Software
10. Measuring SEO Success
10.1 Key Performance Indicators (KPIs)
10.2 Tracking and Reporting
HTML stands for Hyper Text Markup Language
It is a language with the help of which we can create your own Web site.
A markup language is a set of markup tags
HTML documents are described by HTML tags
Each HTML tag describes different document content
HTML Example: Document Tag
HTML Example
HTML Tags
HTML tags are keywords (tag names) surrounded by angle brackets:
<tagname>content</tagname>
HTML tags normally come in pairs like <p> and </p>
The first tag in a pair is the start tag, the second tag is the end tag
The end tag is written like the start tag, but with a slash before the tag name
The start tag is often called the opening tag. The end tag is often called the closing tag.
HTML can be edited by using a professional HTML editor like:
Adobe Dreamweaver
Microsoft Expression Web
CoffeeCup HTML Editor
Write HTML Using Notepad or Text Edit
To understand the concept of Taxation, heads of income, including foreign income assessment procedures, adjudication and settlement of tax disputes are the focus points of study
in this paper.
Socio-Legal Dimensions of Gender (LLB-507 & 509 )cpjcollege
This paper intends to sensitize the students about the changing
dimensions of gender and also familiarizes them with the subtle manifestations of inequality rooted in our society.
The objective of the paper is to apprise the students with the laws relating to marriage, dissolution, matrimonial remedies, adoption, contemporary trends in family institutions in India, in particular the Hindus and Muslims.
Alternative Dispute Resolution (ADR) [LLB -309] cpjcollege
Alternative Dispute Resolution has become the primary means by which cases are resolved now days, especially commercial, business disputes. It has emerged as the preferred method for resolving civil cases, with litigation as a last resort. Alternative Dispute Resolution provides an overview of the statutory, procedural, and case law underlining these processes and their interplay with litigation. A significant theme is the evolving role of
professional ethics for attorneys operating in non-adversarial settings. Clients and courts increasingly express a preference for attorneys who are skilled not only in litigation but in problem-solving, which costs the clients less in terms of time, money and relationship. The law of ADR also provides an introduction to negotiation and mediation theory.
Environmental Studies and Environmental Laws (: LLB -301)cpjcollege
The objective of this paper is to acquaint the students with the environmental issues and the measures taken for its protection along with the norms prevailing at international and national
level
The paper will focus on the civil procedures followed in instituting a suit. The students will be familiarised with certain important concepts and practical skill development activity will provide insights into the actual working of the court procedures.
The objective of this paper is to provide an understanding of basic concepts of Indian Constitution and various organs created by the Constitution and their functions.
The paper needs to be taught in light of the New Companies Amendment Act 2013. The Companies act 1956 has not been repealed. The New Act of 2013 is made applicable by notifications as to particular sections by the Ministry of Company Affairs. The
notified sections which replace the provisions of Companies Act 1956 will be highlighted
It is an indispensable complementary part of our legal system without the study of which no advocate is suitably equipped with the basic requisites required to go to the court.
This paper focuses on understanding the forms that governments acquire along with nature and conflicts encountered by different forms of governments. Students would get trained to look into center-state conflicts and legislature-executive –judiciary conflicts.
The design is to look into how emerging issues in international relations become important in the legal context and prepare the students to understand International Law.
This paper focuses on various aspects of health care law including the constitutional perspective, obligations, and negligence of medical professionals and remedies available to
consumers of health care.
The object of this paper is to focus on land reforms in India, Constitutional provisions related to land reforms, Land Acquisition, Rehabilitation, and Resettlement Act,2013, Urban Real Estate Development Laws and the Provisions of the Rent Laws under the
Delhi Rent Control Act, 1958.
Business Environment and Ethical Practices (BBA LLB 213 )cpjcollege
The objective of the course is to familiarize students with the different aspects of business environment and ethical practices to be adopted by organizations in conducting their business.
The objective of the course is to familiarize students with the different aspects of managing Human Resources in the organization through the phases of acquisition, development and retention
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
1. Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
BCA IV
WEB TECHNOLOGIES
Paper Code 204
2. HTML
HTML stands for Hypertext Markup Language It’s a markup language
used to structure text and multimedia documents and to set up hypertext
links between documents, used extensively on the World Wide Web.
HTML was invented in 1990 by a scientist called Tim Berners-Lee
Different versions of HTML:-
• HTML 2.0(1995)
• HTML 3.2(1997)
• HTML 4.0(1998)
• HTML 4.0.1(1999)
• HTML 5 (2008)
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
3. What is needed?
• A web browser- Microsoft IE, Google Chrome,
Mozilla Firefox etc.
• A Text Editor- Notepad(Microsoft Windows) or
TextEdit(MAC.)
HTML file extension - .htm or .html
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
4. Basic structure of an HTML
document
<html>
<head>
<title>Page Title</title>
</head>
<body>
The main part of the document goes here.
</body>
</html>
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
5. Comment Tag
<!-- comments here -->
text within this tag will not be displayed or processed by your
browser
comments may be one or multiple lines long (HTML is free-form)
comments do not nest! No comments inside comments!
Attributes
Tags can also have attributes, which are extra bits of information.
Attributes appear inside the opening tag and their values sit inside
quotation marks. They look something like <tag
attribute="value">Margarine</tag>
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
6. Rules regarding attributes:
• Any attributes in an HTML tag need to appear
after the HTML tag name.
• The attribute name must be followed
immediately by an equal sign (=).
• The attribute value needs to come immediately
after the equal sign.
• The attribute value must always be enclosed in
quotes, either single or double.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
7. Meta tag
• Meta tags contain information about the page
that does not need to be displayed, but it still
used by search engines and other web
crawlers. They are typically used to give search
engines a brief description of the page, as well
as the important keywords on it. Meta tags
must appear within the head section of the
html, and have usually have two of the
following attributes:
• name="?" - The name of the meta tag, such
as description, keywords or author.
• .
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
8. Examples
• <meta name="Author" content="Jhon Doe" />
• <meta name="keywords" lang="en" content="car, rental, rent" />
• <meta name="keywords" lang="es" content="autos, alquiler, alquila" />
• <meta name="description" lang="en" content="Car rental in New York." />
• <meta http-equiv="expires" content="Mon, 20 Sep 2006 11:09:00 GMT" />
• <meta http-equiv="pragma" content="no-cache" />
• <meta http-equiv="refresh" content="3; URL=http://www.google.com" />
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
9. HTML <body> Tag
• Attributes
Example:-
<body alink="red" vlink="maroon" link="blue" text="black"
bgcolor="white" background="title.jpg">
Attributes value
background url
bgcolor color
text color
link color
vlink color
alink color
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
10. Text Formatting Tags
• Header - <h?> </h?>There are 6 levels of headings available,
from h1 for the largest and most important heading, down to h6 for
the smallest heading.
• Bold - <b> </b>The text in between the tags will be bold, and stand
out against text around it, the same as in a word processor.
• Italic - <i> </i>Also working the same way as a word processor,
italics displays the text at a slight angle.
• Underline - <u> </u>Again, the same as underline in a word
processor. Note that html links are already underlined and don't
need the extra tag.
• Strike-out - <strike> </strike>Puts a line right through the centre of
the text, crossing it out. Often used to show that text is old and no
longer relevant. Also works by using <s> </s> instead.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
11. • Preformatted Text - <pre> </pre>Any text between the pre tags,
including spaces, carriage returns and punctuation, will appear in
the browser as it would in a text editor (normally browsers ignore
multiple spaces)
• Source Code - <code> </code>Similar to tt the text is displayed in a
fixed-width font, and is commonly used to show source code. I have
used it on this site, along with stylesheets, to show all tags.
• Typewriter Text - <tt> </tt>The text appears to have been typed by
a typewriter, in a fixed-width font. For example: This text is written
using the <tt></tt> tags.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
12. • Small - <small> </small>Instead of having to set a font size, you can
use the small tag to render text slightly smaller than the text around
it. Useful for displaying the 'fine-print'.
• Font Colour - <font color="#??????"> </font>Change the colour of
a few words or a section of text.
• Font Size - <font size="?"> </font>Replace the ? with a number
from 1 to 7 to change the size of the font. One being the smallest
and seven the largest.
• Font Size Change - <font size="+/-?"> </font>For an immediate
change of font size with respect to the font size preceding it, this tag
increase or decreases the size of the font by the number you
specify. Eg: <font size="-1">Some Text</font>
13. • Change Font Face - <font face="?"> </font>To show text in a
particular font, use the font name such "Helvetica" or "Arial" or
"Courier". Be aware that using some fancy font from your computer
means that the person viewing that page must also have that font
installed on their computer too, otherwise it will look totally different
to them.
• Centre - <center> </center>A useful tag, as it says, it makes
everything in between the tags centered (in the middle of the page).
• Emphasis - <em> </em>Used to emphasize text, which usually
appears in italics, but can vary according to your browser.
• Strong Emphasis - <strong> </strong>Used to emphasize text
more, which usually appears in bold, but can vary according to your
browser.
14. Special HTML Characters
• Tag Start - < - <
Less-Than symbol, usually used to define the start of an actual
HTML tag.
• Tag End - > - >
Greater-Than symbol, used to declare the end of each tag.
• Quotation Marks - " - “
As the name says: to mark a quote, or in html terms: to
declare the value of a tag attribute.
• Ampersand - & - &
It is used to define the start of all special character tags, so it
needs a special charachter tag itself.
16. • Registered - ® - ®
Used to indicate that a product or business trademark
that is officially registered.
• One Half - ½ - ½
Fraction symbol for One Half (0.5) of some other
value.
• Degree - ° - °
The degree symbol is used to represent temperature
or angular measurements.
17. HTML Linking Tags
• Basic Link - <a href="url">link text</a>There are two main parts to a link tag: the
text a user can click, and the web address they go to if they click it. The bit
between the <a> and </a> tags is the link text, and is generally displayed in blue
and underlined by web browsers. The href="url" part is the web address,
where url can be set in several ways:
href="example.html" - another page in the current
• Link to a Fragment - <a href="#fragment">link</a>It is often usefull to link to
other places on the same webpage, such as other sections or chapters further
down the page. The technical term for this is linking to a Fragment, where
browsers will automatically try and scroll to that part of the page. Fragments first
need to be defined somewhere in a webpage by giving them a name, for
example <a name="fragment_name">, then links to this fragment are created by
using the hash (#) character:<a href="#fragment_name">Link</a>. To link to a
fragment on another page you would simply append the fragment name to the
address, for example: href="example.html#fragment_name".
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
18. • Target Window - <a href="url" target="???">link</a>You may not always
want to link to a page and have it load up over the one you are currently
viewing. Thats where the target attribute comes in handy. By setting
the target="_BLANK" the page you link to will load up in a new window (or
new tab in some newer browsers). Similary,"_self", "_parent", or "_top" will
open the link in the current window, the parent window.
• Image as a Link - <a href="url"><img ...></a>By placing an image
tag between the <a> and </a> tags, you can turn an image into a link, and
clicking on that image will then load the referenced page. You may notice
that the image gets a blue border just as link text became underlined. This
can be resolved by setting the border="0"attribute of the image, or
using css.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
19. • Email Link - <a href="mailto:email"></a>A special kind of
link, the mailto notation link instructs the browser to compose
and email to the specified address using the default email
program. It but does not actually send any emails
automatically. You can also set a subject for the email by
using
<a href="mailto:pramod.pandey@jagannath.org?Subject=Linking">email
me</a>
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
20. <img> (no closing tag needed)
used to display graphics (.jpeg, .png, .gif) in your web pages
you must specify the URL for the image source, and an alt= text
the basic attributes of <img> are:
src=”string” - the absolute or relative location of the image file
alt=”string” - Alternate Text for people who don't see images
height=”string” - image height, percent or absolute pixels (optional)
width=”string” - image width, percent or absolute pixels (optional)
title=”string” - mouse-over title of the image (optional)
Image tag
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
21. INTRODUCTION TO
JAVASCRIPT
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
22. JAVASCRIPT
JavaScript is used in millions of Web pages to improve the
design, validate forms, detect browsers, create cookies, and
much more.
JavaScript is the most popular scripting language on the
internet, and works in all major browsers, such as Internet
Explorer, Mozilla, Firefox, Netscape, Opera.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
23. WHAT IS JAVASCRIPT?
JavaScript was designed to add interactivity to HTML
pages
JavaScript is a scripting language (a scripting
language is a lightweight programming language)
A JavaScript consists of lines of executable computer
code
A JavaScript is usually embedded directly into HTML
pages
JavaScript is an interpreted language (means that
scripts execute without preliminary compilation)
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
24. Are Java and JavaScript the Same?
Java and JavaScript are two completely different languages in
both concept and design!
Java (developed by Sun Microsystems) is a powerful and
much more complex programming language - in the same
category as C and C++.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
25. How to Put a JavaScript Into an HTML
Page?
<html>
<body>
<script type="text/javascript">
document.write("Hello World!")
</script>
</body>
</html>
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
26. Ending Statements With a
Semicolon?With traditional programming languages, like C++ and Java,
each code statement has to end with a semicolon (;).
Many programmers continue this habit when writing
JavaScript, but in general, semicolons are optional!
However, semicolons are required if you want to put more
than one statement on a single line.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
27. JavaScript Variables
Variables are used to store data.
A variable is a "container" for information you want to
store. A variable's value can change during the
script. You can refer to a variable by name to see
its value or to change its value.
Rules for variable names:
Variable names are case sensitive
They must begin with a letter or the underscore character
strname – STRNAME (not same)
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
28. JavaScript Operators
Operator Description Example Result
+ Addition x=2 4
y=2
x+y
- Subtraction x=5 3
y=2
x-y
* Multiplication x=5 20
y=4
x*y
/ Division 15/5 3
5/2 2,5
% Modulus (division remainder) 5%2 1
10%8 2
10%2 0
++ Increment x=5 x=6
x++
-- Decrement x=5 x=4
x--
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
29. JavaScript Operators – 2
Assignment Operators
(
Operator Example Is The Same As
= x=y x=y
+= x+=y x=x+y
-= x-=y x=x-y
*= x*=y x=x*y
/= x/=y x=x/y
%= x%=y x=x%y
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
30. JavaScript Operators - 3
Comparison Operators
Operator Description Example
== is equal to 5==8 returns false
=== is equal to (checks for both value and type) x=5
y="5"
x==y returns true
x===y returns false
!= is not equal 5!=8 returns true
> is greater than 5>8 returns false
< is less than 5<8 returns true
>= is greater than or equal to 5>=8 returns false
<= is less than or equal to 5<=8 returns true
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
31. JavaScript Operators - 4
Logical Operators
Operator Description Example
&& and x=6
y=3
(x < 10 && y > 1) returns true
|| or x=6
y=3
(x==5 || y==5) returns false
! not x=6
y=3
!(x==y) returns true
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
32. JavaScript Basic Examples
<script>
document.write("Hello World!")
</script> format text with HTML code - heading
<script>
alert("Hello World!")
</script>
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
34. JavaScript Popup Boxes
Alert Box
An alert box is often used if you want to make sure
information comes through to the user.
When an alert box pops up, the user will have to click "OK"
to proceed.
<script>
alert("Hello World!")
</script>
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
35. JavaScript Popup Boxes - 2
Confirm Box
A confirm box is often used if you want the user to verify or
accept something.
When a confirm box pops up, the user will have to click
either "OK" or "Cancel" to proceed.
If the user clicks "OK", the box returns true. If the user
clicks "Cancel", the box returns false.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
36. JavaScript Popup Boxes - 3
Prompt Box
A prompt box is often used if you want the user to input a
value before entering a page.
When a prompt box pops up, the user will have to click
either "OK" or "Cancel" to proceed after entering an input
value.
If the user clicks "OK“, the box returns the input value. If
the user clicks "Cancel“, the box returns null.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
37. Prompt Box Example
<script>
x=prompt (“Adınızı Yazınız”, “ ”)
document.write(“Merhaba <br>”,+x)
</script>
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
38. Examples -2
<script>
s1=12
s2=28
toplam=s1+s2
document.write("Sayıların toplamı: "+toplam)
</script>
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
39. Conditional Statements
Very often when you write code, you want to perform different actions for
different decisions. You can use conditional statements in your code to
do this.
In JavaScript we have the following conditional statements:
if statement - use this statement if you want to execute some code only if a
specified condition is true
if...else statement - use this statement if you want to execute some code if
the condition is true and another code if the condition is false
if...else if....else statement - use this statement if you want to select one of
many blocks of code to be executed
switch statement - use this statement if you want to select one of many
blocks of code to be executed
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
40. What is DHTML?
DHTML is the combination of several built-in browser features in
fourth generation browsers that enable a web page to be more
dynamic.
DHTML is NOT a scripting language (like JavaScript or VBscript), but
a browser feature- or enhancement- that makes the browser dynamic
It uses a host of different technologies - JavaScript, VBScript, the
Document Object Model (DOM), layers, cascading stylesheets - to
create HTML that can change even after a page has been loaded into
a browser
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
41. What is DHTML?
It is considered to be made up of
–HTML
–Cascading Style Sheets (CSS)
–Scripting language
All three of these components are linked via Document Object Model
(DOM)
DOM is the interface that allows scripting languages to access the
content, style, and structure of the web documents and change them
dynamically
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
42. Tools of DTHML
HTML and XML
–Partitions and Organizes the content
CSS
–Defines the Presentation of the content
Scripting - JavaScript, JScript, VBScript
–Adds interactivity to the page
DOM- Document Object Model
–Defines what and how elements are exposed for script access
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
43. Components of DHTML
DHTML requires four independent components to work: HTML, Cascading Style
Sheets, Scripting and the Document Object Model. The section provides a
brief description of each component.
1. HTML:
HTML defines the structure of a Web page, using such basic elements as
headings, forms, tables, paragraphs and links. On December 18, 1997,
HTML 4.0 attained "recommended" status at the W3C. Changes and
enhancements introduced in HTML 4.0 made DHTML possible.
2. Cascading Style Sheets (CSS): Similar to a template in a word-
processing document, a style sheet controls the formatting of HTML
elements. Like in traditional desktop publishing, one can use style sheet
to specify page margins, point sizes and leading. Cascading Style
Sheets is a method to determine precedence and to resolve conflicts
when multiple styles are used.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
44. 3. Scripting:
Scripting provides the mechanisms to interpret user actions and produce
client-side changes to a page. For example, scripts can interpret mouse
actions (such as the mouse passing over a specified area of a page
through the event model) and respond to the action by using a set of
predefined instructions (such as highlighting the text activated by the
mouse action). Although DHTML can communicate with several scripting
languages, JavaScript is the de facto standard for creating cross-browser
DHTML pages.
4. Document Object Model (DOM):
The DOM outlines Web page content in a way that makes it possible for
HTML elements, style sheets and scripting languages to interact with
each other. The W3C defines the DOM as "a platform- and language-
neutral interface that will allow programs and scripts to dynamically
access and update the content, structure, and style of documents. The
document can be further processed and the results of that processing
can be incorporated back into the presented stage."
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
45. DOM – Document Object Model
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
46. DOM Introduction
Dynamic HTML object model
“The Document Object Model (DOM) is an application
programming interface (API) for HTML and XML
documents. It defines the logical structure of
documents and the way a document is accessed and
manipulated.”
Great control over presentation of pages
Access to all elements on the page
Whole web page (elements, forms, frames, tables, etc.)
represented in an object hierarchy
“Anything found in an HTML or XML document can be
accessed, changed, deleted, or added using the
Document Object Model, with a few exceptions.”
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
47. DOM Introduction – cont’d
HTML elements treated as objects
Attributes of these elements treated as properties of those
objects
Objects identified with an ID attribute can be scripted with
languages like JavaScript and VBScript.
Elements on the page can be supported by scripting that can
interact with user events and change the page content
dynamically.
The DOM dictates how the written scripting language controls the
elements on the screen, such as graphics and text.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
48. DOM-Document Object Model …
The Document Object Model is a platform- and language-neutral
interface that will allow programs and scripts to dynamically access and
update the content, structure and style of the document
The DOM details the characteristic properties of each element of a
Web page, thereby detailing how we might manipulate these
components and, in turn, manipulate the page
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
49. Document Object Model is not a "part" of Scripting languages. The
DOM stands alone, able to be interfaced with any programming
language designed to do so
The W3C DOM is the recommended standard to be exposed by
each browser
Microsoft Internet Explorer and Netscape do not share the same
DOM.
DOM-Document Object Model…
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
50. Both (IE and Netscape) DOMs break down Web pages into roughly
four types of components
–Objects, Properties, Events and Methods
Objects :
–Container which reflects a particular element of a page
–objects "contain" the properties and methods which apply to that
element
DOM-Document Object Model…
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
51. Properties:
–Characteristics of an object
–Example: the ‘document’ object possesses a ‘bgColor’ property
which reflects the background color of the page.
–Using a programming language (e.g. JavaScript) you may, via
this property, read or modify the background color of a page
DOM-Document Object Model…
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
52. Methods:
–A method typically executes an action which acts upon the object by
which it is owned
Events:
–Used to trap actions related to its owning object
–Typically, these actions are caused by the user
DOM-Document Object Model…
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
53. DOM
• DOM = Document Object Model
Defines a hierarchical model of the document structure
through which all document elements may be accessed
• Nodes
The W3C DOM defines element of a document is a node
of a particular type
Node Types
Common types are: document node, element node, text
node, attribute node, comment node, document-type node
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
54. DOM Example
document node
Document_type node
<!DOCTYPE>
element node
<HTML>
element node
<HEAD>
element node
<TITLE>
text node
"Sample"
element node
<BODY>
element node
<P>
text node
"This is a..."
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
55. Netscape DOM
DOM "begins" at the window object;
Other objects are below the window object in the hierarchy
Exception is the navigator object, (whose properties provide
information about the browser version,) which is a peer object of
window rather than a child
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
56. Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
57. Microsoft DOM
Microsoft indexes an additional topic called as collections. A
"collection," is an array-based object
The observable difference between the two is the syntax. Netscape
supports a treelike hierarchical syntax
On the other hand, Internet Explorer exposes all HTML objects as a
flat collection and lets you modify the style object
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
59. 15.3 Collections all and children
Collections are basically arrays of related objects on a
page
all
Collection of all the HTML elements in a document in the order
in which they appear
length property
Specifies the number of elements in the collection
tagName property of an element
Determines the name of the element
Every element has its own all collection, consisting of
all the elements contained within that elementChanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
60. Advantage
Robust API for DOM tree
Relatively simple to modify data structure and
extract data
Disadvantage Store entire document in memoryAs
DOM was written for any language method naming
not follow the standard VB programming conventions
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
61. What is XML
XML stands for eXtensible Markup Language.
A markup language is used to provide information
about a document.
Tags are added to the document to provide the extra
information.
HTML tags tell a browser how to display the
document.
XML tags give a reader some idea what some of the
data means.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
62. What is XML Used For?
XML documents are used to transfer data from one place to
another often over the Internet.
XML subsets are designed for particular applications.
One is RSS (Rich Site Summary or Really Simple Syndication
). It is used to send breaking news bulletins from one web
site to another.
A number of fields have their own subsets. These include
chemistry, mathematics, and books publishing.
Most of these subsets are registered with the W3Consortium
and are available for anyone’s use.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
63. Advantages of XML
XML is text (Unicode) based.
Takes up less space.
Can be transmitted efficiently.
One XML document can be displayed differently in
different media.
Html, video, CD, DVD,
You only have to change the XML document in order to
change all the rest.
XML documents can be modularized. Parts can be
reused.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
64. Example of an HTML Document
<html>
<head><title>Example</title></head.
<body>
<h1>This is an example of a page.</h1>
<h2>Some information goes here.</h2>
</body>
</html>
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
65. Example of an XML Document
<?xml version=“1.0”/>
<address>
<name>Alice Lee</name>
<email>alee@aol.com</email>
<phone>212-346-1234</phone>
<birthday>1985-03-22</birthday>
</address>
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
66. Difference Between HTML and XML
HTML tags have a fixed meaning and browsers know what it
is.
XML tags are different for different applications, and users
know what they mean.
HTML tags are used for display.
XML tags are used to describe documents and data.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
67. XML Rules
Tags are enclosed in angle brackets.
Tags come in pairs with start-tags and end-tags.
Tags must be properly nested.
<name><email>…</name></email> is not allowed.
<name><email>…</email><name> is.
Tags that do not have end-tags must be terminated by a ‘/’.
<br /> is an html example.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
68. More XML Rules
Tags are case sensitive.
<address> is not the same as <Address>
XML in any combination of cases is not allowed as
part of a tag.
Tags may not contain ‘<‘ or ‘&’.
Tags follow Java naming conventions, except that a
single colon and other characters are allowed.
They must begin with a letter and may not contain
white space.
Documents must have a single root tag that begins
the document.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
69. Encoding
XML (like Java) uses Unicode to encode characters.
Unicode comes in many flavors. The most common one
used in the West is UTF-8.
UTF-8 is a variable length code. Characters are encoded
in 1 byte, 2 bytes, or 4 bytes.
The first 128 characters in Unicode are ASCII.
In UTF-8, the numbers between 128 and 255 code for
some of the more common characters used in western
Europe, such as ã, á, å, or ç.
Two byte codes are used for some characters not listed in
the first 256 and some Asian ideographs.
Four byte codes can handle any ideographs that are left.
Those using non-western languages should investigate
other versions of Unicode.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
70. Well-Formed Documents
An XML document is said to be well-formed if it
follows all the rules.
An XML parser is used to check that all the rules
have been obeyed.
Recent browsers such as Internet Explorer 5 and
Netscape 7 come with XML parsers.
Parsers are also available for free download over the
Internet. One is Xerces, from the Apache open-
source project.
Java 1.4 also supports an open-source parser.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
71. XML Example Revisited
<?xml version=“1.0”/>
<address>
<name>Alice Lee</name>
<email>alee@aol.com</email>
<phone>212-346-1234</phone>
<birthday>1985-03-22</birthday>
</address>
Markup for the data aids understanding of its purpose.
A flat text file is not nearly so clear.
Alice Lee
alee@aol.com
212-346-1234
1985-03-22
The last line looks like a date, but what is it for?Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
72. Expanded Example
<?xml version = “1.0” ?>
<address>
<name>
<first>Alice</first>
<last>Lee</last>
</name>
<email>alee@aol.com</email>
<phone>123-45-6789</phone>
<birthday>
<year>1983</year>
<month>07</month>
<day>15</day>
</birthday>
</address>
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
73. XML Files are Trees
address
name email phone birthday
first last year month day
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
74. XML Trees
An XML document has a single root node.
The tree is a general ordered tree.
A parent node may have any number of children.
Child nodes are ordered, and may have siblings.
Preorder traversals are usually used for getting information out
of the tree.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
75. Validity
A well-formed document has a tree structure and
obeys all the XML rules.
A particular application may add more rules in either
a DTD (document type definition) or in a schema.
Many specialized DTDs and schemas have been
created to describe particular areas.
These range from disseminating news bulletins
(RSS) to chemical formulas.
DTDs were developed first, so they are not as
comprehensive as schema.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
76. Document Type Definitions
A DTD describes the tree structure of a document and
something about its data.
There are two data types, PCDATA and CDATA.
PCDATA is parsed character data.
CDATA is character data, not usually parsed.
A DTD determines how many times a node may appear, and
how child nodes are ordered.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
77. DTD for address Example
<!ELEMENT address (name, email, phone, birthday)>
<!ELEMENT name (first, last)>
<!ELEMENT first (#PCDATA)>
<!ELEMENT last (#PCDATA)>
<!ELEMENT email (#PCDATA)>
<!ELEMENT phone (#PCDATA)>
<!ELEMENT birthday (year, month, day)>
<!ELEMENT year (#PCDATA)>
<!ELEMENT month (#PCDATA)>
<!ELEMENT day (#PCDATA)>
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
78. Schemas
Schemas are themselves XML documents.
They were standardized after DTDs and provide
more information about the document.
They have a number of data types including string,
decimal, integer, boolean, date, and time.
They divide elements into simple and complex types.
They also determine the tree structure and how many
children a node may have.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
79. Schema for First address Example
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="address">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="email" type="xs:string"/>
<xs:element name="phone" type="xs:string"/>
<xs:element name="birthday" type="xs:date"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
80. Explanation of Example Schema
<?xml version="1.0" encoding="ISO-8859-1" ?>
ISO-8859-1, Latin-1, is the same as UTF-8 in the first 128 characters.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
www.w3.org/2001/XMLSchema contains the schema standards.
<xs:element name="address">
<xs:complexType>
This states that address is a complex type element.
<xs:sequence>
This states that the following elements form a sequence and must come
in the order shown.
<xs:element name="name" type="xs:string"/>
This says that the element, name, must be a string.
<xs:element name="birthday" type="xs:date"/>
This states that the element, birthday, is a date. Dates are always of the
form yyyy-mm-dd.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
81. XSLT
Extensible Stylesheet Language Transformations
XSLT is used to transform one xml document into
another, often an html document.
The Transform classes are now part of Java 1.4.
A program is used that takes as input one xml
document and produces as output another.
If the resulting document is in html, it can be viewed
by a web browser.
This is a good way to display xml data.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
82. A Style Sheet to Transform address.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="address">
<html><head><title>Address Book</title></head>
<body>
<xsl:value-of select="name"/>
<br/><xsl:value-of select="email"/>
<br/><xsl:value-of select="phone"/>
<br/><xsl:value-of select="birthday"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
83. Parsers
There are two principal models for parsers.
SAX – Simple API for XML
Uses a call-back method
Similar to javax listeners
DOM – Document Object Model
Creates a parse tree
Requires a tree traversal
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)