by mohsen ashouri. introduction comparison between xml and html xml syntax challenges summary
TRANSCRIPT
![Page 1: By Mohsen ashouri. Introduction Comparison between XML and HTML XML Syntax Challenges Summary](https://reader038.vdocuments.us/reader038/viewer/2022102909/56649ec05503460f94bcb5c0/html5/thumbnails/1.jpg)
ByMohsen ashouri
![Page 2: By Mohsen ashouri. Introduction Comparison between XML and HTML XML Syntax Challenges Summary](https://reader038.vdocuments.us/reader038/viewer/2022102909/56649ec05503460f94bcb5c0/html5/thumbnails/2.jpg)
Introduction Comparison between XML and HTML XML Syntax Challenges Summary
![Page 3: By Mohsen ashouri. Introduction Comparison between XML and HTML XML Syntax Challenges Summary](https://reader038.vdocuments.us/reader038/viewer/2022102909/56649ec05503460f94bcb5c0/html5/thumbnails/3.jpg)
eXtensible Markup Language Based on Standard Generalized Markup
Language (SGML) Version 1.0 introduced by World Wide
Web Consortium (W3C) in 1998 Bridge for data exchange on
the Web
![Page 4: By Mohsen ashouri. Introduction Comparison between XML and HTML XML Syntax Challenges Summary](https://reader038.vdocuments.us/reader038/viewer/2022102909/56649ec05503460f94bcb5c0/html5/thumbnails/4.jpg)
Extensible set of tags
Content orientated errors are not
allowed Allows multiple
output forms
Fixed set of tags Presentation
oriented Ignore many HTML
errors Single presentation
XML HTML
![Page 5: By Mohsen ashouri. Introduction Comparison between XML and HTML XML Syntax Challenges Summary](https://reader038.vdocuments.us/reader038/viewer/2022102909/56649ec05503460f94bcb5c0/html5/thumbnails/5.jpg)
An XML element is made up of a start tag, an end tag, and data in between.
Example: <director> Majid Majidi </director> Example of another element with the same value: <actor> Parviz Parastooi</actor> XML tags are case-sensitive: <CITY> <City> <city> XML can abbreviate empty elements, for example: <Book> </Book> can be abbreviated to <Book/>
![Page 6: By Mohsen ashouri. Introduction Comparison between XML and HTML XML Syntax Challenges Summary](https://reader038.vdocuments.us/reader038/viewer/2022102909/56649ec05503460f94bcb5c0/html5/thumbnails/6.jpg)
An attribute is a name-value pair separated by an equal sign (=).
Example: <City City_IP=“94608”> Isfahan
</City> Attributes are used to attach additional,
secondary information to an element.
![Page 7: By Mohsen ashouri. Introduction Comparison between XML and HTML XML Syntax Challenges Summary](https://reader038.vdocuments.us/reader038/viewer/2022102909/56649ec05503460f94bcb5c0/html5/thumbnails/7.jpg)
A basic XML document is an XML element that can, but might not, include nested XML elements.
Example: <books> <book isbn=“123”> <title> Second Chance </title> <author> Matthew Dunn
</author> </book> </books>
![Page 8: By Mohsen ashouri. Introduction Comparison between XML and HTML XML Syntax Challenges Summary](https://reader038.vdocuments.us/reader038/viewer/2022102909/56649ec05503460f94bcb5c0/html5/thumbnails/8.jpg)
<BOOKS><book id=“123”
loc=“library”> <author>Hull</author> <title>California</title> <year> 1995 </year></book><article id=“555”
ref=“123”> <author>Su</author> <title>
Venezuela</title></article></BOOKS> Hull Purdue
BOOKS
123 555
California
Su
titleauthor
title
author
articlebook
year
1995
ref
loc=“library”
![Page 9: By Mohsen ashouri. Introduction Comparison between XML and HTML XML Syntax Challenges Summary](https://reader038.vdocuments.us/reader038/viewer/2022102909/56649ec05503460f94bcb5c0/html5/thumbnails/9.jpg)
Authoring guidelines:› All elements must have an end tag.
› Elements must be properly nested, e.g. not
<book><title>book and title</book></title>
› All attribute values must be enclosed in quotation marks.
› Each document must have a unique first element, the root node.
![Page 10: By Mohsen ashouri. Introduction Comparison between XML and HTML XML Syntax Challenges Summary](https://reader038.vdocuments.us/reader038/viewer/2022102909/56649ec05503460f94bcb5c0/html5/thumbnails/10.jpg)
Comments can be put anywhere in an XML document
Comments are not elements and do not have an end tag
The blanks after <!-- and before --> are optional The closing bracket must be --> Comments are not displayed by browsers, but can
be seen by anyone who looks at the source code Example : <!-- This is a comment in both HTML and XML
-->
![Page 11: By Mohsen ashouri. Introduction Comparison between XML and HTML XML Syntax Challenges Summary](https://reader038.vdocuments.us/reader038/viewer/2022102909/56649ec05503460f94bcb5c0/html5/thumbnails/11.jpg)
An XML document may have an optional DTD.
DTD serves as grammar for the underlying XML document, and it is part of XML language.
DTDs are somewhat unsatisfactory, but no consensus exists so far beyond the basic DTDs.
DTD has the form: <!DOCTYPE root [markupdeclaration]>
![Page 12: By Mohsen ashouri. Introduction Comparison between XML and HTML XML Syntax Challenges Summary](https://reader038.vdocuments.us/reader038/viewer/2022102909/56649ec05503460f94bcb5c0/html5/thumbnails/12.jpg)
Consider an XML document:
<db> <person> <name>Ali</name> <age>42</age> <email>[email protected]
</email> </person> <person>………</person> ………. </db>
db
Person
42
age
name email
Person
Person
…
ali
![Page 13: By Mohsen ashouri. Introduction Comparison between XML and HTML XML Syntax Challenges Summary](https://reader038.vdocuments.us/reader038/viewer/2022102909/56649ec05503460f94bcb5c0/html5/thumbnails/13.jpg)
DTD for it might be: <!DOCTYPE db [ <!ELEMENT db (person*)> <!ELEMENT person (name, age,
email)> <!ELEMENT name (#PCDATA)> <!ELEMENT age (#PCDATA)> <!ELEMENT email (#PCDATA)> ]>
![Page 14: By Mohsen ashouri. Introduction Comparison between XML and HTML XML Syntax Challenges Summary](https://reader038.vdocuments.us/reader038/viewer/2022102909/56649ec05503460f94bcb5c0/html5/thumbnails/14.jpg)
If the elements within your document must appear in a distinct order, you should define your content model using a sequence.
To achieve this, simply list the element names separated by commas.
Example:› <!ELEMENT name (first, middle,
last)>
![Page 15: By Mohsen ashouri. Introduction Comparison between XML and HTML XML Syntax Challenges Summary](https://reader038.vdocuments.us/reader038/viewer/2022102909/56649ec05503460f94bcb5c0/html5/thumbnails/15.jpg)
Example:› <!ELEMENT item (CD| cassette| record|MP3)>
› This declaration mandates that we would allow our <item> element to contain one <cd> or one <cassette> or one <record> or one <MP3>
› If <item> element were empty, or if it contained more than one of these the parser would raise an error.
![Page 16: By Mohsen ashouri. Introduction Comparison between XML and HTML XML Syntax Challenges Summary](https://reader038.vdocuments.us/reader038/viewer/2022102909/56649ec05503460f94bcb5c0/html5/thumbnails/16.jpg)
Occurrence Indicator:
Indicator Occurrence
(no indicator) Required One and only one
? Optional None or one
* Optional, repeatable
None, one, or more
+ Required, repeatable
One or more
![Page 17: By Mohsen ashouri. Introduction Comparison between XML and HTML XML Syntax Challenges Summary](https://reader038.vdocuments.us/reader038/viewer/2022102909/56649ec05503460f94bcb5c0/html5/thumbnails/17.jpg)
Learn XML – Persian Language
Security