SlideShare a Scribd company logo
XML:
EXTENS I BLE M ARKUP L ANGUAGE
Abdul Jalil Tamjid
Wasif Bin Zahir
Robin Islam
2
TOPI CS W I LL BE COVERED
o What is XML?
o Why is XML important?
o What are the benefits of using XML?
o What are the applications of XML?
o What are the components of an XML file?
o What is an XML schema?
o What is an XML parser?
o How is XML different from HTML?
E X T E N S I B L E M A R K U P
L A N G UAG E
XML (Extensible Markup Language) is used to describe data. The XML standard is a
flexible way to create information formats and electronically share structured data via
the public internet, as well as via corporate networks.
XML is a markup language based on Standard Generalized Markup Language
(SGML) used for defining markup languages.
4
Extensible:
Meaning: "Extensible" in XML refers to the ability to define and use custom tags (elements) and attributes.
Markup:
Meaning: "Markup" in XML refers to the set of symbols or codes embedded in the text of a document to provide
structure and formatting information.
Language:
Meaning: In the context of XML, "language" refers to the set of rules and conventions that define how the XML
document is structured and how data is represented.
In summary, XML is extensible because it allows users to define their own markup, and markup refers to the tags and
structure used to represent data in a document. The term "language" in XML emphasizes the rules and conventions
governing the structure and representation of data in an XML document
E X A M P L E O F X M L
<?xml version="1.0" encoding="UTF-8"?>
<Drama>
<Title>Game of Thrones</Title>
<Author>George R. R. Martin</Author>
<PublishYear>2011</PublishYear>
<Actress>Emilia Clarke</Actress>
<IMBDRating>9.3</IMBDRating>
<Awards>
<Award>Primetime Emmy Award for Outstanding Drama Series</Award>
<Award>Hugo Award for Best Dramatic Presentation</Award>
</Awards>
<NumberOfEpisodes>73</NumberOfEpisodes>
</Drama>
6
A markup language is used to provide information about a document.
 Tags are added to the document to provide the extra information.
 HTML tags tell a browser how to display the document, while XML tags give a reader some
idea of what the data means.
For example, an XML document might be used to store data about a book, such as the title,
author, and publication date. The XML tags would identify each of these pieces of information.
7
8
9
10
11
A D VA N TA G E S O F U S I N G X M L
o XML is text (Unicode) based.
o It takes up less space.
o It can be transmitted efficiently.
o One XML document can be displayed differently in different media. You only have to change the
XML document in order to change all the rest.
o XML documents can be modularized. Parts can be reused.
o Easy to validate and parse
o Human-readable and understandable
o Platform-independent
12
XM L DOCUM ENTS
What is xml document?
o Element
o Attributes
o Plus some other details
A SI M P LE XM L DOCUM ENT
<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 platform for access to information... It has revolutionized
how we communicate, collaborate and learn.
<p>The ten year horizon is...</p>
</section>
</text>
</article>
14
15
16
17
A simple >common layer>for tree structures>
i n a character stream.
19
I M P O R TA N C E O F X M L
o Data transfer
o Files Config (App.config, Web.config)
o Schemas and Templates
o Devices
o External services
o Documentation
o File Format
20
PHYSICAL PARTS OF X M L DOCUMENTS
• XML Declaration
• Elements
• Attributes
• Document Type Declaration
• Entities
• Processing Instructions
• Comments
• Character Data Sections
• XML Namespaces
21 E L E M E N T S I N X M L D O C U M E N T S
o (Freely definable) tags: article, title, author
o with start tag: <article> etc.
o and end tag: </article> etc.
o Elements: <article> ... </article>
o Elements have a name (article) and a content (...)
o Elements may be nested.
o Elements may be empty: <this_is_empty/>
o Element content is typically parsed character data (PCDATA), i.e., strings with special characters, and/or
nested elements (mixed content if both).
o Each XML document has exactly one root element and forms a tree.
o Elements with a common parent are ordered.
22
23 ENTITY DECLARATION
• Internal entities
– Built-in
• External entities
– References to a file
(text, images etc.)
• Parameter entities
– Used inside DTDs
<!ENTITY author
"Norman Walsh, Sun Corp.">
<!ENTITY copyright
SYSTEM "copyright.xml">
<!ENTITY % part
"(title?, (paragraph |
section)*)">
24
W E L L - F O R M E D X M L D O C U M E N T S
A well-formed document must adher to, among others, the following
rules:
oEvery start tag has a matching end tag.
oElements may nest, but must not overlap.
oThere must be exactly one root element.
oAttribute values must be quoted.
oAn element may not have two attributes with the same name.
oComments and processing instructions may not appear inside tags.
oNo unescaped < or & signs may occur inside character data.
25 A N O T H E R W E L L - S T RU C T U R E D E X A M P L E
<novel>
<foreword>
<paragraph> This is the great American novel.
</paragraph>
</foreword>
<chapter number="1">
<paragraph>It was a dark and stormy night.
</paragraph>
<paragraph>Suddenly, a shot rang out!
</paragraph>
</chapter>
</novel>
26
XM L-REL ATED TECHNOLOGIES
o DTD (Document Type Definition) and XML Schemas are used to define
legal XML tags and their attributes for particular purposes
o CSS (Cascading Style Sheets) describe how to display HTML or XML in a
browser
o XSLT (eXtensible Stylesheet Language Transformations) and XPath are
used to translate from one form of XML to another
o DOM (Document Object Model), SAX (Simple API for XML, and JAXP
(Java API for XML Processing) are all APIs for XML parsing
D O C U M E N T T Y P E D E F I N AT I O N
• Defines structure/model of XML documents
– Elements and Cardinality
– Attributes
• Defines default ATTRIBUTE values
• Defines ENTITIES
• Stored in a plain text file and referenced by an XML document (external)
• Alternatively a DTD can be placed in the XML document itself (internal)
• Used to validate an XML document
• A DTD defines what tags are legal and where they can occur in the XML
• Documents are constructed and named in a conformant manner
– Ease constructing (provide structure)
– Ease parsing
28
VALID X M L
• Well-formed plus conforms to DTD
• All elements and attributes are declared within a DTD
(internal or external)
• Elements and attributes match the
declarations in the DTD
29 EXAMPLE X M L A N D RELATED D T D
<database>
<person age='34'>
<name>
<title> Mr </title>
<firstname> John </firstname>
<firstname> Paul </firstname>
<surname> Murphy </surname>
</name>
<hobby> Football </hobby>
<hobby> Racing </hobby>
</person>
<person >
<name>
<firstname> Mary </firstname>
<surname> Donnelly </surname>
</name>
</person>
</database>
<!DOCTYPE database [
<!ELEMENT database (person*)>
<!ELEMENT person (name,hobby*)>
<!ATTLIST person age CDATA
#IMPLIED>
<!ELEMENT name (title?, firstname
+, surname)>
<!ELEMENT hobby (#PCDATA)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT firstname (#PCDATA)>
<!ELEMENT surname (#PCDATA)>
]>
30 W h a t a r e X M L schemas?
An Extensible Markup Language (XML) schema is a document that describes some rules or limits on the
structure of an XML file. You can describe these constraints in several different ways, like these:
o Grammatical rules to determine the order of elements
o Yes or No conditions that the content must satisfy
o Data types for the content in XML files
o Constraints for data integrity
For example, an XML schema for bookstores might impose constraints like these:
o A book element will have the attributes title and author.
o The book element will be nested under a category element with an attribute name.
o The price of a book will be a separate element nested under book.
31 W HAT IS AN XM L PARS ER?
An Extensible Markup Language (XML) parser is software that can process or read XML documents to extract
the data within them. XML parsers also check the syntax or rules of the XML file and can validate it against a
particular XML schema. Because XML is a strict markup language, the parsers will not process the file if there
are any validation or syntax errors. For example, the XML parser will give errors if any of these conditions are
true:
o A closing tag or end tag is missing
o Attribute values don’t have quotation marks
o A schema condition has not been met
32
W H Y U S E X M L SCHEMAS?
o Uses an XML syntax
o Supports simple and complex data-types such as user-defined types
o An XML document and its contents can be validated against a Schema
o Can validate documents containing multiple namespaces
o Schemas are more powerful than DTDs and will eventually replace DTDs
33
NAMED TYPES – SIMPLE
<!ELEMENT firstname (#PCDATA)>
<xsd:element name="firstname" type="xsd:string"/>
<firstname>Michael</firstname>
DT
D
XML
Schema
XML
doc.
Instance
34 NAMED TYPES – COMPLEX
<!ELEMENT name (firstname, lastname)>
<xsd:complexType name="namePerson">
<xsd:sequence>
<xsd:element name="firstname" type="xsd:string"/>
<xsd:element name="lastname" type="xsd:string/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="name" type="namePerson"/>
<name>
<firstname>Michael</firstname>
<lastname>Porter</lastname>
</name>
DT
D
XML
Schema
XML
doc.
Instance
35
S U M M A R Y
• XML Vocabularies are defined using
– DTD
– XSD
• DTDs/XSDs used to validate XML documents
• XSD – more powerful than DTDs
– Supports simple and complex data-types such as user-
defined types
– Can validate documents containing multiple
namespaces
36 VO C A B U L A RY
o SGML: Standard Generalized Markup Language
o XML : Extensible Markup Language
o DTD: Document Type Definition
o element: a start and end tag, along with their contents
o attribute: a value given in the start tag of an element
o entity: a representation of a particular character or string
o namespace: a unique string that references a DTD
o well-formed XML: XML that follows the basic syntax rules
o valid XML: well-formed XML that conforms to a DTD
W H AT A R E T H E A P P L I C AT I O N S
O F X M L ?
Data transfer
• Website data to XML
format
• XML data to accounting
system data
• Accounting system data
back to XML format
• XML data back to
website data
Web applications
XML gives structure to the
data that you see on
webpages. Other website
technologies, like HTML,
work with XML to present
consistent and relevant data
to website visitors
Documentation
For example, there are
XML tags for a
paragraph, an item in a
numbered list, and a
heading. Using these
tags, other types of
software automatically
prepare the document
for uses such as
printing and webpage
publication.
Data type
Many programming
languages support XML
as a data type. With this
support, you can easily
write programs in other
languages that work
directly with XML files.
38
W E B S E RV I C E S D E S C R I P T I O N L A N G U AG E
WSDL is an XML format for
describing network services
as a set of endpoints
operating on messages
containing either
document-oriented or
procedure-oriented
information.
Thank you!
ce20044@mbstu.ac.bd
ce20022@mbstu.ac.bd
ce20050@mbstu.ac.bd

More Related Content

Similar to Extensible Markup Language(XML)_lecture.pptx (20)

PPT
DATA INTEGRATION (Gaining Access to Diverse Data).ppt
careerPointBasti
 
PPT
XML Presentation-2
Sudharsan S
 
PPT
Ch2 neworder
davidlahr32
 
PPT
Intro to xml
Tarun Jain
 
DOCX
Introduction to xml schema
Abhishek Kesharwani
 
PPTX
XML, DTD & XSD Overview
Pradeep Rapolu
 
PDF
CTDA Workshop on XML and MODS
University of Connecticut Libraries
 
PPT
web program-Extended MARKUP Language XML.ppt
mcjaya2024
 
PPT
unit_5_XML data integration database management
sathiyabcsbs
 
PDF
IT6801-Service Oriented Architecture- UNIT-I notes
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
PPTX
xml.pptx
TilakaRt
 
PPT
Xml by Luqman
Luqman Shareef
 
DOC
Xsd
xavier john
 
PPT
Xml and DTD's
Swati Parmar
 
PPT
Introduction to xml
Shivalik college of engineering
 
PPTX
Internet_Technology_UNIT V- Introduction to XML.pptx
shilpar780389
 
PPTX
programming with xml for graduate students
RameshPrasadBhatta2
 
PDF
WT UNIT-2 XML.pdf
Ranjeet Reddy
 
PPT
Displaying XML Documents Using CSS and XSL
Bình Trọng Án
 
DATA INTEGRATION (Gaining Access to Diverse Data).ppt
careerPointBasti
 
XML Presentation-2
Sudharsan S
 
Ch2 neworder
davidlahr32
 
Intro to xml
Tarun Jain
 
Introduction to xml schema
Abhishek Kesharwani
 
XML, DTD & XSD Overview
Pradeep Rapolu
 
CTDA Workshop on XML and MODS
University of Connecticut Libraries
 
web program-Extended MARKUP Language XML.ppt
mcjaya2024
 
unit_5_XML data integration database management
sathiyabcsbs
 
IT6801-Service Oriented Architecture- UNIT-I notes
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
xml.pptx
TilakaRt
 
Xml by Luqman
Luqman Shareef
 
Xml and DTD's
Swati Parmar
 
Introduction to xml
Shivalik college of engineering
 
Internet_Technology_UNIT V- Introduction to XML.pptx
shilpar780389
 
programming with xml for graduate students
RameshPrasadBhatta2
 
WT UNIT-2 XML.pdf
Ranjeet Reddy
 
Displaying XML Documents Using CSS and XSL
Bình Trọng Án
 

Recently uploaded (20)

PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PPTX
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PDF
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PDF
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
PDF
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PDF
The-Ever-Evolving-World-of-Science (1).pdf/7TH CLASS CURIOSITY /1ST CHAPTER/B...
Sandeep Swamy
 
PDF
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PPTX
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
community health nursing question paper 2.pdf
Prince kumar
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
The-Ever-Evolving-World-of-Science (1).pdf/7TH CLASS CURIOSITY /1ST CHAPTER/B...
Sandeep Swamy
 
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
Ad

Extensible Markup Language(XML)_lecture.pptx

  • 1. XML: EXTENS I BLE M ARKUP L ANGUAGE Abdul Jalil Tamjid Wasif Bin Zahir Robin Islam
  • 2. 2 TOPI CS W I LL BE COVERED o What is XML? o Why is XML important? o What are the benefits of using XML? o What are the applications of XML? o What are the components of an XML file? o What is an XML schema? o What is an XML parser? o How is XML different from HTML?
  • 3. E X T E N S I B L E M A R K U P L A N G UAG E XML (Extensible Markup Language) is used to describe data. The XML standard is a flexible way to create information formats and electronically share structured data via the public internet, as well as via corporate networks. XML is a markup language based on Standard Generalized Markup Language (SGML) used for defining markup languages.
  • 4. 4 Extensible: Meaning: "Extensible" in XML refers to the ability to define and use custom tags (elements) and attributes. Markup: Meaning: "Markup" in XML refers to the set of symbols or codes embedded in the text of a document to provide structure and formatting information. Language: Meaning: In the context of XML, "language" refers to the set of rules and conventions that define how the XML document is structured and how data is represented. In summary, XML is extensible because it allows users to define their own markup, and markup refers to the tags and structure used to represent data in a document. The term "language" in XML emphasizes the rules and conventions governing the structure and representation of data in an XML document
  • 5. E X A M P L E O F X M L <?xml version="1.0" encoding="UTF-8"?> <Drama> <Title>Game of Thrones</Title> <Author>George R. R. Martin</Author> <PublishYear>2011</PublishYear> <Actress>Emilia Clarke</Actress> <IMBDRating>9.3</IMBDRating> <Awards> <Award>Primetime Emmy Award for Outstanding Drama Series</Award> <Award>Hugo Award for Best Dramatic Presentation</Award> </Awards> <NumberOfEpisodes>73</NumberOfEpisodes> </Drama>
  • 6. 6 A markup language is used to provide information about a document.  Tags are added to the document to provide the extra information.  HTML tags tell a browser how to display the document, while XML tags give a reader some idea of what the data means. For example, an XML document might be used to store data about a book, such as the title, author, and publication date. The XML tags would identify each of these pieces of information.
  • 7. 7
  • 8. 8
  • 9. 9
  • 10. 10
  • 11. 11 A D VA N TA G E S O F U S I N G X M L o XML is text (Unicode) based. o It takes up less space. o It can be transmitted efficiently. o One XML document can be displayed differently in different media. You only have to change the XML document in order to change all the rest. o XML documents can be modularized. Parts can be reused. o Easy to validate and parse o Human-readable and understandable o Platform-independent
  • 12. 12 XM L DOCUM ENTS What is xml document? o Element o Attributes o Plus some other details
  • 13. A SI M P LE XM L DOCUM ENT <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 platform for access to information... It has revolutionized how we communicate, collaborate and learn. <p>The ten year horizon is...</p> </section> </text> </article>
  • 14. 14
  • 15. 15
  • 16. 16
  • 17. 17
  • 18. A simple >common layer>for tree structures> i n a character stream.
  • 19. 19 I M P O R TA N C E O F X M L o Data transfer o Files Config (App.config, Web.config) o Schemas and Templates o Devices o External services o Documentation o File Format
  • 20. 20 PHYSICAL PARTS OF X M L DOCUMENTS • XML Declaration • Elements • Attributes • Document Type Declaration • Entities • Processing Instructions • Comments • Character Data Sections • XML Namespaces
  • 21. 21 E L E M E N T S I N X M L D O C U M E N T S o (Freely definable) tags: article, title, author o with start tag: <article> etc. o and end tag: </article> etc. o Elements: <article> ... </article> o Elements have a name (article) and a content (...) o Elements may be nested. o Elements may be empty: <this_is_empty/> o Element content is typically parsed character data (PCDATA), i.e., strings with special characters, and/or nested elements (mixed content if both). o Each XML document has exactly one root element and forms a tree. o Elements with a common parent are ordered.
  • 22. 22
  • 23. 23 ENTITY DECLARATION • Internal entities – Built-in • External entities – References to a file (text, images etc.) • Parameter entities – Used inside DTDs <!ENTITY author "Norman Walsh, Sun Corp."> <!ENTITY copyright SYSTEM "copyright.xml"> <!ENTITY % part "(title?, (paragraph | section)*)">
  • 24. 24 W E L L - F O R M E D X M L D O C U M E N T S A well-formed document must adher to, among others, the following rules: oEvery start tag has a matching end tag. oElements may nest, but must not overlap. oThere must be exactly one root element. oAttribute values must be quoted. oAn element may not have two attributes with the same name. oComments and processing instructions may not appear inside tags. oNo unescaped < or & signs may occur inside character data.
  • 25. 25 A N O T H E R W E L L - S T RU C T U R E D E X A M P L E <novel> <foreword> <paragraph> This is the great American novel. </paragraph> </foreword> <chapter number="1"> <paragraph>It was a dark and stormy night. </paragraph> <paragraph>Suddenly, a shot rang out! </paragraph> </chapter> </novel>
  • 26. 26 XM L-REL ATED TECHNOLOGIES o DTD (Document Type Definition) and XML Schemas are used to define legal XML tags and their attributes for particular purposes o CSS (Cascading Style Sheets) describe how to display HTML or XML in a browser o XSLT (eXtensible Stylesheet Language Transformations) and XPath are used to translate from one form of XML to another o DOM (Document Object Model), SAX (Simple API for XML, and JAXP (Java API for XML Processing) are all APIs for XML parsing
  • 27. D O C U M E N T T Y P E D E F I N AT I O N • Defines structure/model of XML documents – Elements and Cardinality – Attributes • Defines default ATTRIBUTE values • Defines ENTITIES • Stored in a plain text file and referenced by an XML document (external) • Alternatively a DTD can be placed in the XML document itself (internal) • Used to validate an XML document • A DTD defines what tags are legal and where they can occur in the XML • Documents are constructed and named in a conformant manner – Ease constructing (provide structure) – Ease parsing
  • 28. 28 VALID X M L • Well-formed plus conforms to DTD • All elements and attributes are declared within a DTD (internal or external) • Elements and attributes match the declarations in the DTD
  • 29. 29 EXAMPLE X M L A N D RELATED D T D <database> <person age='34'> <name> <title> Mr </title> <firstname> John </firstname> <firstname> Paul </firstname> <surname> Murphy </surname> </name> <hobby> Football </hobby> <hobby> Racing </hobby> </person> <person > <name> <firstname> Mary </firstname> <surname> Donnelly </surname> </name> </person> </database> <!DOCTYPE database [ <!ELEMENT database (person*)> <!ELEMENT person (name,hobby*)> <!ATTLIST person age CDATA #IMPLIED> <!ELEMENT name (title?, firstname +, surname)> <!ELEMENT hobby (#PCDATA)> <!ELEMENT title (#PCDATA)> <!ELEMENT firstname (#PCDATA)> <!ELEMENT surname (#PCDATA)> ]>
  • 30. 30 W h a t a r e X M L schemas? An Extensible Markup Language (XML) schema is a document that describes some rules or limits on the structure of an XML file. You can describe these constraints in several different ways, like these: o Grammatical rules to determine the order of elements o Yes or No conditions that the content must satisfy o Data types for the content in XML files o Constraints for data integrity For example, an XML schema for bookstores might impose constraints like these: o A book element will have the attributes title and author. o The book element will be nested under a category element with an attribute name. o The price of a book will be a separate element nested under book.
  • 31. 31 W HAT IS AN XM L PARS ER? An Extensible Markup Language (XML) parser is software that can process or read XML documents to extract the data within them. XML parsers also check the syntax or rules of the XML file and can validate it against a particular XML schema. Because XML is a strict markup language, the parsers will not process the file if there are any validation or syntax errors. For example, the XML parser will give errors if any of these conditions are true: o A closing tag or end tag is missing o Attribute values don’t have quotation marks o A schema condition has not been met
  • 32. 32 W H Y U S E X M L SCHEMAS? o Uses an XML syntax o Supports simple and complex data-types such as user-defined types o An XML document and its contents can be validated against a Schema o Can validate documents containing multiple namespaces o Schemas are more powerful than DTDs and will eventually replace DTDs
  • 33. 33 NAMED TYPES – SIMPLE <!ELEMENT firstname (#PCDATA)> <xsd:element name="firstname" type="xsd:string"/> <firstname>Michael</firstname> DT D XML Schema XML doc. Instance
  • 34. 34 NAMED TYPES – COMPLEX <!ELEMENT name (firstname, lastname)> <xsd:complexType name="namePerson"> <xsd:sequence> <xsd:element name="firstname" type="xsd:string"/> <xsd:element name="lastname" type="xsd:string/> </xsd:sequence> </xsd:complexType> <xsd:element name="name" type="namePerson"/> <name> <firstname>Michael</firstname> <lastname>Porter</lastname> </name> DT D XML Schema XML doc. Instance
  • 35. 35 S U M M A R Y • XML Vocabularies are defined using – DTD – XSD • DTDs/XSDs used to validate XML documents • XSD – more powerful than DTDs – Supports simple and complex data-types such as user- defined types – Can validate documents containing multiple namespaces
  • 36. 36 VO C A B U L A RY o SGML: Standard Generalized Markup Language o XML : Extensible Markup Language o DTD: Document Type Definition o element: a start and end tag, along with their contents o attribute: a value given in the start tag of an element o entity: a representation of a particular character or string o namespace: a unique string that references a DTD o well-formed XML: XML that follows the basic syntax rules o valid XML: well-formed XML that conforms to a DTD
  • 37. W H AT A R E T H E A P P L I C AT I O N S O F X M L ? Data transfer • Website data to XML format • XML data to accounting system data • Accounting system data back to XML format • XML data back to website data Web applications XML gives structure to the data that you see on webpages. Other website technologies, like HTML, work with XML to present consistent and relevant data to website visitors Documentation For example, there are XML tags for a paragraph, an item in a numbered list, and a heading. Using these tags, other types of software automatically prepare the document for uses such as printing and webpage publication. Data type Many programming languages support XML as a data type. With this support, you can easily write programs in other languages that work directly with XML files.
  • 38. 38 W E B S E RV I C E S D E S C R I P T I O N L A N G U AG E WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information.