SlideShare a Scribd company logo
1 of 27
 eXtensible Markup Language, is a
  specification for creating custom
  markup languages
 W3C Recommendation
 Primary purpose is to help computers to
  share data
 XML is meta-language. This means that
  you use it for creating languages.
 XML is an extensive concept.
 Every XML-document is text-based
 => sharing data between different
  computers!
 => sharing data in Internet!
 => platform independence!
   Problems with Binary format
    › Platform depence
    › Firewalls
    › Hard to debug
    › Inspecting the file can be hard
 Since XML is text-based, it does not have
  the problems mentioned above.
 What are the disadvantages in text
  format?
   XML is meta language, which you can use
    to create your own markup languages.
   There are several XML Markup Languages
    made for different purposes
   All the languages have common xml-rules
   Languages: XHTML, OOXML, Open
    Document, RSS, SVG, SOAP, SMIL, MathML...
   List:
    › http://en.wikipedia.org/wiki/List_of_XML_markup_languag
      es
<?xml version="1.0"?>
<!DOCTYPE html
   PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>Minimal XHTML 1.0 Document</title>
 </head>
 <body>
  <p>This is a minimal <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a>
  document.</p>
 </body>
</html>
<?xml version="1.0"?>
<!DOCTYPE svg
   PUBLIC "-//W3C//DTD SVG 1.1//EN"
   "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" version="1.1"
xmlns="http://www.w3.org/2000/svg">

<circle cx="100" cy="50" r="40" stroke="black"
stroke-width="2" fill="red"/>

</svg>
<?xml version="1.0"?>
<!DOCTYPE math:math PUBLIC "-//OpenOffice.org//DTD Modified W3C MathML
    1.01//EN" "math.dtd">
<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
<math:semantics>
 <math:mrow>
  <math:mi>x</math:mi>
  <math:mo math:stretchy="false">=</math:mo>
  <math:mfrac>
  <math:mrow>
     ...
  </math:mrow>
 <math:annotation math:encoding="StarMath 5.0">x = {-b +-sqrt{b^{2}-4{ac}} } over {2
    {a}} </math:annotation>
</math:semantics>
</math:math>
<?xml version="1.0"?>
<rss version="2.0">
<channel>
 <title>W3Schools Home Page</title>
 <link>http://www.w3schools.com</link>
 <description>Free web building tutorials</description>
 <item>
   <title>RSS Tutorial</title>
   <link>http://www.w3schools.com/rss</link>
   <description>New RSS tutorial on W3Schools</description>
 </item>
 <item>
   <title>XML Tutorial</title>
   <link>http://www.w3schools.com/xml</link>
   <description>New XML tutorial on W3Schools</description>
 </item>
</channel>
</rss>
 XML Spy
 EditiX
 Microsoft XML Notepad
 Visual XML
 XML Viewer
 Xeena
 XML Styler, Morphon, XML Writer…
Rules that Apply to Every
XML-Document
   There are two levels of correctness of an
    XML document:
    1. Well-formed. A well-formed document
       conforms to all of XML's syntax rules.
    2. Valid. A valid document additionally
       conforms to some semantic rules.
   Let's first look at the XML's syntax rules (1).
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<presentation>
  <slide number="1">
    <name>Introduction to XML</name>
    <contents>XML is ...</contents>
  </slide>
</presentation>
   XML-declaration is optional in XML 1.0,
    mandatory in 1.1.
    › Recommendation: use it.
   Version: 1.0 or 1.1
   Encoding: character encoding, default utf-8
   Standalone:
    › is the xml-document linked to external markup
      declaration
    › yes: no external markup declarations
    › no: can have external markup declaration (open
      issue..)
    › default: "no"
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<presentation>
  <slide>
    <name>Introduction to XML</name>
    <contents>XML is ...</contents>
  </slide>
</presentation>
                                       Same Declaration
<?xml version="1.0"?>
<presentation>
  <slide>
    <name>Introduction to XML</name>
    <contents>XML is ...</contents>
  </slide>
</presentation>
   Element consists of start tag, optional content
    and an end tag:
    › <name>Introduction to XML</name>
   Start tag
    › <name>
   Content
    › Introduction to XML
   End tag
    › </name>
   Start tag may have attribute
    › <slide number="1">
 Only one root - element
 Every element contains starting tag and an ending
  tag
 Content is optional: Empty element
   › <x></x> <!-- same as -->
   › <x/>
 Tag – names are case-sensitive:
   › <X></x> <!-- Error -->
 Elements must be ended with the end tag in
  correct order:
   › <p><i>problem here</p></i> <!– Error 
 XML   elements can have attributes
  in the start tag.
 Attributes must be quoted:
  › <person sex="female">
  › <person sex='female'>
  › <gangster name='George "Shotgun" Ziegler'>
  › <gangster name="George
   &quot;Shotgun&quot; Ziegler">
 Names can contain letters, numbers,
  and other characters
 Names must not start with a number or
  punctuation character
 Names must not start with the letters xml
  (or XML, or Xml, etc)
 Names cannot contain spaces
 XML document is well-formed if it follows
  the syntax rules.
 XML document must be well-formed!
    › it's not an xml-document, if it does not follow
     the rules..
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>Minimal XHTML 1.0 Document</title>
 </head>
 <body>
  <p>This is a minimal <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a>
  document.</p>
 </body>
</html>
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>Minimal XHTML 1.0 Document</title>
 </head>
 <body>
  <jorma>This is a minimal <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a>
  document.</jorma>
 </body>
</html>
Defining the Structure for XML
documents
   XML document is valid if
    › 1) It is well formed AND
    › 2) It follows some semantic rules
   XML document is usually linked to an
    external file, that has semantic rules for the
    document.
    › The file can be dtd (.dtd) or schema (.xsd)
   Semantic rules?
    › Name of tags, order of elements
 Because of HTML heritage, browsers try
  to understand invalid XHTML-pages
 This is not the case in other XML-
  languages.
 In general, if XML-document is
  invalid, the processing of the document
  is cancelled.
 XML has strict rules for WF and Valid
 If application tries to manipulate xml-
  document it does not have to try to
  understand the possible errors in the
  document
 This means that handling xml-files via
  programming language is much easier
    › If the document is correctly formed,
      manipulate it
    › If it isn't display error
   For More Like Our Pages:
   https://www.facebook.com/allgtubooks
   https://www.facebook.com/gtumaterials
   https://www.facebook.com/GTU.Projects.Jobs

More Related Content

What's hot (20)

Xml
XmlXml
Xml
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
 
Xml
XmlXml
Xml
 
1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
 
Xml Presentation-3
Xml Presentation-3Xml Presentation-3
Xml Presentation-3
 
CSS
CSSCSS
CSS
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Html 5 tutorial - By Bally Chohan
Html 5 tutorial - By Bally ChohanHtml 5 tutorial - By Bally Chohan
Html 5 tutorial - By Bally Chohan
 
Cascading style sheets (CSS-Web Technology)
Cascading style sheets (CSS-Web Technology)Cascading style sheets (CSS-Web Technology)
Cascading style sheets (CSS-Web Technology)
 
HTML
HTMLHTML
HTML
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
 
Php Presentation
Php PresentationPhp Presentation
Php Presentation
 
PHP
PHPPHP
PHP
 
Css Ppt
Css PptCss Ppt
Css Ppt
 
Dom(document object model)
Dom(document object model)Dom(document object model)
Dom(document object model)
 
Dhtml ppt (2)
Dhtml ppt (2)Dhtml ppt (2)
Dhtml ppt (2)
 
php
phpphp
php
 

Similar to Introduction to xml (20)

Unit3wt
Unit3wtUnit3wt
Unit3wt
 
Unit3wt
Unit3wtUnit3wt
Unit3wt
 
Xml intro1
Xml intro1Xml intro1
Xml intro1
 
Processing XML
Processing XMLProcessing XML
Processing XML
 
Xml
XmlXml
Xml
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
 
eXtensible Markup Language (By Dr.Hatem Mohamed)
eXtensible Markup Language (By Dr.Hatem Mohamed)eXtensible Markup Language (By Dr.Hatem Mohamed)
eXtensible Markup Language (By Dr.Hatem Mohamed)
 
Xml andweb services
Xml andweb services Xml andweb services
Xml andweb services
 
WEB PROGRAMMING
WEB PROGRAMMINGWEB PROGRAMMING
WEB PROGRAMMING
 
1 xml fundamentals
1 xml fundamentals1 xml fundamentals
1 xml fundamentals
 
XML Presentation-2
XML Presentation-2XML Presentation-2
XML Presentation-2
 
XML notes.pptx
XML notes.pptxXML notes.pptx
XML notes.pptx
 
Xml
XmlXml
Xml
 
CTDA Workshop on XML and MODS
CTDA Workshop on XML and MODSCTDA Workshop on XML and MODS
CTDA Workshop on XML and MODS
 
23xml
23xml23xml
23xml
 
XHTML
XHTMLXHTML
XHTML
 
CrashCourse: XML technologies
CrashCourse: XML technologiesCrashCourse: XML technologies
CrashCourse: XML technologies
 
Dos and donts
Dos and dontsDos and donts
Dos and donts
 
paper about xml
paper about xmlpaper about xml
paper about xml
 
Unit 5 xml (1)
Unit 5   xml (1)Unit 5   xml (1)
Unit 5 xml (1)
 

Recently uploaded

HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 

Recently uploaded (20)

HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 

Introduction to xml

  • 1.
  • 2.  eXtensible Markup Language, is a specification for creating custom markup languages  W3C Recommendation  Primary purpose is to help computers to share data  XML is meta-language. This means that you use it for creating languages.  XML is an extensive concept.
  • 3.  Every XML-document is text-based  => sharing data between different computers!  => sharing data in Internet!  => platform independence!
  • 4. Problems with Binary format › Platform depence › Firewalls › Hard to debug › Inspecting the file can be hard  Since XML is text-based, it does not have the problems mentioned above.  What are the disadvantages in text format?
  • 5. XML is meta language, which you can use to create your own markup languages.  There are several XML Markup Languages made for different purposes  All the languages have common xml-rules  Languages: XHTML, OOXML, Open Document, RSS, SVG, SOAP, SMIL, MathML...  List: › http://en.wikipedia.org/wiki/List_of_XML_markup_languag es
  • 6. <?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Minimal XHTML 1.0 Document</title> </head> <body> <p>This is a minimal <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a> document.</p> </body> </html>
  • 7. <?xml version="1.0"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red"/> </svg>
  • 8. <?xml version="1.0"?> <!DOCTYPE math:math PUBLIC "-//OpenOffice.org//DTD Modified W3C MathML 1.01//EN" "math.dtd"> <math:math xmlns:math="http://www.w3.org/1998/Math/MathML"> <math:semantics> <math:mrow> <math:mi>x</math:mi> <math:mo math:stretchy="false">=</math:mo> <math:mfrac> <math:mrow> ... </math:mrow> <math:annotation math:encoding="StarMath 5.0">x = {-b +-sqrt{b^{2}-4{ac}} } over {2 {a}} </math:annotation> </math:semantics> </math:math>
  • 9. <?xml version="1.0"?> <rss version="2.0"> <channel> <title>W3Schools Home Page</title> <link>http://www.w3schools.com</link> <description>Free web building tutorials</description> <item> <title>RSS Tutorial</title> <link>http://www.w3schools.com/rss</link> <description>New RSS tutorial on W3Schools</description> </item> <item> <title>XML Tutorial</title> <link>http://www.w3schools.com/xml</link> <description>New XML tutorial on W3Schools</description> </item> </channel> </rss>
  • 10.  XML Spy  EditiX  Microsoft XML Notepad  Visual XML  XML Viewer  Xeena  XML Styler, Morphon, XML Writer…
  • 11. Rules that Apply to Every XML-Document
  • 12. There are two levels of correctness of an XML document: 1. Well-formed. A well-formed document conforms to all of XML's syntax rules. 2. Valid. A valid document additionally conforms to some semantic rules.  Let's first look at the XML's syntax rules (1).
  • 13. <?xml version="1.0" encoding="utf-8" standalone="yes"?> <presentation> <slide number="1"> <name>Introduction to XML</name> <contents>XML is ...</contents> </slide> </presentation>
  • 14. XML-declaration is optional in XML 1.0, mandatory in 1.1. › Recommendation: use it.  Version: 1.0 or 1.1  Encoding: character encoding, default utf-8  Standalone: › is the xml-document linked to external markup declaration › yes: no external markup declarations › no: can have external markup declaration (open issue..) › default: "no"
  • 15. <?xml version="1.0" encoding="utf-8" standalone="no"?> <presentation> <slide> <name>Introduction to XML</name> <contents>XML is ...</contents> </slide> </presentation> Same Declaration <?xml version="1.0"?> <presentation> <slide> <name>Introduction to XML</name> <contents>XML is ...</contents> </slide> </presentation>
  • 16. Element consists of start tag, optional content and an end tag: › <name>Introduction to XML</name>  Start tag › <name>  Content › Introduction to XML  End tag › </name>  Start tag may have attribute › <slide number="1">
  • 17.  Only one root - element  Every element contains starting tag and an ending tag  Content is optional: Empty element › <x></x> <!-- same as --> › <x/>  Tag – names are case-sensitive: › <X></x> <!-- Error -->  Elements must be ended with the end tag in correct order: › <p><i>problem here</p></i> <!– Error 
  • 18.  XML elements can have attributes in the start tag.  Attributes must be quoted: › <person sex="female"> › <person sex='female'> › <gangster name='George "Shotgun" Ziegler'> › <gangster name="George &quot;Shotgun&quot; Ziegler">
  • 19.  Names can contain letters, numbers, and other characters  Names must not start with a number or punctuation character  Names must not start with the letters xml (or XML, or Xml, etc)  Names cannot contain spaces
  • 20.  XML document is well-formed if it follows the syntax rules.  XML document must be well-formed! › it's not an xml-document, if it does not follow the rules..
  • 21. <?xml version="1.0"?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Minimal XHTML 1.0 Document</title> </head> <body> <p>This is a minimal <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a> document.</p> </body> </html>
  • 22. <?xml version="1.0"?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Minimal XHTML 1.0 Document</title> </head> <body> <jorma>This is a minimal <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a> document.</jorma> </body> </html>
  • 23. Defining the Structure for XML documents
  • 24. XML document is valid if › 1) It is well formed AND › 2) It follows some semantic rules  XML document is usually linked to an external file, that has semantic rules for the document. › The file can be dtd (.dtd) or schema (.xsd)  Semantic rules? › Name of tags, order of elements
  • 25.  Because of HTML heritage, browsers try to understand invalid XHTML-pages  This is not the case in other XML- languages.  In general, if XML-document is invalid, the processing of the document is cancelled.
  • 26.  XML has strict rules for WF and Valid  If application tries to manipulate xml- document it does not have to try to understand the possible errors in the document  This means that handling xml-files via programming language is much easier › If the document is correctly formed, manipulate it › If it isn't display error
  • 27. For More Like Our Pages:  https://www.facebook.com/allgtubooks  https://www.facebook.com/gtumaterials  https://www.facebook.com/GTU.Projects.Jobs