SlideShare a Scribd company logo
1 of 52
XML
XML
• Is the “eXtensible Markup Language”
• Became a W3C Recommendation in 1998
• Tag-based syntax, very much like HTML
• Is not a replacement for HTML
• X means eXtensible - we can make your own tag
• Revolutionizes software development
• Enables application portability
XML is not…
• A replacement for HTML
(but HTML can be generated from XML)
• A presentation format
(but XML can be converted into one)
• A programming language
(but it can be used with almost any language)
• A network transfer protocol
(but XML may be transferred over a network)
• A database
(but XML may be stored into a database)
But then – what is it?
XML is a meta markup language for
text documents / textual data
XML allows to define languages
(”applications“) to represent text
documents / textual data
XML by Example
<article>
<author>Ram Bahadur</author>
<title>The Web in 10 Years</title>
</article>
• Easy to understand for human users
• Very expressive (semantics along with the data)
• Well structured, easy to read and write from programs
XML by Example
<t108>
<x87>Ram Bahadur</x87>
<g10>The Web in 10 Years</g10>
</t108>
• Hard to understand for human users
• Not expressive (no semantics along with the data)
• Well structured, easy to read and write from programs
… this is XML, too:
XML by Example
<data>
ch37fhgks73j5mv9d63h5mgfkds8d984lgnsmcns983
</data>
• Impossible to understand for human users
• Not expressive (no semantics along with the data)
• Unstructured, read and write only with special
programs
… and what about this XML document:
The actual benefit of using XML highly depends on the design of the application.
Possible Advantages of Using XML
• Truly Portable Data
• Easily readable by human users
• Very flexible and customizable (no finite tag set)
• Easy to use from programs (libs available)
• Easy to convert into other representations
(XML transformation languages)
• Many additional standards and tools
• Widely used and supported
Application
Database with
XML documents
Clients
ConvertersXML2HTML XML2WML XML2PDF
Application
Legacy
System
(e.g., SAP
)
Legacy
System
(e.g.,
Cobol)
XML
Adapter
XML
Adapter
XML
SupplierBuyer
Order
Application
• Document Markup adds structural and
semantic information to documents, e.g.
– Sections, Subsections, Theorems, …
– Cross References
– Literature Citations
XML Standards – an Overview
• XML Core Working Group:
– XML 1.0 (Feb 1998), 1.1 (candidate for recommendation)
– XML Namespaces (Jan 1999)
• XSLT Working Group:
– XSL(eXtensible Stylesheet Language) Transformations 1.0 (Nov 1999), 2.0
planned
– XPath 1.0 (Nov 1999), 2.0 planned
• XML Linking Working Group:
– XLink 1.0 (Jun 2001)
– XPointer 1.0 (March 2003)
• XQuery 1.0 (Nov 2002)
• XMLSchema 1.0 (May 2001)
XML Documents
A Simple XML Document
<article>
<author>Ram Bahadur</author>
<title>The Web in Ten Years</title>
<text>
<abstract>In order to evolve...</abstract>
<section number=“1” title=“Introduction”>
The <index>Web</index> provides the universal...
</section>
</text>
</article>
A Simple XML Document
<article>
<author>Ram Bahadur</author>
<title>The Web in Ten Years</title>
<text>
<abstract>In order to evolve...</abstract>
<section number=“1” title=“Introduction”>
The <index>Web</index> provides the universal...
</section>
</text>
</article>
Freely definable tags
Element
Content of the
Element
(Subelements
and/or Text)
A Simple XML Document<article>
<author>Gerhard Weikum</author>
<title>The Web in Ten Years</title>
<text>
<abstract>In order to evolve...</abstract>
<section number=“1” title=“Introduction”>
The <index>Web</index> provides the universal...
</section>
</text>
</article>
End Tag
Start Tag
A Simple XML Document<article>
<author>Gerhard Weikum</author>
<title>The Web in Ten Years</title>
<text>
<abstract>In order to evolve...</abstract>
<section number=“1” title=“Introduction”>
The <index>Web</index> provides the universal...
</section>
</text>
</article>
Attributes with
name and value
Elements in XML Documents
• (Freely definable) tags: article, title, author
– with start tag: <article> etc.
– and end tag: </article> etc.
• Elements: <article> ... </article>
• Elements have a name (article) and a content (...)
• Elements may be nested.
• Elements may be empty: <this_is_empty/>
• Element content is typically parsed character data (PCDATA),
i.e., strings with special characters, and/or nested elements
(mixed content if both).
• Each XML document has exactly one root element and forms
a tree.
XML Documents as Ordered Trees
article
author title text
sectionabstract
The index
Web
provides …
title=“…“
number=“1“
In order …
Ram
Bahadur
The Web
in 10 years
Well-Formed XML Documents
A well-formed document must adher to, among others,
the following rules:
• Every start tag has a matching end tag.
• Elements may nest, but must not overlap.
• There must be exactly one root element.
• Attribute values must be quoted.
• An element may not have two attributes with the same
name.
• Comments and processing instructions may not appear
inside tags.
• No unescaped < or & signs may occur inside character
data.
Well-Formed XML Documents
A well-formed document must adher to, among others,
the following rules:
• Every start tag has a matching end tag.
• Elements may nest, but must not overlap.
• There must be exactly one root element.
• Attribute values must be quoted.
• An element may not have to attributes with the same
name.
• Comments and processing instructions may not appear
inside tags.
• No unescaped < or & signs may occur inside character
data.
Only well-formed documents
can be processed by XML
parsers.
XML document
XML with CSS
XSL
• XML also has it's own styles language – XSL
• XSL stands for Extensible Styles Language and
is a very powerful language for applying styles
to XML documents
• XSL has two parts
– a formatting language
– a transformation language.
• The formatting language allows to apply styles
similar to CSS
• Browser support for the XSL formatting language
is limited
• The transformation language is known as XSLT
(XSL Transformations)
• XSLT allows to transform XML document into
another form
• For example, we could use XSLT to dynamically
output some (or all) of the contents of your XML
file into an HTML document
Namespace
• XML allows to create our own element names,
there's always the possibility of naming an
element exactly the same as one in another XML
document
• This might be OK if we never use both documents
together
• But what if we need to combine the content of
both documents
• Would have a name conflict
– Would have two different elements, with different
purposes, both with the same name
Example Name Conflict
Example Namespace
Namespace Syntax
<bk:books xmlns:bk =“http://www.books.com/books_detail“>
Unique URI to identify
the namespace
Signal that namespace
definition happens
Prefix as abbrevation
of URI
Local Namespace
• We created a namespace to avoid a name conflict
between the elements of two documents we
wanted to combine
• When we defined the namespace, we defined it
against the root element
• This meant that the namespace was to be used
for the whole document, and we prefixed all child
elements with the same namespace.
• Can also define namespaces against a child node
• This way, we could use multiple namespaces
within the same document if required
Example
Multiple Namespaces
• We could also have multiple namespaces
within your XML document
• For example, we could define one namespace
against the root element, and another against
a child element
Example
XML Default Namespace
• We applied the prefix when we defined the
namespace, and we applied a prefix to each
element that referred to the namespace.
• We can also use what is known as a default
namespace within our XML documents
• The only difference is, a default namespace is
one where we don't apply a prefix
Example
XML Entities
• We can use entities to represent:
– Characters that would otherwise cause problems
for the XML processor
– Large blocks of data that need to be repeated
throughout the document
– Characters that you can't type on your keyboard
(eg, ©)
Problematic Characters
• Some characters have a special meaning in XML.
• For example:
– the less than sign (<) marks the beginning of a tag
– And, of course, the greater than sign (>) marks the
end of the tag.
• When the XML processor parses the document, it
looks for these characters (and others) to
determine how to interpret the document
• This is fine, as long as your data doesn't contain
any of these characters.
– But what if it does?
• Imagine you had the following text within an
element: 10 < 5.
• When the XML processor encounters the <, it
will assume it's the start of an opening tag.
– Problem is, it's not.
• In order to include characters such as < and &
etc, we need to use their entity reference
instead of the character itself
Predefined Entity References
XML Creating Entities
• Defining
• Using
Example
CDATA
• In XML, a CDATA section is used to escape a
block of text that would otherwise be parsed
as markup
Why Are CDATA Sections Useful?
• Occasionally data contains large blocks of text
with lots of potentially problematic characters
• For example,
– Data could contain a programming script
– Many progamming scripts contain characters such
as less than/greater than signs, ampersands etc,
which would cause problems for the XML
processor.
• CDATA allows to escape the whole block of
text
• This eliminates the need to go through the
whole script, individually replacing all the
potentially problematic characters
• The XML processor knows to escape all data
between the CDATA tags
CDATA Syntax
• Declare a CDATA section using
– <![CDATA[ as the opening tag
– ]]> as the closing tag
Example
XML

More Related Content

What's hot (20)

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
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Xml
XmlXml
Xml
 
Html (1)
Html (1)Html (1)
Html (1)
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Publishing xml
Publishing xmlPublishing xml
Publishing xml
 
00 introduction
00 introduction00 introduction
00 introduction
 
Unit iv xml
Unit iv xmlUnit iv xml
Unit iv xml
 
Dom parser
Dom parserDom parser
Dom parser
 
01 xml document structure
01 xml document structure01 xml document structure
01 xml document structure
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Xml Lecture Notes
Xml Lecture NotesXml Lecture Notes
Xml Lecture Notes
 
Xml basics for beginning
Xml basics for beginningXml basics for beginning
Xml basics for beginning
 
Xml dom
Xml domXml dom
Xml dom
 
Basics of XML
Basics of XMLBasics of XML
Basics of XML
 
Dtd
DtdDtd
Dtd
 
Introduction to XML and Databases
Introduction to XML and DatabasesIntroduction to XML and Databases
Introduction to XML and Databases
 
Xml unit1
Xml unit1Xml unit1
Xml unit1
 

Similar to XML (20)

Xml iet 2015
Xml iet 2015Xml iet 2015
Xml iet 2015
 
Ch2 neworder
Ch2 neworderCh2 neworder
Ch2 neworder
 
Xml
XmlXml
Xml
 
XML.pptx
XML.pptxXML.pptx
XML.pptx
 
Unit3wt
Unit3wtUnit3wt
Unit3wt
 
Unit3wt
Unit3wtUnit3wt
Unit3wt
 
Introduce to XML
Introduce to XMLIntroduce to XML
Introduce to XML
 
WT UNIT-2 XML.pdf
WT UNIT-2 XML.pdfWT UNIT-2 XML.pdf
WT UNIT-2 XML.pdf
 
XML - Extensible Markup Language for Network Security.pptx
XML - Extensible Markup Language for Network Security.pptxXML - Extensible Markup Language for Network Security.pptx
XML - Extensible Markup Language for Network Security.pptx
 
chapter 4 web authoring unit 4 xml.pptx
chapter 4 web authoring  unit 4 xml.pptxchapter 4 web authoring  unit 4 xml.pptx
chapter 4 web authoring unit 4 xml.pptx
 
Xml
XmlXml
Xml
 
Xml
XmlXml
Xml
 
1 xml fundamentals
1 xml fundamentals1 xml fundamentals
1 xml fundamentals
 
Introduction to XML.ppt
Introduction to XML.pptIntroduction to XML.ppt
Introduction to XML.ppt
 
Introduction to XML.ppt
Introduction to XML.pptIntroduction to XML.ppt
Introduction to XML.ppt
 
Xml passing in java
Xml passing in javaXml passing in java
Xml passing in java
 
BITM3730 10-31.pptx
BITM3730 10-31.pptxBITM3730 10-31.pptx
BITM3730 10-31.pptx
 
BITM3730 10-18.pptx
BITM3730 10-18.pptxBITM3730 10-18.pptx
BITM3730 10-18.pptx
 
XML and Localization
XML and LocalizationXML and Localization
XML and Localization
 
Intro xml
Intro xmlIntro xml
Intro xml
 

More from Kamal Acharya

Programming the basic computer
Programming the basic computerProgramming the basic computer
Programming the basic computerKamal Acharya
 
Introduction to Computer Security
Introduction to Computer SecurityIntroduction to Computer Security
Introduction to Computer SecurityKamal Acharya
 
Making decision and repeating in PHP
Making decision and repeating  in PHPMaking decision and repeating  in PHP
Making decision and repeating in PHPKamal Acharya
 
Working with arrays in php
Working with arrays in phpWorking with arrays in php
Working with arrays in phpKamal Acharya
 
Text and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHPText and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHPKamal Acharya
 
Capacity Planning of Data Warehousing
Capacity Planning of Data WarehousingCapacity Planning of Data Warehousing
Capacity Planning of Data WarehousingKamal Acharya
 
Information Privacy and Data Mining
Information Privacy and Data MiningInformation Privacy and Data Mining
Information Privacy and Data MiningKamal Acharya
 
Association Analysis in Data Mining
Association Analysis in Data MiningAssociation Analysis in Data Mining
Association Analysis in Data MiningKamal Acharya
 
Classification techniques in data mining
Classification techniques in data miningClassification techniques in data mining
Classification techniques in data miningKamal Acharya
 
Introduction to Data Mining and Data Warehousing
Introduction to Data Mining and Data WarehousingIntroduction to Data Mining and Data Warehousing
Introduction to Data Mining and Data WarehousingKamal Acharya
 

More from Kamal Acharya (20)

Programming the basic computer
Programming the basic computerProgramming the basic computer
Programming the basic computer
 
Computer Arithmetic
Computer ArithmeticComputer Arithmetic
Computer Arithmetic
 
Introduction to Computer Security
Introduction to Computer SecurityIntroduction to Computer Security
Introduction to Computer Security
 
Session and Cookies
Session and CookiesSession and Cookies
Session and Cookies
 
Functions in php
Functions in phpFunctions in php
Functions in php
 
Web forms in php
Web forms in phpWeb forms in php
Web forms in php
 
Making decision and repeating in PHP
Making decision and repeating  in PHPMaking decision and repeating  in PHP
Making decision and repeating in PHP
 
Working with arrays in php
Working with arrays in phpWorking with arrays in php
Working with arrays in php
 
Text and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHPText and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHP
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Capacity Planning of Data Warehousing
Capacity Planning of Data WarehousingCapacity Planning of Data Warehousing
Capacity Planning of Data Warehousing
 
Data Warehousing
Data WarehousingData Warehousing
Data Warehousing
 
Search Engines
Search EnginesSearch Engines
Search Engines
 
Web Mining
Web MiningWeb Mining
Web Mining
 
Information Privacy and Data Mining
Information Privacy and Data MiningInformation Privacy and Data Mining
Information Privacy and Data Mining
 
Cluster Analysis
Cluster AnalysisCluster Analysis
Cluster Analysis
 
Association Analysis in Data Mining
Association Analysis in Data MiningAssociation Analysis in Data Mining
Association Analysis in Data Mining
 
Classification techniques in data mining
Classification techniques in data miningClassification techniques in data mining
Classification techniques in data mining
 
Data Preprocessing
Data PreprocessingData Preprocessing
Data Preprocessing
 
Introduction to Data Mining and Data Warehousing
Introduction to Data Mining and Data WarehousingIntroduction to Data Mining and Data Warehousing
Introduction to Data Mining and Data Warehousing
 

Recently uploaded

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
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
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 

Recently uploaded (20)

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
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 🔝✔️✔️
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 

XML

  • 1. XML
  • 2. XML • Is the “eXtensible Markup Language” • Became a W3C Recommendation in 1998 • Tag-based syntax, very much like HTML • Is not a replacement for HTML • X means eXtensible - we can make your own tag • Revolutionizes software development • Enables application portability
  • 3. XML is not… • A replacement for HTML (but HTML can be generated from XML) • A presentation format (but XML can be converted into one) • A programming language (but it can be used with almost any language) • A network transfer protocol (but XML may be transferred over a network) • A database (but XML may be stored into a database)
  • 4. But then – what is it? XML is a meta markup language for text documents / textual data XML allows to define languages (”applications“) to represent text documents / textual data
  • 5. XML by Example <article> <author>Ram Bahadur</author> <title>The Web in 10 Years</title> </article> • Easy to understand for human users • Very expressive (semantics along with the data) • Well structured, easy to read and write from programs
  • 6. XML by Example <t108> <x87>Ram Bahadur</x87> <g10>The Web in 10 Years</g10> </t108> • Hard to understand for human users • Not expressive (no semantics along with the data) • Well structured, easy to read and write from programs … this is XML, too:
  • 7. XML by Example <data> ch37fhgks73j5mv9d63h5mgfkds8d984lgnsmcns983 </data> • Impossible to understand for human users • Not expressive (no semantics along with the data) • Unstructured, read and write only with special programs … and what about this XML document: The actual benefit of using XML highly depends on the design of the application.
  • 8. Possible Advantages of Using XML • Truly Portable Data • Easily readable by human users • Very flexible and customizable (no finite tag set) • Easy to use from programs (libs available) • Easy to convert into other representations (XML transformation languages) • Many additional standards and tools • Widely used and supported
  • 11. Application • Document Markup adds structural and semantic information to documents, e.g. – Sections, Subsections, Theorems, … – Cross References – Literature Citations
  • 12. XML Standards – an Overview • XML Core Working Group: – XML 1.0 (Feb 1998), 1.1 (candidate for recommendation) – XML Namespaces (Jan 1999) • XSLT Working Group: – XSL(eXtensible Stylesheet Language) Transformations 1.0 (Nov 1999), 2.0 planned – XPath 1.0 (Nov 1999), 2.0 planned • XML Linking Working Group: – XLink 1.0 (Jun 2001) – XPointer 1.0 (March 2003) • XQuery 1.0 (Nov 2002) • XMLSchema 1.0 (May 2001)
  • 14. A Simple XML Document <article> <author>Ram Bahadur</author> <title>The Web in Ten Years</title> <text> <abstract>In order to evolve...</abstract> <section number=“1” title=“Introduction”> The <index>Web</index> provides the universal... </section> </text> </article>
  • 15. A Simple XML Document <article> <author>Ram Bahadur</author> <title>The Web in Ten Years</title> <text> <abstract>In order to evolve...</abstract> <section number=“1” title=“Introduction”> The <index>Web</index> provides the universal... </section> </text> </article> Freely definable tags
  • 16. Element Content of the Element (Subelements and/or Text) A Simple XML Document<article> <author>Gerhard Weikum</author> <title>The Web in Ten Years</title> <text> <abstract>In order to evolve...</abstract> <section number=“1” title=“Introduction”> The <index>Web</index> provides the universal... </section> </text> </article> End Tag Start Tag
  • 17. A Simple XML Document<article> <author>Gerhard Weikum</author> <title>The Web in Ten Years</title> <text> <abstract>In order to evolve...</abstract> <section number=“1” title=“Introduction”> The <index>Web</index> provides the universal... </section> </text> </article> Attributes with name and value
  • 18. Elements in XML Documents • (Freely definable) tags: article, title, author – with start tag: <article> etc. – and end tag: </article> etc. • Elements: <article> ... </article> • Elements have a name (article) and a content (...) • Elements may be nested. • Elements may be empty: <this_is_empty/> • Element content is typically parsed character data (PCDATA), i.e., strings with special characters, and/or nested elements (mixed content if both). • Each XML document has exactly one root element and forms a tree.
  • 19. XML Documents as Ordered Trees article author title text sectionabstract The index Web provides … title=“…“ number=“1“ In order … Ram Bahadur The Web in 10 years
  • 20. Well-Formed XML Documents A well-formed document must adher to, among others, the following rules: • Every start tag has a matching end tag. • Elements may nest, but must not overlap. • There must be exactly one root element. • Attribute values must be quoted. • An element may not have two attributes with the same name. • Comments and processing instructions may not appear inside tags. • No unescaped < or & signs may occur inside character data.
  • 21. Well-Formed XML Documents A well-formed document must adher to, among others, the following rules: • Every start tag has a matching end tag. • Elements may nest, but must not overlap. • There must be exactly one root element. • Attribute values must be quoted. • An element may not have to attributes with the same name. • Comments and processing instructions may not appear inside tags. • No unescaped < or & signs may occur inside character data. Only well-formed documents can be processed by XML parsers.
  • 23.
  • 25.
  • 26.
  • 27. XSL • XML also has it's own styles language – XSL • XSL stands for Extensible Styles Language and is a very powerful language for applying styles to XML documents • XSL has two parts – a formatting language – a transformation language.
  • 28. • The formatting language allows to apply styles similar to CSS • Browser support for the XSL formatting language is limited • The transformation language is known as XSLT (XSL Transformations) • XSLT allows to transform XML document into another form • For example, we could use XSLT to dynamically output some (or all) of the contents of your XML file into an HTML document
  • 29. Namespace • XML allows to create our own element names, there's always the possibility of naming an element exactly the same as one in another XML document • This might be OK if we never use both documents together • But what if we need to combine the content of both documents • Would have a name conflict – Would have two different elements, with different purposes, both with the same name
  • 31.
  • 33. Namespace Syntax <bk:books xmlns:bk =“http://www.books.com/books_detail“> Unique URI to identify the namespace Signal that namespace definition happens Prefix as abbrevation of URI
  • 34. Local Namespace • We created a namespace to avoid a name conflict between the elements of two documents we wanted to combine • When we defined the namespace, we defined it against the root element • This meant that the namespace was to be used for the whole document, and we prefixed all child elements with the same namespace. • Can also define namespaces against a child node • This way, we could use multiple namespaces within the same document if required
  • 36. Multiple Namespaces • We could also have multiple namespaces within your XML document • For example, we could define one namespace against the root element, and another against a child element
  • 38. XML Default Namespace • We applied the prefix when we defined the namespace, and we applied a prefix to each element that referred to the namespace. • We can also use what is known as a default namespace within our XML documents • The only difference is, a default namespace is one where we don't apply a prefix
  • 40. XML Entities • We can use entities to represent: – Characters that would otherwise cause problems for the XML processor – Large blocks of data that need to be repeated throughout the document – Characters that you can't type on your keyboard (eg, ©)
  • 41. Problematic Characters • Some characters have a special meaning in XML. • For example: – the less than sign (<) marks the beginning of a tag – And, of course, the greater than sign (>) marks the end of the tag. • When the XML processor parses the document, it looks for these characters (and others) to determine how to interpret the document • This is fine, as long as your data doesn't contain any of these characters. – But what if it does?
  • 42. • Imagine you had the following text within an element: 10 < 5. • When the XML processor encounters the <, it will assume it's the start of an opening tag. – Problem is, it's not. • In order to include characters such as < and & etc, we need to use their entity reference instead of the character itself
  • 44. XML Creating Entities • Defining • Using
  • 46.
  • 47. CDATA • In XML, a CDATA section is used to escape a block of text that would otherwise be parsed as markup
  • 48. Why Are CDATA Sections Useful? • Occasionally data contains large blocks of text with lots of potentially problematic characters • For example, – Data could contain a programming script – Many progamming scripts contain characters such as less than/greater than signs, ampersands etc, which would cause problems for the XML processor.
  • 49. • CDATA allows to escape the whole block of text • This eliminates the need to go through the whole script, individually replacing all the potentially problematic characters • The XML processor knows to escape all data between the CDATA tags
  • 50. CDATA Syntax • Declare a CDATA section using – <![CDATA[ as the opening tag – ]]> as the closing tag