SlideShare a Scribd company logo
1 of 33
Web Technology
(NCS-504)
Prepared By
Mr.Abhishek Kesharwani
Assistant Professor,UCER Naini,Allahabad
Sep 9, 2015
XML
Introduction to XML
3
XML stands for EXtensible Markup Language
XML is a markup language much like HTML
XML was designed to carry data, not to display data
XML tags are not predefined. You must define your own
tags
XML is designed to be self-descriptive
XML is a W3C Recommendation
XML is Not a Replacement for HTML
4
It is important to understand that XML is not a
replacement for HTML. In most web applications,
XML is used to transport data, while HTML is used to
format and display the data.
With XML You Invent Your Own
Tags
5
The tags used in HTML are predefined. HTML documents
can only use tags defined in the HTML standard (like <p>,
<h1>, etc.).
XML allows the author to define his/her own tags and
his/her own document structure.
XML Separates Data from HTML
6
If you need to display dynamic data in your HTML
document, it will take a lot of work to edit the HTML
each time the data changes.
With XML, data can be stored in separate XML files.
This way you can concentrate on using HTML/CSS for
display and layout, and be sure that changes in the
underlying data will not require any changes to the
HTML.
With a few lines of JavaScript code, you can read an
external XML file and update the data content of your
web page.
XML Simplifies Data Transport
7
One of the most time-consuming challenges for
developers is to exchange data between
incompatible systems over the Internet.
Exchanging data as XML greatly reduces this
complexity, since the data can be read by
different incompatible applications.
HTML and XML, I
8
XML stands for eXtensible Markup Language
HTML is used to mark up
text so it can be displayed
to users
XML is used to mark up
data so it can be processed
by computers
HTML describes both
structure (e.g. <p>, <h2>,
<em>) and appearance (e.g.
<br>, <font>, <i>)
XML describes only
content, or “meaning”
HTML uses a fixed,
unchangeable set of tags
In XML, you make up
your own tags
HTML and XML, II
9
HTML and XML look similar, because they are both SGML
languages (SGML = Standard Generalized Markup Language)
Both HTML and XML use elements enclosed in tags (e.g.
<body>This is an element</body>)
Both use tag attributes (e.g.,
<font face="Verdana" size="+1" color="red">)
Both use entities (&lt;, &gt;, &amp;, &quot;, &apos;)
More precisely,
HTML is defined in SGML
XML is a (very small) subset of SGML
HTML and XML, III
10
HTML is for humans
HTML describes web pages
You don’t want to see error messages about the web pages you
visit
Browsers ignore and/or correct as many HTML errors as they
can, so HTML is often sloppy
XML is for computers
XML describes data
The rules are strict and errors are not allowed
In this way, XML is like a programming language
Current versions of most browsers can display XML
However, browser support of XML is spotty at best
XML-related technologies
11
DTD (Document Type Definition) and XML Schemas are used to
define legal XML tags and their attributes for particular purposes
CSS (Cascading Style Sheets) describe how to display HTML or
XML in a browser
XSLT (eXtensible Stylesheet Language Transformations) and
XPath are used to translate from one form of XML to another
DOM (Document Object Model), SAX (Simple API for XML,
and JAXP (Java API for XML Processing) are all APIs for XML
parsing
Example XML document
12
<?xml version="1.0"?>
<weatherReport>
<date>7/14/97</date>
<city>North Place</city>, <state>NX</state>
<country>USA</country>
High Temp: <high scale="F">103</high>
Low Temp: <low scale="F">70</low>
Morning: <morning>Partly cloudy, Hazy</morning>
Afternoon: <afternoon>Sunny &amp; hot</afternoon>
Evening: <evening>Clear and Cooler</evening>
</weatherReport>
Overall structure
13
An XML document may start with one or more processing
instructions (PIs) or directives:
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="ss.css"?>
Following the directives, there must be exactly one root element
containing all the rest of the XML:
<weatherReport>
...
</weatherReport>
XML building blocks
14
Aside from the directives, an XML document is built from:
elements: high in <high scale="F">103</high>
tags, in pairs: <high scale="F">103</high>
attributes: <high scale="F">103</high>
entities: <afternoon>Sunny &amp; hot</afternoon>
character data, which may be:
parsed (processed as XML)--this is the default
unparsed (all characters stand for themselves)
Elements and attributes
15
Attributes and elements are somewhat interchangeable
Example using just elements:
<name>
<first>David</first>
<last>Matuszek</last>
</name>
Example using attributes:
<name first="David" last="Matuszek"></name>
You will find that elements are easier to use in your programs--this is a
good reason to prefer them
Attributes often contain metadata, such as unique IDs
Generally speaking, browsers display only elements (values enclosed by
tags), not tags and attributes
Well-formed XML
16
Every element must have both a start tag and an end tag, e.g.
<name> ... </name>
But empty elements can be abbreviated: <break />.
XML tags are case sensitive
XML tags may not begin with the letters xml, in any
combination of cases
Elements must be properly nested, e.g. not <b><i>bold and
italic</b></i>
Every XML document must have one and only one root element
The values of attributes must be enclosed in single or double
quotes, e.g. <time unit="days">
Character data cannot contain < or &
Entities
17
Five special characters must be written as entities:
&amp; for & (almost always necessary)
&lt; for < (almost always necessary)
&gt; for > (not usually necessary)
&quot; for " (necessary inside double quotes)
&apos; for ' (necessary inside single quotes)
These entities can be used even in places where they are not
absolutely required
These are the only predefined entities in XML
XML declaration
18
The XML declaration looks like this:
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
The XML declaration is not required by browsers, but is required by most
XML processors (so include it!)
If present, the XML declaration must be first--not even whitespace should
precede it
Note that the brackets are <? and ?>
version="1.0" is required (this is the only version so far)
encoding can be "UTF-8" (ASCII) or "UTF-16" (Unicode), or something
else, or it can be omitted
standalone tells whether there is a separate DTD
XML Encoding
XML documents can contain international characters, like
Norwegian æøå, or French êèé.
To avoid errors, you should specify the encoding used, or
save your XML files as UTF-8.
Unicode is an industry standard for character encoding of
text documents. It de nes (nearly) every possiblefi
international character by a name and a number.
Unicode has two variants: UTF-8 and UTF-16.
UTF = Universal character set Transformation Format.
19
XML Encoding
UTF-8 uses a single byte (8-bits) to represent commonly
used characters and two (or three) bytes for the rest.
UTF-16 uses two bytes (16 bits) for most characters, and
three bytes for the rest.
UTF-8 Web Standard
UTF-8 is the standard character encoding on the web.
UTF-8 is the default character encoding for HTML-5, CSS,
JavaScript, PHP, SQL, and XML.
20
Processing instructions
21
PIs (Processing Instructions) may occur anywhere in the XML
document (but usually first)
A PI is a command to the program processing the XML document
to handle it in a certain way
XML documents are typically processed by more than one
program
Programs that do not recognize a given PI should just ignore it
General format of a PI: <?target instructions?>
Example: <?xml-stylesheet type="text/css"
href="mySheet.css"?>
Comments
22
<!-- This is a comment in both HTML and XML -->
Comments can be put anywhere in an XML document
Comments are useful for:
Explaining the structure of an XML document
Commenting out parts of the XML during development and testing
Comments are not elements and do not have an end tag
The blanks after <!-- and before --> are optional
The character sequence -- cannot occur in the comment
The closing bracket must be -->
Comments are not displayed by browsers, but can be seen by
anyone who looks at the source code
CDATA
23
By default, all text inside an XML document is parsed
You can force text to be treated as unparsed character data by
enclosing it in <![CDATA[ ... ]]>
Any characters, even & and <, can occur inside a CDATA
Whitespace inside a CDATA is (usually) preserved
The only real restriction is that the character sequence ]]> cannot
occur inside a CDATA
CDATA is useful when your text has a lot of illegal characters (for
example, if your XML document contains some HTML text)
Names in XML
24
Names (as used for tags and attributes) must begin with a
letter or underscore, and can consist of:
Letters, both Roman (English) and foreign
Digits, both Roman and foreign
. (dot)
- (hyphen)
_ (underscore)
: (colon) should be used only for namespaces
Combining characters and extenders (not used in English)
Namespaces
25
Recall that DTDs are used to define the tags that can be used
in an XML document
An XML document may reference more than one DTD
Namespaces are a way to specify which DTD defines a given
tag
XML, like Java, uses qualified names
This helps to avoid collisions between names
Java: myObject.myVariable
XML: myDTD:myTag
Note that XML uses a colon (:) rather than a dot (.)
Review of XML rules
26
Start with <?xml version="1"?>
XML is case sensitive
You must have exactly one root element that encloses all the
rest of the XML
Every element must have a closing tag
Elements must be properly nested
Attribute values must be enclosed in double or single
quotation marks
There are only five predeclared entities
Another well-structured example
27
<novel>
<foreword>
<paragraph> This is the great American novel.
</paragraph>
</foreword>
<chapter number="1">
<paragraph>It was a dark and stormy night.
</paragraph>
<paragraph>Suddenly, a shot rang out!
</paragraph>
</chapter>
</novel>
Valid XML
28
You can make up your own XML tags and attributes, but...
...any program that uses the XML must know what to expect!
A DTD (Document Type Definition) defines what tags are legal and
where they can occur in the XML
An XML document does not require a DTD
XML is well-structured if it follows the rules given earlier
In addition, XML is valid if it declares a DTD and conforms to that DTD
A DTD can be included in the XML, but is typically a separate document
Errors in XML documents will stop XML programs
Some alternatives to DTDs are XML Schemas and RELAX NG
Viewing XML
29
XML is designed to be processed by computer programs, not
to be displayed to humans
Nevertheless, almost all current browsers can display XML
documents
They don’t all display it the same way
They may not display it at all if it has errors
For best results, update your browsers to the newest available
versions
Remember:
HTML is designed to be viewed,
XML is designed to be used
Displaying your XML Files with CSS
With CSS (Cascading Style Sheets) you can add display
information to an XML document.
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="cd_catalog.css"?>
<CATALOG>
  <CD>
    <TITLE>Empire Burlesque</TITLE>
    <ARTIST>Bob Dylan</ARTIST>
    <COUNTRY>USA</COUNTRY>
    <COMPANY>Columbia</COMPANY>
    <PRICE>10.90</PRICE>
    <YEAR>1985</YEAR>
  </CD>
</CATALOG>
30
CATALOG
{
background-color: #ffffff;
width: 100%;
}
CD
{
display: block;
margin-bottom: 30pt;
margin-left: 0;
}
31
TITLE
{
color: #FF0000;
font-size: 20pt;
}
ARTIST
{
color: #0000FF;
font-size: 20pt;
}
32
COUNTRY,PRICE,YEAR,COMPANY
{
display: block;
color: #000000;
margin-left: 20pt;
}
33

More Related Content

What's hot (20)

XML
XMLXML
XML
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
XML
XMLXML
XML
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Xhtml
XhtmlXhtml
Xhtml
 
XML Introduction
XML IntroductionXML Introduction
XML Introduction
 
Xml
XmlXml
Xml
 
XML-Extensible Markup Language
XML-Extensible Markup Language XML-Extensible Markup Language
XML-Extensible Markup Language
 
Web programming xml
Web programming  xmlWeb programming  xml
Web programming xml
 
XML
XMLXML
XML
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Basics and different xml files used in android
Basics and different xml files used in androidBasics and different xml files used in android
Basics and different xml files used in android
 
HTML and XML Difference FAQs
HTML and XML Difference FAQsHTML and XML Difference FAQs
HTML and XML Difference FAQs
 
Xml and xml processor
Xml and xml processorXml and xml processor
Xml and xml processor
 
XML Databases
XML DatabasesXML Databases
XML Databases
 
Introduction to XML and Databases
Introduction to XML and DatabasesIntroduction to XML and Databases
Introduction to XML and Databases
 
Xml presentation
Xml presentationXml presentation
Xml presentation
 
03 namespace
03 namespace03 namespace
03 namespace
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
XML
XMLXML
XML
 

Viewers also liked

Primend praktiline pilveseminar 2014 - Microsofti litsentsid hübriidlahenduse...
Primend praktiline pilveseminar 2014 - Microsofti litsentsid hübriidlahenduse...Primend praktiline pilveseminar 2014 - Microsofti litsentsid hübriidlahenduse...
Primend praktiline pilveseminar 2014 - Microsofti litsentsid hübriidlahenduse...Primend
 
Viscoelastic Flow in Porous Media
Viscoelastic Flow in Porous MediaViscoelastic Flow in Porous Media
Viscoelastic Flow in Porous MediaTaha Sochi
 
Primendi Visiooniseminar - IT valdkonna visioon 2015 (Toomas Mõttus)
Primendi Visiooniseminar - IT valdkonna visioon 2015 (Toomas Mõttus)Primendi Visiooniseminar - IT valdkonna visioon 2015 (Toomas Mõttus)
Primendi Visiooniseminar - IT valdkonna visioon 2015 (Toomas Mõttus)Primend
 
092 romania a doua palestina
092   romania a doua palestina092   romania a doua palestina
092 romania a doua palestinaBiro Bela
 
Живая вода
Живая водаЖивая вода
Живая водаrorbic
 
Museo De Ciencias Naturales
Museo De Ciencias NaturalesMuseo De Ciencias Naturales
Museo De Ciencias Naturalesguestea4a25
 
Good Conduct Award Sep2009
Good Conduct Award Sep2009Good Conduct Award Sep2009
Good Conduct Award Sep2009Kyle Waste
 
SuisseID Forum 2015 | Force obligatoire, crédibilité et simplification des pr...
SuisseID Forum 2015 | Force obligatoire, crédibilité et simplification des pr...SuisseID Forum 2015 | Force obligatoire, crédibilité et simplification des pr...
SuisseID Forum 2015 | Force obligatoire, crédibilité et simplification des pr...Trägerverein SuisseID
 
Corporate Presentation Q3 2016
Corporate Presentation Q3 2016Corporate Presentation Q3 2016
Corporate Presentation Q3 2016nizalfariz
 
ENJ-500: Taller Imagen Institucional e Imagen Personal, parte 1
ENJ-500: Taller  Imagen Institucional e Imagen Personal, parte 1ENJ-500: Taller  Imagen Institucional e Imagen Personal, parte 1
ENJ-500: Taller Imagen Institucional e Imagen Personal, parte 1ENJ
 
Proyecto final de tutoria
Proyecto final de tutoriaProyecto final de tutoria
Proyecto final de tutoriavgol30
 

Viewers also liked (20)

Primend praktiline pilveseminar 2014 - Microsofti litsentsid hübriidlahenduse...
Primend praktiline pilveseminar 2014 - Microsofti litsentsid hübriidlahenduse...Primend praktiline pilveseminar 2014 - Microsofti litsentsid hübriidlahenduse...
Primend praktiline pilveseminar 2014 - Microsofti litsentsid hübriidlahenduse...
 
Final Draft Duerr
Final Draft DuerrFinal Draft Duerr
Final Draft Duerr
 
Viscoelastic Flow in Porous Media
Viscoelastic Flow in Porous MediaViscoelastic Flow in Porous Media
Viscoelastic Flow in Porous Media
 
Primendi Visiooniseminar - IT valdkonna visioon 2015 (Toomas Mõttus)
Primendi Visiooniseminar - IT valdkonna visioon 2015 (Toomas Mõttus)Primendi Visiooniseminar - IT valdkonna visioon 2015 (Toomas Mõttus)
Primendi Visiooniseminar - IT valdkonna visioon 2015 (Toomas Mõttus)
 
Presentacion boca
Presentacion bocaPresentacion boca
Presentacion boca
 
Mahadevvan
MahadevvanMahadevvan
Mahadevvan
 
092 romania a doua palestina
092   romania a doua palestina092   romania a doua palestina
092 romania a doua palestina
 
Живая вода
Живая водаЖивая вода
Живая вода
 
Vektregistrering
VektregistreringVektregistrering
Vektregistrering
 
Museo De Ciencias Naturales
Museo De Ciencias NaturalesMuseo De Ciencias Naturales
Museo De Ciencias Naturales
 
CE 2014 #2 webinar 1 slides
CE 2014 #2 webinar 1 slidesCE 2014 #2 webinar 1 slides
CE 2014 #2 webinar 1 slides
 
Good Conduct Award Sep2009
Good Conduct Award Sep2009Good Conduct Award Sep2009
Good Conduct Award Sep2009
 
SuisseID Forum 2015 | Force obligatoire, crédibilité et simplification des pr...
SuisseID Forum 2015 | Force obligatoire, crédibilité et simplification des pr...SuisseID Forum 2015 | Force obligatoire, crédibilité et simplification des pr...
SuisseID Forum 2015 | Force obligatoire, crédibilité et simplification des pr...
 
Corporate Presentation Q3 2016
Corporate Presentation Q3 2016Corporate Presentation Q3 2016
Corporate Presentation Q3 2016
 
Item #6 ppt - elections nov 2016
Item #6   ppt - elections nov 2016Item #6   ppt - elections nov 2016
Item #6 ppt - elections nov 2016
 
How to use mirror for perfect health
How to use mirror for perfect healthHow to use mirror for perfect health
How to use mirror for perfect health
 
ENJ-500: Taller Imagen Institucional e Imagen Personal, parte 1
ENJ-500: Taller  Imagen Institucional e Imagen Personal, parte 1ENJ-500: Taller  Imagen Institucional e Imagen Personal, parte 1
ENJ-500: Taller Imagen Institucional e Imagen Personal, parte 1
 
Intercambio con Francia
Intercambio con FranciaIntercambio con Francia
Intercambio con Francia
 
Steckbrief
SteckbriefSteckbrief
Steckbrief
 
Proyecto final de tutoria
Proyecto final de tutoriaProyecto final de tutoria
Proyecto final de tutoria
 

Similar to uptu web technology unit 2 Xml2 (20)

Xml
XmlXml
Xml
 
Xml
XmlXml
Xml
 
eXtensible Markup Language (By Dr.Hatem Mohamed)
eXtensible Markup Language (By Dr.Hatem Mohamed)eXtensible Markup Language (By Dr.Hatem Mohamed)
eXtensible Markup Language (By Dr.Hatem Mohamed)
 
XML Presentation-2
XML Presentation-2XML Presentation-2
XML Presentation-2
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
 
XML/XSLT
XML/XSLTXML/XSLT
XML/XSLT
 
Unit3wt
Unit3wtUnit3wt
Unit3wt
 
Unit3wt
Unit3wtUnit3wt
Unit3wt
 
Xml
XmlXml
Xml
 
Xml
Xml Xml
Xml
 
Xml tutorial
Xml tutorialXml tutorial
Xml tutorial
 
XML Introduction
XML IntroductionXML Introduction
XML Introduction
 
Full xml
Full xmlFull xml
Full xml
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
paper about xml
paper about xmlpaper about xml
paper about xml
 
Xml intro1
Xml intro1Xml intro1
Xml intro1
 
Xml description
Xml descriptionXml description
Xml description
 
Xml programming language myassignmenthelp.net
Xml programming  language myassignmenthelp.netXml programming  language myassignmenthelp.net
Xml programming language myassignmenthelp.net
 
Unit 2.2
Unit 2.2Unit 2.2
Unit 2.2
 
XML - The Extensible Markup Language
XML - The Extensible Markup LanguageXML - The Extensible Markup Language
XML - The Extensible Markup Language
 

More from Abhishek Kesharwani (20)

uptu web technology unit 2 html
uptu web technology unit 2 htmluptu web technology unit 2 html
uptu web technology unit 2 html
 
uptu web technology unit 2 html
uptu web technology unit 2 htmluptu web technology unit 2 html
uptu web technology unit 2 html
 
uptu web technology unit 2 html
uptu web technology unit 2 htmluptu web technology unit 2 html
uptu web technology unit 2 html
 
uptu web technology unit 2 html
uptu web technology unit 2 htmluptu web technology unit 2 html
uptu web technology unit 2 html
 
uptu web technology unit 2 html
uptu web technology unit 2 htmluptu web technology unit 2 html
uptu web technology unit 2 html
 
uptu web technology unit 2 Css
uptu web technology unit 2 Cssuptu web technology unit 2 Css
uptu web technology unit 2 Css
 
uptu web technology unit 2 Css
uptu web technology unit 2 Cssuptu web technology unit 2 Css
uptu web technology unit 2 Css
 
Unit 1 web technology uptu slide
Unit 1 web technology uptu slideUnit 1 web technology uptu slide
Unit 1 web technology uptu slide
 
Unit1 Web Technology UPTU UNIT 1
Unit1 Web Technology UPTU UNIT 1 Unit1 Web Technology UPTU UNIT 1
Unit1 Web Technology UPTU UNIT 1
 
Unit1 2
Unit1 2 Unit1 2
Unit1 2
 
Web Technology UPTU UNIT 1
Web Technology UPTU UNIT 1 Web Technology UPTU UNIT 1
Web Technology UPTU UNIT 1
 
Mtech syllabus computer science uptu
Mtech syllabus computer science uptu Mtech syllabus computer science uptu
Mtech syllabus computer science uptu
 
Wi max tutorial
Wi max tutorialWi max tutorial
Wi max tutorial
 
Virtual lan
Virtual lanVirtual lan
Virtual lan
 
Virtual lan
Virtual lanVirtual lan
Virtual lan
 
Tcp traffic control and red ecn
Tcp traffic control and red ecnTcp traffic control and red ecn
Tcp traffic control and red ecn
 
Schedulling
SchedullingSchedulling
Schedulling
 
Scheduling
SchedulingScheduling
Scheduling
 
Rsa example
Rsa exampleRsa example
Rsa example
 
Routers and planes (1)
Routers and planes (1)Routers and planes (1)
Routers and planes (1)
 

Recently uploaded

Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 

Recently uploaded (20)

Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 

uptu web technology unit 2 Xml2

  • 1. Web Technology (NCS-504) Prepared By Mr.Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad
  • 3. Introduction to XML 3 XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to carry data, not to display data XML tags are not predefined. You must define your own tags XML is designed to be self-descriptive XML is a W3C Recommendation
  • 4. XML is Not a Replacement for HTML 4 It is important to understand that XML is not a replacement for HTML. In most web applications, XML is used to transport data, while HTML is used to format and display the data.
  • 5. With XML You Invent Your Own Tags 5 The tags used in HTML are predefined. HTML documents can only use tags defined in the HTML standard (like <p>, <h1>, etc.). XML allows the author to define his/her own tags and his/her own document structure.
  • 6. XML Separates Data from HTML 6 If you need to display dynamic data in your HTML document, it will take a lot of work to edit the HTML each time the data changes. With XML, data can be stored in separate XML files. This way you can concentrate on using HTML/CSS for display and layout, and be sure that changes in the underlying data will not require any changes to the HTML. With a few lines of JavaScript code, you can read an external XML file and update the data content of your web page.
  • 7. XML Simplifies Data Transport 7 One of the most time-consuming challenges for developers is to exchange data between incompatible systems over the Internet. Exchanging data as XML greatly reduces this complexity, since the data can be read by different incompatible applications.
  • 8. HTML and XML, I 8 XML stands for eXtensible Markup Language HTML is used to mark up text so it can be displayed to users XML is used to mark up data so it can be processed by computers HTML describes both structure (e.g. <p>, <h2>, <em>) and appearance (e.g. <br>, <font>, <i>) XML describes only content, or “meaning” HTML uses a fixed, unchangeable set of tags In XML, you make up your own tags
  • 9. HTML and XML, II 9 HTML and XML look similar, because they are both SGML languages (SGML = Standard Generalized Markup Language) Both HTML and XML use elements enclosed in tags (e.g. <body>This is an element</body>) Both use tag attributes (e.g., <font face="Verdana" size="+1" color="red">) Both use entities (&lt;, &gt;, &amp;, &quot;, &apos;) More precisely, HTML is defined in SGML XML is a (very small) subset of SGML
  • 10. HTML and XML, III 10 HTML is for humans HTML describes web pages You don’t want to see error messages about the web pages you visit Browsers ignore and/or correct as many HTML errors as they can, so HTML is often sloppy XML is for computers XML describes data The rules are strict and errors are not allowed In this way, XML is like a programming language Current versions of most browsers can display XML However, browser support of XML is spotty at best
  • 11. XML-related technologies 11 DTD (Document Type Definition) and XML Schemas are used to define legal XML tags and their attributes for particular purposes CSS (Cascading Style Sheets) describe how to display HTML or XML in a browser XSLT (eXtensible Stylesheet Language Transformations) and XPath are used to translate from one form of XML to another DOM (Document Object Model), SAX (Simple API for XML, and JAXP (Java API for XML Processing) are all APIs for XML parsing
  • 12. Example XML document 12 <?xml version="1.0"?> <weatherReport> <date>7/14/97</date> <city>North Place</city>, <state>NX</state> <country>USA</country> High Temp: <high scale="F">103</high> Low Temp: <low scale="F">70</low> Morning: <morning>Partly cloudy, Hazy</morning> Afternoon: <afternoon>Sunny &amp; hot</afternoon> Evening: <evening>Clear and Cooler</evening> </weatherReport>
  • 13. Overall structure 13 An XML document may start with one or more processing instructions (PIs) or directives: <?xml version="1.0"?> <?xml-stylesheet type="text/css" href="ss.css"?> Following the directives, there must be exactly one root element containing all the rest of the XML: <weatherReport> ... </weatherReport>
  • 14. XML building blocks 14 Aside from the directives, an XML document is built from: elements: high in <high scale="F">103</high> tags, in pairs: <high scale="F">103</high> attributes: <high scale="F">103</high> entities: <afternoon>Sunny &amp; hot</afternoon> character data, which may be: parsed (processed as XML)--this is the default unparsed (all characters stand for themselves)
  • 15. Elements and attributes 15 Attributes and elements are somewhat interchangeable Example using just elements: <name> <first>David</first> <last>Matuszek</last> </name> Example using attributes: <name first="David" last="Matuszek"></name> You will find that elements are easier to use in your programs--this is a good reason to prefer them Attributes often contain metadata, such as unique IDs Generally speaking, browsers display only elements (values enclosed by tags), not tags and attributes
  • 16. Well-formed XML 16 Every element must have both a start tag and an end tag, e.g. <name> ... </name> But empty elements can be abbreviated: <break />. XML tags are case sensitive XML tags may not begin with the letters xml, in any combination of cases Elements must be properly nested, e.g. not <b><i>bold and italic</b></i> Every XML document must have one and only one root element The values of attributes must be enclosed in single or double quotes, e.g. <time unit="days"> Character data cannot contain < or &
  • 17. Entities 17 Five special characters must be written as entities: &amp; for & (almost always necessary) &lt; for < (almost always necessary) &gt; for > (not usually necessary) &quot; for " (necessary inside double quotes) &apos; for ' (necessary inside single quotes) These entities can be used even in places where they are not absolutely required These are the only predefined entities in XML
  • 18. XML declaration 18 The XML declaration looks like this: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> The XML declaration is not required by browsers, but is required by most XML processors (so include it!) If present, the XML declaration must be first--not even whitespace should precede it Note that the brackets are <? and ?> version="1.0" is required (this is the only version so far) encoding can be "UTF-8" (ASCII) or "UTF-16" (Unicode), or something else, or it can be omitted standalone tells whether there is a separate DTD
  • 19. XML Encoding XML documents can contain international characters, like Norwegian æøå, or French êèé. To avoid errors, you should specify the encoding used, or save your XML files as UTF-8. Unicode is an industry standard for character encoding of text documents. It de nes (nearly) every possiblefi international character by a name and a number. Unicode has two variants: UTF-8 and UTF-16. UTF = Universal character set Transformation Format. 19
  • 20. XML Encoding UTF-8 uses a single byte (8-bits) to represent commonly used characters and two (or three) bytes for the rest. UTF-16 uses two bytes (16 bits) for most characters, and three bytes for the rest. UTF-8 Web Standard UTF-8 is the standard character encoding on the web. UTF-8 is the default character encoding for HTML-5, CSS, JavaScript, PHP, SQL, and XML. 20
  • 21. Processing instructions 21 PIs (Processing Instructions) may occur anywhere in the XML document (but usually first) A PI is a command to the program processing the XML document to handle it in a certain way XML documents are typically processed by more than one program Programs that do not recognize a given PI should just ignore it General format of a PI: <?target instructions?> Example: <?xml-stylesheet type="text/css" href="mySheet.css"?>
  • 22. Comments 22 <!-- This is a comment in both HTML and XML --> Comments can be put anywhere in an XML document Comments are useful for: Explaining the structure of an XML document Commenting out parts of the XML during development and testing Comments are not elements and do not have an end tag The blanks after <!-- and before --> are optional The character sequence -- cannot occur in the comment The closing bracket must be --> Comments are not displayed by browsers, but can be seen by anyone who looks at the source code
  • 23. CDATA 23 By default, all text inside an XML document is parsed You can force text to be treated as unparsed character data by enclosing it in <![CDATA[ ... ]]> Any characters, even & and <, can occur inside a CDATA Whitespace inside a CDATA is (usually) preserved The only real restriction is that the character sequence ]]> cannot occur inside a CDATA CDATA is useful when your text has a lot of illegal characters (for example, if your XML document contains some HTML text)
  • 24. Names in XML 24 Names (as used for tags and attributes) must begin with a letter or underscore, and can consist of: Letters, both Roman (English) and foreign Digits, both Roman and foreign . (dot) - (hyphen) _ (underscore) : (colon) should be used only for namespaces Combining characters and extenders (not used in English)
  • 25. Namespaces 25 Recall that DTDs are used to define the tags that can be used in an XML document An XML document may reference more than one DTD Namespaces are a way to specify which DTD defines a given tag XML, like Java, uses qualified names This helps to avoid collisions between names Java: myObject.myVariable XML: myDTD:myTag Note that XML uses a colon (:) rather than a dot (.)
  • 26. Review of XML rules 26 Start with <?xml version="1"?> XML is case sensitive You must have exactly one root element that encloses all the rest of the XML Every element must have a closing tag Elements must be properly nested Attribute values must be enclosed in double or single quotation marks There are only five predeclared entities
  • 27. Another well-structured example 27 <novel> <foreword> <paragraph> This is the great American novel. </paragraph> </foreword> <chapter number="1"> <paragraph>It was a dark and stormy night. </paragraph> <paragraph>Suddenly, a shot rang out! </paragraph> </chapter> </novel>
  • 28. Valid XML 28 You can make up your own XML tags and attributes, but... ...any program that uses the XML must know what to expect! A DTD (Document Type Definition) defines what tags are legal and where they can occur in the XML An XML document does not require a DTD XML is well-structured if it follows the rules given earlier In addition, XML is valid if it declares a DTD and conforms to that DTD A DTD can be included in the XML, but is typically a separate document Errors in XML documents will stop XML programs Some alternatives to DTDs are XML Schemas and RELAX NG
  • 29. Viewing XML 29 XML is designed to be processed by computer programs, not to be displayed to humans Nevertheless, almost all current browsers can display XML documents They don’t all display it the same way They may not display it at all if it has errors For best results, update your browsers to the newest available versions Remember: HTML is designed to be viewed, XML is designed to be used
  • 30. Displaying your XML Files with CSS With CSS (Cascading Style Sheets) you can add display information to an XML document. <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/css" href="cd_catalog.css"?> <CATALOG>   <CD>     <TITLE>Empire Burlesque</TITLE>     <ARTIST>Bob Dylan</ARTIST>     <COUNTRY>USA</COUNTRY>     <COMPANY>Columbia</COMPANY>     <PRICE>10.90</PRICE>     <YEAR>1985</YEAR>   </CD> </CATALOG> 30
  • 31. CATALOG { background-color: #ffffff; width: 100%; } CD { display: block; margin-bottom: 30pt; margin-left: 0; } 31