New Microsoft PowerPoint Presentation
New Microsoft PowerPoint Presentation
▪ Markup: XML is not itself a markup language: it's a set of rules for building
markup languages.
▪ Markup is information added to a document that enhances its meaning in certain
ways, in that it identifies the parts and how they relate to each other.
▪ For example, when you read a newspaper, you can tell articles apart by their
spacing and position on the page and the use of different fonts for titles and
headings. Markup works in a similar way, except that instead of space, it uses
symbols.
Markup language is a set of symbols that can be placed in the text of a
document to demarcate and label the parts of that document.
XML markup looks when embedded in a piece of text:
Cont..
This snippet includes the following markup symbols, or tags:
The tags <message> and </message> mark the start and end points
of the whole XML fragment.
The tags <exclamation> and </exclamation> surround the text Hello,
world!.
• The tags <paragraph> and </paragraph> surround a larger region of
text and tags.
• Some <emphasis> and </emphasis> tags label individual words.
• A <graphic fileref="smiley_face.pict"/> tag marks a place in the text
to insert a picture.
Cont…
▪ Boundaries
A piece of text starts in one place and ends in another.
The tags <message> and </message> define the start and end of a collection of text and
markup, which is labeled message.
▪ Roles
What is a region of text doing in the document?
Here, the tags <paragraph> and </paragraph> label some text as a paragraph, as opposed to a
list, title, or limerick.
▪ Positions
A piece of text comes before some things and after others.
The paragraph appears after the text tagged as <exclamation>, so it will probably be
printed that way.
Cont…
▪ Containment
The text fun is inside an <emphasis> element, which is inside a <paragraph>, which is
inside a <message>.
This "nesting" of elements is taken into account by XML processing software, which
may treat content differently depending on where it appears.
For example, a title might have a different font size depending on whether it's the
title of a newspaper or an article.
▪ Relationships
A piece of text can be linked to a resource somewhere else.
For instance, the tag <graphic fileref="smiley_face.pict"/> creates a relationship (link)
between the XML fragment and a file named smiley_face.pict.
The intent is to import the graphic data from the file and display it in this fragment.
XML Documents:
▪ A document is composed of pieces called elements.
▪ The elements nest inside each other like small boxes inside
larger boxes, shaping and labeling the content of the
document.
▪ At the top level, a single element called the document
element or root element contains other elements.
Example: The Mathematics Markup Language (MathML) encodes equations. A
well-known equation among physicists is Newton's Law of Gravitation: F = GMm / r2. And
the following document represents that equation.
Graphics In XML
The Scalable Vector Graphics (SVG) language is used to draw resizable line art. The
following document defines a picture with three shapes (a rectangle, a circle, and a
polygon):
Tree structure in XML
XML vs. HTML
Both are markup languages, but there are differences.
In HTML, both the tag set and tag semantics are predefined
and fixed.
XML specifies neither a tag set nor semantics
◦ It provides facility to define tags.
◦ Semantics defined by application that process the documents (or
by stylesheets).
◦ XML is thus a meta language for describing markup languages.
XML Development Goals
➢ It should be easy to use XML over the internet.
➢ Xml shall support a wide variety of applications.
➢ It shall be easy to write programs that process xml
documents.
➢ The number of optional features in xml is kept to a minimum
(zero, ideally)
➢ Design of xml shall be formal and concise
➢ Xml documents should be easy to create.
How is xml defined?
It is defined by the following specifications:
➢XML 1.0
◦ It defines the syntax of xml
➢Xml pointer language (xpointer) and xml linking language
(xlink)
defines a standard way to represent link between
resources.
➢Extensible style language (XSL)
defines the standard stylesheet language for xml.
Example:
<?xml version=“1.0”?>
<quotation>
<me> hello </me>
<you> Hii </you>
<other/>
</quotation>
Structure of XML Deocument
An XML document consist of :
• Prolog
• Elements
• Attributes
• Entity references
• Comments
XML: Prolog [beginning or starting of the document]
• The prolog is to be first structural element that is present
in the XML document.
• It usually divided into an XML declaration and an optional
DTD.
Example:
<? xml version=“1.0” encoding=“UTF-8”?>
<? Xml version = “1.0”?>
XML: Element
➢Element are most common form of markup.
➢Xml elements must needed a start and a matching end tag
prefixed by a slash.
<CSED> MCA </CSED>
❑Note: XML is case sensitive.
Naming convention:
•Can contain letters, digits, underscore, hyphen and periods.
•Must begin with letter or an underscore.
XML: Attributes
➢Attributes are attached to elements.
➢They are name value pairs that occurs inside start-tags after the element name.
➢Starts with a letter or underscore.
➢Must not contains any white spaces.
Example:
<student name=“ABC XYS”>
</student>
XML: Entity
They are used to reference data that is not directly in
the structure.
◦Built-in entity references are used to represent &, >, <, “
and ‘.
◦Example:
◦ME&YOU(“Working together X<Y”)
◦Written as:
◦ME&YOU("Working together X<Y")
XML: comments
Comments begin with <!_ _ and end with _ _>.
Can contain any data except the literal string”--”.
CDATA sections
CDATA section instructs the XML parser to ignore most markup
characters.
Example:
<![CDATA[
T1=P;
T2=*T1;
T3=**T1;
]]>
All character data in between is passed to the application without
interpretation.
Document type Declaration (DTD)
➢XML allows us to create our own tag names.
➢DTD allows a document to send meta information to the parser about its
contents.
Example: ordering of tags, its sequence etc.
DTD syntax:
<! DOCTYPE element DTD identifier
[
declaration 1
Declaration 2
]>
Types of DTD
Kind of declarations:
• Element Type Declarations
•Attribute List Definitions
•Entity Declaration
•Notation Declaration
Element Type Declarations
They identify the names of the elements and the nature of their content.
•Element can contain simple, predefined data types.
•They can refer to the other elements.
•They can be defined with respect to their cardinality
Example:
▪ This is a set of rules or declarations that specify which tags can be used and
what they can contain.
▪ At the top of your document is a reference to the DTD, declaring your desire to have
the document validated.
XML Schema
▪ Schemas use XML fragments called templates to demonstrate.
▪ They are themselves a form of XML, so you can edit them with the same tools you
use to edit your documents.
▪ They introduce more powerful datatype checking, making it possible to find errors
in content as well as tag usage.
Processing