By Mohsen ashouri
Introduction Comparison between XML and HTML XML Syntax Challenges Summary
e X tensible M arkup L anguage 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
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
An XML element is made up of a start tag, an end tag, and data in between. Example: Majid Majidi Example of another element with the same value: Parviz Parastooi XML tags are case-sensitive: XML can abbreviate empty elements, for example: can be abbreviated to
An attribute is a name-value pair separated by an equal sign (=). Example: Isfahan Attributes are used to attach additional, secondary information to an element.
A basic XML document is an XML element that can, but might not, include nested XML elements. Example: Second Chance Matthew Dunn
Hull California 1995 Su Venezuela Hull Purdue BOOKS California Su titleauthor title author article book year 1995 ref loc=“library”
Authoring guidelines: › All elements must have an end tag. › Elements must be properly nested, e.g. not book and title › All attribute values must be enclosed in quotation marks. › Each document must have a unique first element, the root node.
Comments can be put anywhere in an XML document Comments are not elements and do not have an end tag The blanks after 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 :
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]>
Consider an XML document: Ali 42 ……… ………. db Person 42 age name Person … ali
DTD for it might be: <!DOCTYPE db [ ]>
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: ›
Example: › › This declaration mandates that we would allow our element to contain one or one or one or one › If element were empty, or if it contained more than one of these the parser would raise an error.
Occurrence Indicator: IndicatorOccurrence (no indicator)RequiredOne and only one ?OptionalNone or one *Optional, repeatable None, one, or more +Required, repeatable One or more
Learn XML – Persian L anguage Security