SlideShare une entreprise Scribd logo
1  sur  43
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.

Contenu connexe

Tendances (20)

Css selectors
Css selectorsCss selectors
Css selectors
 
XSLT.ppt
XSLT.pptXSLT.ppt
XSLT.ppt
 
HTML Semantic Tags
HTML Semantic TagsHTML Semantic Tags
HTML Semantic Tags
 
Xml dtd
Xml dtdXml dtd
Xml dtd
 
HTML Introduction
HTML IntroductionHTML Introduction
HTML Introduction
 
Xml 215-presentation
Xml 215-presentationXml 215-presentation
Xml 215-presentation
 
Xml
XmlXml
Xml
 
div tag.pdf
div tag.pdfdiv tag.pdf
div tag.pdf
 
Xml Presentation-3
Xml Presentation-3Xml Presentation-3
Xml Presentation-3
 
Xml
XmlXml
Xml
 
Html hyperlinks
Html hyperlinksHtml hyperlinks
Html hyperlinks
 
Xml
Xml Xml
Xml
 
Html5 semantics
Html5 semanticsHtml5 semantics
Html5 semantics
 
DTD
DTDDTD
DTD
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid Layout
 
Lesson 5 php operators
Lesson 5   php operatorsLesson 5   php operators
Lesson 5 php operators
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
CSS Flexbox (flexible box layout)
CSS Flexbox (flexible box layout)CSS Flexbox (flexible box layout)
CSS Flexbox (flexible box layout)
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
XML
XMLXML
XML
 

Similaire à 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
 

Plus de 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
 

Dernier

Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLManishPatel169454
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 

Dernier (20)

Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 

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.