SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Xml
XmlXml
Xml
 
Css selectors
Css selectorsCss selectors
Css selectors
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
javascript objects
javascript objectsjavascript objects
javascript objects
 
Html tables, forms and audio video
Html tables, forms and audio videoHtml tables, forms and audio video
Html tables, forms and audio video
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
Eye catching HTML BASICS tips: Learn easily
Eye catching HTML BASICS tips: Learn easilyEye catching HTML BASICS tips: Learn easily
Eye catching HTML BASICS tips: Learn easily
 
CSS
CSSCSS
CSS
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
 
XML DTD and Schema
XML DTD and SchemaXML DTD and Schema
XML DTD and Schema
 
Xml schema
Xml schemaXml schema
Xml schema
 
DTD
DTDDTD
DTD
 
1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
Javascript 101
Javascript 101Javascript 101
Javascript 101
 
Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
 
Xml presentation
Xml presentationXml presentation
Xml presentation
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScript
 
Jsp ppt
Jsp pptJsp ppt
Jsp ppt
 
Xhtml
XhtmlXhtml
Xhtml
 

Ähnlich wie 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)
 

Kürzlich hochgeladen

Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 

Kürzlich hochgeladen (20)

YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 

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