 eXtensible Markup Language, is a  specification for creating custom  markup languages W3C Recommendation Primary purpo...
 Every XML-document is text-based => sharing data between different  computers! => sharing data in Internet! => platfo...
   Problems with Binary format    › Platform depence    › Firewalls    › Hard to debug    › Inspecting the file can be ha...
   XML is meta language, which you can use    to create your own markup languages.   There are several XML Markup Langua...
<?xml version="1.0"?><!DOCTYPE html   PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-...
<?xml version="1.0"?><!DOCTYPE svg   PUBLIC "-//W3C//DTD SVG 1.1//EN"   "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"...
<?xml version="1.0"?><!DOCTYPE math:math PUBLIC "-//OpenOffice.org//DTD Modified W3C MathML    1.01//EN" "math.dtd"><math:...
<?xml version="1.0"?><rss version="2.0"><channel> <title>W3Schools Home Page</title> <link>http://www.w3schools.com</link>...
 XML Spy EditiX Microsoft XML Notepad Visual XML XML Viewer Xeena XML Styler, Morphon, XML Writer…
Rules that Apply to EveryXML-Document
   There are two levels of correctness of an    XML document:    1. Well-formed. A well-formed document       conforms to...
<?xml version="1.0" encoding="utf-8" standalone="yes"?><presentation>  <slide number="1">    <name>Introduction to XML</na...
   XML-declaration is optional in XML 1.0,    mandatory in 1.1.    › Recommendation: use it.   Version: 1.0 or 1.1   En...
<?xml version="1.0" encoding="utf-8" standalone="no"?><presentation>  <slide>    <name>Introduction to XML</name>    <cont...
   Element consists of start tag, optional content    and an end tag:    › <name>Introduction to XML</name>   Start tag ...
 Only one root - element Every element contains starting tag and an ending  tag Content is optional: Empty element   › ...
 XML   elements can have attributes  in the start tag. Attributes must be quoted:  › <person sex="female">  › <person se...
 Names can contain letters, numbers,  and other characters Names must not start with a number or  punctuation character...
 XML document is well-formed if it follows  the syntax rules. XML document must be well-formed!    › its not an xml-docu...
<?xml version="1.0"?><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>  <title>Minimal XHTML 1.0 ...
<?xml version="1.0"?><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>  <title>Minimal XHTML 1.0 ...
Defining the Structure for XMLdocuments
   XML document is valid if    › 1) It is well formed AND    › 2) It follows some semantic rules   XML document is usual...
 Because of HTML heritage, browsers try  to understand invalid XHTML-pages This is not the case in other XML-  languages...
 XML has strict rules for WF and Valid If application tries to manipulate xml-  document it does not have to try to  und...
   For More Like Our Pages:   https://www.facebook.com/allgtubooks   https://www.facebook.com/gtumaterials   https://w...
Introduction to xml
Upcoming SlideShare
Loading in …5
×

Introduction to xml

4,077 views

Published on

Introduction to XML PPT...
Uploaded By GTU Books & Materials...

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
4,077
On SlideShare
0
From Embeds
0
Number of Embeds
15
Actions
Shares
0
Downloads
229
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Introduction to xml

  1. 1.  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.
  2. 2.  Every XML-document is text-based => sharing data between different computers! => sharing data in Internet! => platform independence!
  3. 3.  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?
  4. 4.  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
  5. 5. <?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>
  6. 6. <?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>
  7. 7. <?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>
  8. 8. <?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>
  9. 9.  XML Spy EditiX Microsoft XML Notepad Visual XML XML Viewer Xeena XML Styler, Morphon, XML Writer…
  10. 10. Rules that Apply to EveryXML-Document
  11. 11.  There are two levels of correctness of an XML document: 1. Well-formed. A well-formed document conforms to all of XMLs syntax rules. 2. Valid. A valid document additionally conforms to some semantic rules. Lets first look at the XMLs syntax rules (1).
  12. 12. <?xml version="1.0" encoding="utf-8" standalone="yes"?><presentation> <slide number="1"> <name>Introduction to XML</name> <contents>XML is ...</contents> </slide></presentation>
  13. 13.  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"
  14. 14. <?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>
  15. 15.  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">
  16. 16.  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 
  17. 17.  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">
  18. 18.  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
  19. 19.  XML document is well-formed if it follows the syntax rules. XML document must be well-formed! › its not an xml-document, if it does not follow the rules..
  20. 20. <?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>
  21. 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> <jorma>This is a minimal <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a> document.</jorma> </body></html>
  22. 22. Defining the Structure for XMLdocuments
  23. 23.  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
  24. 24.  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.
  25. 25.  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 isnt display error
  26. 26.  For More Like Our Pages: https://www.facebook.com/allgtubooks https://www.facebook.com/gtumaterials https://www.facebook.com/GTU.Projects.Jobs

×