SlideShare a Scribd company logo
XML
Extensible Markup Language
Prepared By,
Dr.K.G.Saranya
Assistant Professor (S.Gr),
Department of CSE,
PSG College of Technology,
Coimbatore-4.
SGML (Standard Generalized
Markup Language)
• It is an internationally agreed standard for data
representation.
• It is an international standard for the definition
of device independent, system independent
methods of representing texts in electronic
form.
Introduction
• XML stands for EXtensible Markup Language
• XML is a markup language much like HTML
• A simplified version of SGML
• More flexible and adaptable than HTML
• XML was designed to describe data
• XML tags are not predefined. You must define your
own tags
• XML uses a Document Type Definition (DTD) or
an XML Schema to describe the data
• XML is a W3C Recommendation.
World Wide Web Consortium published the first XML 1.0
standard definition in 1998.
Cont..
Difference between XML and HTML
The main difference between XML and HTML
– XML was designed to carry data. (XML is not
a replacement for HTML)
XML and HTML were designed with different goals:
– XML was designed to describe data and to
focus on what data is.
HTML was designed to display data and to
focus on how data looks.
– HTML is about displaying information, while
XML is about describing information.
Why Is XML Important?
• Plain Text
– Easy to edit
– Useful for storing small amounts of data
– Possible to efficiently store large amounts of XML
data through an XML front end to a database
• Data Identification
– Tell you what kind of data you have
– Can be used in different ways by different
applications
Why is XML important?
• Linkability -- XLink and XPointer
– Simple unidirectional hyperlinks
– Two-way links
– Multiple-target links
– “Expanding” links
• Easily Processed
– Regular and consistent notation
• Hierarchical
– Faster to access
– Easier to rearrange
XML Specifications
• XML 1.0
Defines the syntax of XML
• XPointer, XLink
Defines a standard way to represent links between resources
• XSL
Defines the standard stylesheet language for XML
XML Syntax
• XML declaration is the first statement
• All XML elements must have a closing tag
• XML tags are case sensitive
• All XML elements must be properly nested
• All XML documents must have a root tag
• Attribute values must always be quoted
• With XML, white space is preserved
• Comments in XML: <!-- This is a comment -->
• Certain characters are reserved for parsing
XML Validation
There are two types of XML documents
• "Well Formed" XML document
--correct XML syntax
• "Valid" XML document
– “well formed”
– Conforms to the rules of a DTD (Document Type
Definition)
• XML DTD
– defines the legal building blocks of an XML
document
– Can be inline in XML or as an external reference
• XML Schema
– an XML based alternative to DTD, more powerful
– Support namespace and data types
Displaying XML
• XML documents do not carry information about how to
display the data
• We can add display information to XML with
– CSS (Cascading Style Sheets)
– XSL (eXtensible Stylesheet Language) --- preferred
XML support in IE 5.0+
Internet Explorer 5.0 has the following XML
support:
• Viewing of XML documents
• Full support for W3C DTD standards
• Binding XML data to HTML elements
• Transforming and displaying XML with XSL
• Displaying XML with CSS
• Access to the XML DOM (Document Object Model)
*Netscape 6.0 also have full XML support
XML features
• XML uses the concept of document type and
hence a DTD (Document Type Definition) to
describe data
• XML with DTD is self descriptive
• XML separates data from display formats
• XML can be used as a format to exchange data
XML Syntax consists of
• XML Declaration
• XML Elements
• XML Attributes
• The first line of an XML document
should always consist of an XML
declaration defining the version of XML
General Structure
<root>
<child>
<subchild>…….</subchild>
</child>
</root>
Main Components of an XML
Document
• Elements: <hello>
• Attributes: <item id=“33905”>
• Entities: &lt; (<)
• Advanced Components
– CData Sections
– Processing Instructions
XML Attributes
• XML attributes are used to describe XML
elements or to provide additional information
about elements.
• Attributes provide additional information that
is not part of the data.
Ex:
• <Book no=“99-2456” media=“CD”></Book>
XML Attributes
• XML elements can have attributes in
name/value pairs as in HTML.
• Attributes must always be in quotes.
Either single or double quotes are valid,
though double quotes are most
common.
• Attributes are always contained within
the start tag of an element.
Attributes Vs. Elements
Case 1 ( Attributes)
< Book no= “99-2356”type= “CD”>
< author>
< firstname>XXX</firstname>
<lastname>YYY</lastname>
</author>
</Book>
Case 2 ( Elements)
• <Book>
• <no>99-2356</no>
• <type>CD</type>
• < author>
• < firstname>XXX</firstname>
• <lastname>YYY</lastname>
• </author>
• </Book>
Where elements scores over attributes
• Elements can describe structure but not
attributes
• Attributes are more difficult to manipulate
by program code than elements
• Attribute values are difficult to validate
against a DTD
XML strengths
• Its ability to describe data
• Its ability to structure data
• Separate display from structure
• Supported by industry
• Availability of tools
XML applications
• B2B
• EDI
• Journal publishing
• Database development
An example of XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>XXX</to>
<from>YYY</from>
<heading>XML</heading>
<body> Extensible Markup Language </body>
</note>
Contents of the ProductList.xml Document
Cont.,
• The first line represents the XML document
declaration and it is mandatory.
• Every XML has a root element. In our example,
the second line is the root element -
<ProductList>
• The root element can contain child elements. In
our example, Product is the child element of
ProductList
• Each element can contain sub-elements.
– <P_CODE>,<P_PRICE> are sub-elements.
Example
<?xml version="1.0" encoding= "ISO-8859-1" ?>
<book>
<title> XML </title>
<chapter> introduction to xml
<para>Markup languages</para>
<para>Features of XML</para>
</chapter>
<chapter>XML syntax
<para>Elements must be enclosed in tags</para>
<para>Elements must be properly nested</para>
</chapter>
</book>
XMLArchitecture
How do you get the data?
XML
data
Parser Information
structure
(tree+links)
Documents, stylesheets, and other data can all be expressed in
XML.
DOM Interface
Any application can
plug in via an API
called “Document
Object Model”
DTD/Schema
This model can work locally or over a network.
Parsing, tree-building, and access can shift between
client/server
XML Parser
• All modern browsers have a built-in XML parser.
• An XML parser converts an XML document into
an XML DOM object - which can then be
manipulated with a JavaScript.
XML DOM
• A DOM (Document Object Model) defines a
standard way for accessing and manipulating
XML documents.
XML Namespaces
• XML Namespaces provide a method to
avoid element name conflicts.
• This XML carries HTML table information:
<table>
<tr>
<td>Apples</td>
<td>Bananas</td>
</tr>
</table>
• This XML carries information about a table
(a piece of furniture):
<table>
<name>African Coffee Table</name>
<width>80</width>
<length>120</length>
</table>
•If these XML fragments were added together, there
would be a name conflict.
•Both contain a <table>element, but the elements
have different content and meaning.
An XML parser will not know how to handle these
differences.
Solving the Name Conflict Using a Prefix
• Name conflicts in XML can easily be avoided
using a name prefix.
• This XML carries information about an HTML
table, and a piece of furniture:
<h:table>
<h:tr>
<h:td>Apples</h:td>
<h:td>Bananas</h:td>
</h:tr>
</h:table>
<f:table>
<f:name>African Coffee Table</f:name>
<f:width>80</f:width>
<f:length>120</f:length>
</f:table>
• In the example above, there will be no
conflict because the two <table> elements
have different names.
XML Namespaces - The xmlns Attribute
• When using prefixes in XML, a so-called
namespace for the prefix must be defined.
• The namespace is defined by the xmlns
attribute in the start tag of an element.
• The namespace declaration has the
following syntax. xmlns:prefix="URI".
<root>
<h:table xmlns:h="http://www.w3.org/TR/html4/">
<h:tr>
<h:td>Apples</h:td>
<h:td>Bananas</h:td>
</h:tr>
</h:table>
<f:table xmlns:f="http://www.w3schools.com/furniture">
<f:name>African Coffee Table</f:name>
<f:width>80</f:width>
<f:length>120</f:length>
</f:table>
</root>
XML Namespaces - The xmlns Attribute
• In the example above, the xmlns attribute in the
<table> tag give the h: and f: prefixes a qualified
namespace.
• When a namespace is defined for an element,
all child elements with the same prefix are
associated with the same namespace.
• Namespaces can be declared in the elements
where they are used or in the XML root element:
URI
• Uniform Resource Identifier (URI)
• A Uniform Resource Identifier (URI) is a string
of characters which identifies an Internet
Resource.
• The most common URI is the Uniform
Resource Locator (URL) which identifies an
Internet domain address. Another, not so
common type of URI is the Universal Resource
Name (URN).
PCDATA - Parsed Character Data
• XML parsers normally parse all the text in
an XML document.
• When an XML element is parsed, the text
between the XML tags is also parsed:
<message>This text is also parsed</message>
<name><first>Bill</first><last>Gates</last></name>
The parser does this because XML elements can
contain other elements, as in this example, where
the <name> element contains two other elements
(first and last): and the parser will break it up into
sub-elements like this:
<name>
<first>Bill</first>
<last>Gates</last>
</name
Parsed Character Data (PCDATA) is a term used about text
data that will be parsed by the XML parser.
CDATA - (Unparsed) Character Data
• The term CDATA is used about text data that should not
be parsed by the XML parser.
• Characters like "<" and "&" are illegal in XML elements.
• "<" will generate an error because the parser interprets it
as the start of a new element.
• "&" will generate an error because the parser interprets it
as the start of an character entity.
• Some text, like JavaScript code, contains a lot of "<" or
"&" characters. To avoid errors script code can be
defined as CDATA.
• Everything inside a CDATA section is ignored by
the parser.
• A CDATA section starts with "<![CDATA[" and
ends with "]]>":
<script>
<![CDATA[
function matchwo(a,b)
{
if (a < b && a < 0) then
{
return 1;
}
else
{
return 0;
}
}
]]>
</script>
In this example, everything inside
the CDATA section is ignored by the
parser
Conclusion
• XML is a self-descriptive language
• XML is a powerful language to describe
structure data for web application
• XML is currently applied in many fields
• Many vendors already supports or will support
XML
• XML Documents can be validated through the
use of DTD and XSD documents
• XML impacts B2B data exchanges, legacy
system integration, web page development,
database system integration.

More Related Content

What's hot

XML
XMLXML
XML
XMLXML
Xml dom
Xml domXml dom
Xml dom
sana mateen
 
Xml 215-presentation
Xml 215-presentationXml 215-presentation
Xml 215-presentation
Manish Chaurasia
 
XML Introduction
XML IntroductionXML Introduction
XML Introduction
Bikash chhetri
 
XML
XMLXML
Dynamic HTML (DHTML)
Dynamic HTML (DHTML)Dynamic HTML (DHTML)
Dynamic HTML (DHTML)
Himanshu Kumar
 
Xml parsers
Xml parsersXml parsers
Xml parsers
Manav Prasad
 
Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)club23
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
Nisa Soomro
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
Jussi Pohjolainen
 
Xml
XmlXml
Xml ppt
Xml pptXml ppt
Xml ppt
seemadav1
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
Bình Trọng Án
 
Html basics
Html basicsHtml basics
Html basics
mcatahir947
 
Soa unit-1-well formed and valid document08.07.2019
Soa unit-1-well formed and valid document08.07.2019Soa unit-1-well formed and valid document08.07.2019
Soa unit-1-well formed and valid document08.07.2019
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
Dom
Dom Dom

What's hot (20)

XML
XMLXML
XML
 
XML
XMLXML
XML
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
Xml dom
Xml domXml dom
Xml dom
 
Xml 215-presentation
Xml 215-presentationXml 215-presentation
Xml 215-presentation
 
Introducing Cascading Style Sheets
Introducing Cascading Style SheetsIntroducing Cascading Style Sheets
Introducing Cascading Style Sheets
 
XML Introduction
XML IntroductionXML Introduction
XML Introduction
 
XML
XMLXML
XML
 
Dynamic HTML (DHTML)
Dynamic HTML (DHTML)Dynamic HTML (DHTML)
Dynamic HTML (DHTML)
 
Xml parsers
Xml parsersXml parsers
Xml parsers
 
Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Xml
XmlXml
Xml
 
Xml ppt
Xml pptXml ppt
Xml ppt
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Html basics
Html basicsHtml basics
Html basics
 
Soa unit-1-well formed and valid document08.07.2019
Soa unit-1-well formed and valid document08.07.2019Soa unit-1-well formed and valid document08.07.2019
Soa unit-1-well formed and valid document08.07.2019
 
Xpath presentation
Xpath presentationXpath presentation
Xpath presentation
 
Dom
Dom Dom
Dom
 

Similar to 1 xml fundamentals

Xml iet 2015
Xml iet 2015Xml iet 2015
Xml iet 2015
kiransurariya
 
Xml and DTD's
Xml and DTD'sXml and DTD's
Xml and DTD's
Swati Parmar
 
M.FLORENCE DAYANA WEB DESIGN -Unit 5 XML
M.FLORENCE DAYANA WEB DESIGN -Unit 5   XMLM.FLORENCE DAYANA WEB DESIGN -Unit 5   XML
M.FLORENCE DAYANA WEB DESIGN -Unit 5 XML
Dr.Florence Dayana
 
01 xml document structure
01 xml document structure01 xml document structure
01 xml document structure
Baskarkncet
 
Web Technology Part 4
Web Technology Part 4Web Technology Part 4
Web Technology Part 4
Thapar Institute
 
WT UNIT-2 XML.pdf
WT UNIT-2 XML.pdfWT UNIT-2 XML.pdf
WT UNIT-2 XML.pdf
Ranjeet Reddy
 
xml.pptx
xml.pptxxml.pptx
xml.pptx
TilakaRt
 
XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
Pradeep Rapolu
 
Xml intro1
Xml intro1Xml intro1
IT6801-Service Oriented Architecture- UNIT-I notes
IT6801-Service Oriented Architecture- UNIT-I notesIT6801-Service Oriented Architecture- UNIT-I notes
IT6801-Service Oriented Architecture- UNIT-I notes
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
CTDA Workshop on XML and MODS
CTDA Workshop on XML and MODSCTDA Workshop on XML and MODS
CTDA Workshop on XML and MODS
University of Connecticut Libraries
 
Unit 5 xml (1)
Unit 5   xml (1)Unit 5   xml (1)
Unit 5 xml (1)
manochitra10
 
Web Technologies Unit 2 Print.pdf
Web Technologies Unit 2 Print.pdfWeb Technologies Unit 2 Print.pdf
Web Technologies Unit 2 Print.pdf
AnonymousXhmybK
 
Xml
XmlXml
Xml
Anas Sa
 

Similar to 1 xml fundamentals (20)

XML
XMLXML
XML
 
Xml iet 2015
Xml iet 2015Xml iet 2015
Xml iet 2015
 
Xml and DTD's
Xml and DTD'sXml and DTD's
Xml and DTD's
 
Ch2 neworder
Ch2 neworderCh2 neworder
Ch2 neworder
 
M.FLORENCE DAYANA WEB DESIGN -Unit 5 XML
M.FLORENCE DAYANA WEB DESIGN -Unit 5   XMLM.FLORENCE DAYANA WEB DESIGN -Unit 5   XML
M.FLORENCE DAYANA WEB DESIGN -Unit 5 XML
 
01 xml document structure
01 xml document structure01 xml document structure
01 xml document structure
 
Web Technology Part 4
Web Technology Part 4Web Technology Part 4
Web Technology Part 4
 
WT UNIT-2 XML.pdf
WT UNIT-2 XML.pdfWT UNIT-2 XML.pdf
WT UNIT-2 XML.pdf
 
Xml
XmlXml
Xml
 
xml.pptx
xml.pptxxml.pptx
xml.pptx
 
XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
 
Xml intro1
Xml intro1Xml intro1
Xml intro1
 
Xmll
XmllXmll
Xmll
 
Xml andweb services
Xml andweb services Xml andweb services
Xml andweb services
 
Xml
XmlXml
Xml
 
IT6801-Service Oriented Architecture- UNIT-I notes
IT6801-Service Oriented Architecture- UNIT-I notesIT6801-Service Oriented Architecture- UNIT-I notes
IT6801-Service Oriented Architecture- UNIT-I notes
 
CTDA Workshop on XML and MODS
CTDA Workshop on XML and MODSCTDA Workshop on XML and MODS
CTDA Workshop on XML and MODS
 
Unit 5 xml (1)
Unit 5   xml (1)Unit 5   xml (1)
Unit 5 xml (1)
 
Web Technologies Unit 2 Print.pdf
Web Technologies Unit 2 Print.pdfWeb Technologies Unit 2 Print.pdf
Web Technologies Unit 2 Print.pdf
 
Xml
XmlXml
Xml
 

More from Dr.Saranya K.G

complete web service1.ppt
complete web service1.pptcomplete web service1.ppt
complete web service1.ppt
Dr.Saranya K.G
 
Introduction to Web Services Protocols.ppt
Introduction to Web Services Protocols.pptIntroduction to Web Services Protocols.ppt
Introduction to Web Services Protocols.ppt
Dr.Saranya K.G
 
1.Usability Engineering.pptx
1.Usability Engineering.pptx1.Usability Engineering.pptx
1.Usability Engineering.pptx
Dr.Saranya K.G
 
CSSE375-03-framework.ppt
CSSE375-03-framework.pptCSSE375-03-framework.ppt
CSSE375-03-framework.ppt
Dr.Saranya K.G
 
Neo4 j
Neo4 jNeo4 j
Xquery1
Xquery1Xquery1
Xsl xslt
Xsl  xsltXsl  xslt
Xsl xslt
Dr.Saranya K.G
 
Xpath1
Xpath1Xpath1
Converting dt ds to xml schemas
Converting dt ds to xml schemasConverting dt ds to xml schemas
Converting dt ds to xml schemas
Dr.Saranya K.G
 
Dtd
DtdDtd
Xml schema
Xml schemaXml schema
Xml schema
Dr.Saranya K.G
 

More from Dr.Saranya K.G (12)

complete web service1.ppt
complete web service1.pptcomplete web service1.ppt
complete web service1.ppt
 
Introduction to Web Services Protocols.ppt
Introduction to Web Services Protocols.pptIntroduction to Web Services Protocols.ppt
Introduction to Web Services Protocols.ppt
 
1.Usability Engineering.pptx
1.Usability Engineering.pptx1.Usability Engineering.pptx
1.Usability Engineering.pptx
 
CSSE375-03-framework.ppt
CSSE375-03-framework.pptCSSE375-03-framework.ppt
CSSE375-03-framework.ppt
 
SQA.ppt
SQA.pptSQA.ppt
SQA.ppt
 
Neo4 j
Neo4 jNeo4 j
Neo4 j
 
Xquery1
Xquery1Xquery1
Xquery1
 
Xsl xslt
Xsl  xsltXsl  xslt
Xsl xslt
 
Xpath1
Xpath1Xpath1
Xpath1
 
Converting dt ds to xml schemas
Converting dt ds to xml schemasConverting dt ds to xml schemas
Converting dt ds to xml schemas
 
Dtd
DtdDtd
Dtd
 
Xml schema
Xml schemaXml schema
Xml schema
 

Recently uploaded

NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
aqil azizi
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 

Recently uploaded (20)

NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 

1 xml fundamentals

  • 1. XML Extensible Markup Language Prepared By, Dr.K.G.Saranya Assistant Professor (S.Gr), Department of CSE, PSG College of Technology, Coimbatore-4.
  • 2. SGML (Standard Generalized Markup Language) • It is an internationally agreed standard for data representation. • It is an international standard for the definition of device independent, system independent methods of representing texts in electronic form.
  • 3. Introduction • XML stands for EXtensible Markup Language • XML is a markup language much like HTML • A simplified version of SGML • More flexible and adaptable than HTML • XML was designed to describe data
  • 4. • XML tags are not predefined. You must define your own tags • XML uses a Document Type Definition (DTD) or an XML Schema to describe the data • XML is a W3C Recommendation. World Wide Web Consortium published the first XML 1.0 standard definition in 1998. Cont..
  • 5. Difference between XML and HTML The main difference between XML and HTML – XML was designed to carry data. (XML is not a replacement for HTML) XML and HTML were designed with different goals: – XML was designed to describe data and to focus on what data is. HTML was designed to display data and to focus on how data looks. – HTML is about displaying information, while XML is about describing information.
  • 6. Why Is XML Important? • Plain Text – Easy to edit – Useful for storing small amounts of data – Possible to efficiently store large amounts of XML data through an XML front end to a database • Data Identification – Tell you what kind of data you have – Can be used in different ways by different applications
  • 7. Why is XML important? • Linkability -- XLink and XPointer – Simple unidirectional hyperlinks – Two-way links – Multiple-target links – “Expanding” links • Easily Processed – Regular and consistent notation • Hierarchical – Faster to access – Easier to rearrange
  • 8. XML Specifications • XML 1.0 Defines the syntax of XML • XPointer, XLink Defines a standard way to represent links between resources • XSL Defines the standard stylesheet language for XML
  • 9. XML Syntax • XML declaration is the first statement • All XML elements must have a closing tag • XML tags are case sensitive • All XML elements must be properly nested • All XML documents must have a root tag • Attribute values must always be quoted • With XML, white space is preserved • Comments in XML: <!-- This is a comment --> • Certain characters are reserved for parsing
  • 10. XML Validation There are two types of XML documents • "Well Formed" XML document --correct XML syntax • "Valid" XML document – “well formed” – Conforms to the rules of a DTD (Document Type Definition) • XML DTD – defines the legal building blocks of an XML document – Can be inline in XML or as an external reference • XML Schema – an XML based alternative to DTD, more powerful – Support namespace and data types
  • 11. Displaying XML • XML documents do not carry information about how to display the data • We can add display information to XML with – CSS (Cascading Style Sheets) – XSL (eXtensible Stylesheet Language) --- preferred
  • 12. XML support in IE 5.0+ Internet Explorer 5.0 has the following XML support: • Viewing of XML documents • Full support for W3C DTD standards • Binding XML data to HTML elements • Transforming and displaying XML with XSL • Displaying XML with CSS • Access to the XML DOM (Document Object Model) *Netscape 6.0 also have full XML support
  • 13. XML features • XML uses the concept of document type and hence a DTD (Document Type Definition) to describe data • XML with DTD is self descriptive • XML separates data from display formats • XML can be used as a format to exchange data
  • 14. XML Syntax consists of • XML Declaration • XML Elements • XML Attributes • The first line of an XML document should always consist of an XML declaration defining the version of XML
  • 16. Main Components of an XML Document • Elements: <hello> • Attributes: <item id=“33905”> • Entities: &lt; (<) • Advanced Components – CData Sections – Processing Instructions
  • 17. XML Attributes • XML attributes are used to describe XML elements or to provide additional information about elements. • Attributes provide additional information that is not part of the data. Ex: • <Book no=“99-2456” media=“CD”></Book>
  • 18. XML Attributes • XML elements can have attributes in name/value pairs as in HTML. • Attributes must always be in quotes. Either single or double quotes are valid, though double quotes are most common. • Attributes are always contained within the start tag of an element.
  • 19. Attributes Vs. Elements Case 1 ( Attributes) < Book no= “99-2356”type= “CD”> < author> < firstname>XXX</firstname> <lastname>YYY</lastname> </author> </Book>
  • 20. Case 2 ( Elements) • <Book> • <no>99-2356</no> • <type>CD</type> • < author> • < firstname>XXX</firstname> • <lastname>YYY</lastname> • </author> • </Book>
  • 21. Where elements scores over attributes • Elements can describe structure but not attributes • Attributes are more difficult to manipulate by program code than elements • Attribute values are difficult to validate against a DTD
  • 22. XML strengths • Its ability to describe data • Its ability to structure data • Separate display from structure • Supported by industry • Availability of tools
  • 23. XML applications • B2B • EDI • Journal publishing • Database development
  • 24. An example of XML <?xml version="1.0" encoding="ISO-8859-1"?> <note> <to>XXX</to> <from>YYY</from> <heading>XML</heading> <body> Extensible Markup Language </body> </note>
  • 25. Contents of the ProductList.xml Document
  • 26. Cont., • The first line represents the XML document declaration and it is mandatory. • Every XML has a root element. In our example, the second line is the root element - <ProductList> • The root element can contain child elements. In our example, Product is the child element of ProductList • Each element can contain sub-elements. – <P_CODE>,<P_PRICE> are sub-elements.
  • 27. Example <?xml version="1.0" encoding= "ISO-8859-1" ?> <book> <title> XML </title> <chapter> introduction to xml <para>Markup languages</para> <para>Features of XML</para> </chapter> <chapter>XML syntax <para>Elements must be enclosed in tags</para> <para>Elements must be properly nested</para> </chapter> </book>
  • 29. How do you get the data? XML data Parser Information structure (tree+links) Documents, stylesheets, and other data can all be expressed in XML. DOM Interface Any application can plug in via an API called “Document Object Model” DTD/Schema This model can work locally or over a network. Parsing, tree-building, and access can shift between client/server
  • 30. XML Parser • All modern browsers have a built-in XML parser. • An XML parser converts an XML document into an XML DOM object - which can then be manipulated with a JavaScript. XML DOM • A DOM (Document Object Model) defines a standard way for accessing and manipulating XML documents.
  • 31. XML Namespaces • XML Namespaces provide a method to avoid element name conflicts. • This XML carries HTML table information: <table> <tr> <td>Apples</td> <td>Bananas</td> </tr> </table>
  • 32. • This XML carries information about a table (a piece of furniture): <table> <name>African Coffee Table</name> <width>80</width> <length>120</length> </table> •If these XML fragments were added together, there would be a name conflict. •Both contain a <table>element, but the elements have different content and meaning. An XML parser will not know how to handle these differences.
  • 33. Solving the Name Conflict Using a Prefix • Name conflicts in XML can easily be avoided using a name prefix. • This XML carries information about an HTML table, and a piece of furniture: <h:table> <h:tr> <h:td>Apples</h:td> <h:td>Bananas</h:td> </h:tr> </h:table> <f:table> <f:name>African Coffee Table</f:name> <f:width>80</f:width> <f:length>120</f:length> </f:table>
  • 34. • In the example above, there will be no conflict because the two <table> elements have different names.
  • 35. XML Namespaces - The xmlns Attribute • When using prefixes in XML, a so-called namespace for the prefix must be defined. • The namespace is defined by the xmlns attribute in the start tag of an element. • The namespace declaration has the following syntax. xmlns:prefix="URI".
  • 36. <root> <h:table xmlns:h="http://www.w3.org/TR/html4/"> <h:tr> <h:td>Apples</h:td> <h:td>Bananas</h:td> </h:tr> </h:table> <f:table xmlns:f="http://www.w3schools.com/furniture"> <f:name>African Coffee Table</f:name> <f:width>80</f:width> <f:length>120</f:length> </f:table> </root> XML Namespaces - The xmlns Attribute
  • 37. • In the example above, the xmlns attribute in the <table> tag give the h: and f: prefixes a qualified namespace. • When a namespace is defined for an element, all child elements with the same prefix are associated with the same namespace. • Namespaces can be declared in the elements where they are used or in the XML root element:
  • 38. URI • Uniform Resource Identifier (URI) • A Uniform Resource Identifier (URI) is a string of characters which identifies an Internet Resource. • The most common URI is the Uniform Resource Locator (URL) which identifies an Internet domain address. Another, not so common type of URI is the Universal Resource Name (URN).
  • 39. PCDATA - Parsed Character Data • XML parsers normally parse all the text in an XML document. • When an XML element is parsed, the text between the XML tags is also parsed: <message>This text is also parsed</message>
  • 40. <name><first>Bill</first><last>Gates</last></name> The parser does this because XML elements can contain other elements, as in this example, where the <name> element contains two other elements (first and last): and the parser will break it up into sub-elements like this: <name> <first>Bill</first> <last>Gates</last> </name Parsed Character Data (PCDATA) is a term used about text data that will be parsed by the XML parser.
  • 41. CDATA - (Unparsed) Character Data • The term CDATA is used about text data that should not be parsed by the XML parser. • Characters like "<" and "&" are illegal in XML elements. • "<" will generate an error because the parser interprets it as the start of a new element. • "&" will generate an error because the parser interprets it as the start of an character entity. • Some text, like JavaScript code, contains a lot of "<" or "&" characters. To avoid errors script code can be defined as CDATA.
  • 42. • Everything inside a CDATA section is ignored by the parser. • A CDATA section starts with "<![CDATA[" and ends with "]]>": <script> <![CDATA[ function matchwo(a,b) { if (a < b && a < 0) then { return 1; } else { return 0; } } ]]> </script> In this example, everything inside the CDATA section is ignored by the parser
  • 43. Conclusion • XML is a self-descriptive language • XML is a powerful language to describe structure data for web application • XML is currently applied in many fields • Many vendors already supports or will support XML • XML Documents can be validated through the use of DTD and XSD documents • XML impacts B2B data exchanges, legacy system integration, web page development, database system integration.