Sie sind auf Seite 1von 19

XML:Concepts,applications,

and case studies


Dr.Shalini R.Urs
Professor
Department of Library and Information
Science
University of Mysore
Shalini@vidyanidhi.org.in

XML: Concept, applications, case studies PI-6 1


15-20 April 2002

XML:Concepts….
„ Outline
„ Markup languages
„ XML features
„ XML Syntax
„ XML Elements
„ Element naming rules
„ XML Attributes
„ XML DTD
„ Displaying XML document
„ XML Validation

XML: Concept, applications, case studies PI-6 2


15-20 April 2002

1
Markup languages
„ XML stands for
„ eXtensible
„ Markup
„ Language

XML: Concept, applications, case studies PI-6 3


15-20 April 2002

What is a language?
„ A languages is a conduit or a medium
to ‘carry’ data.
„ A language is also a system of coding
data.
„ A language is a system through which
‘data’ is represented, transmitted and
finally received by the intended
recipient/s.

XML: Concept, applications, case studies PI-6 4


15-20 April 2002

2
What is mark up?
„ ‘mark up’ are codes inserted into electronic texts to
govern formatting, printing or other processes.
„ There are two types of Markup Languages:
„ Descriptive
„ Procedural
„ A descriptive markup language simply indicates the
nature, function or content of the data in a file rather
than saying how that data should be processed. It
uses mark up codes to provide names to categorise
parts of a documents

XML: Concept, applications, case studies PI-6 5


15-20 April 2002

What is procedural markup?


„ a procedural mark up defines what
processing is to be carried out at
particular points in a document. They
carry instructions as to what is to be
done.
„ Ex:‘move the left margin 2 quads left’
„ In descriptive language the procedures
are separated in another programme

XML: Concept, applications, case studies PI-6 6


15-20 April 2002

3
What do mark up languages
do?

„ Markup languages consist of a set of markup


conventions used for encoding texts.
„ A markup language specifies –
„ What markup is allowed
„ What markup is required
„ How the mark up is distinguished from text
„ What the markup means

XML: Concept, applications, case studies PI-6 7


15-20 April 2002

SGML (Standard Generalized


Markup Language)
„ It is an internationally agreed standard for data
representation.
„ It can be used for publishing in its broadest sense-
from single medium conventional publishing on paper
to online multi-media database publishing on the
web.
„ It can be used to produce files that can be read by
human beings and exchanged between machines and
applications in a straightforward manner.
„ It is an international standard for the definition of
device independent system independent methods of
representing texts in electronic form.
XML: Concept, applications, case studies PI-6 8
15-20 April 2002

4
How is XML different from
HTML?
„ Markup languages generally combine two distinct
functions of representing text (document) –the ‘look’
and the ‘structure’.
„ HTML and XML have different sets of goals. While
HTML was designed to display data and hence
focused on the ‘look’ of the data, XML was designed
to describe and carry data and hence focuses on
‘what data is’.
„ HTML is about displaying data and XML is about
describing data.
„ HTML and XML are complementary to each other.

XML: Concept, applications, case studies PI-6 9


15-20 April 2002

What are the distinctive


features of XML ?
„ XML retains almost all the structural abilities of SGML.
„ It is designed to make it easy to exchange structured
documents over the INTERNET.
„ In XML the start and end of each of the logical parts
(elements) of documents clearly marked.
„ XML restricts the use of SGML constructs to ensure
that fall back options are available when access to
certain components of the document is not currently
possible over INTENET

XML: Concept, applications, case studies PI-6 10


15-20 April 2002

5
XML features
„ IT also defines how URLs can be used to
identify component parts of XML data
streams
„ XML is free and extensible. Unlike HTML tags
are not predefined and fixed. The Tags used
to mark up and structure HTML documents
are predefined. Where as in XML, one can
extend the tags-hence the name extensible.
One can define one’s tags.
„ XML can be developed for specific
applications Ex: MathML, CML
XML: Concept, applications, case studies PI-6 11
15-20 April 2002

XML features
„ XML can be used to create new languages. Ex: WML,
VRML
„ XML uses the concept of document type and hence a
DTD (Document Type Definition) to describe data
„ XML with DTD is self descriptive
„ XML separates data from display formats
„ XML can be used as a format to exchange data
„ Data can be stored in either files or databases.

XML: Concept, applications, case studies PI-6 12


15-20 April 2002

6
XML Syntax
„ XML Syntax consists of
„ XML Declaration

„ XML Elements

„ XML Attributes

„ The first line of an XML document


should always consist of an XML
declaration defining the version of XML

XML: Concept, applications, case studies PI-6 13


15-20 April 2002

XML Elements
„ An Element is a technical term for a
textual unit, viewed as a structural
component.
„ Different types of elements are given
different names
„ The names do not express meaning and
meanings are application dependent
„ XML elements are extensible

XML: Concept, applications, case studies PI-6 14


15-20 April 2002

7
XML Elements
„ Elements have relationships
„ Elements are related as parents and
children
„ They only express relationship with
other elements

XML: Concept, applications, case studies PI-6 15


15-20 April 2002

<?xml version="1.0" encoding= "ISO-8859-1" ?>


<book>
<title> XML for dummies</title>
<chapter> introduction to xml
<para>Markup languages</para>
<para>Features of XML</para>
</chapter>
<chapter>XML syntax
<para>Elements must be enclosed in tags</para>
<para>Elements must be properly nested</para>
</chapter>
</book>

8
Rules of Elements
„ All XML elements must have closing tags. In HTML
some elements do not have closing tags.
„ XML tags are case sensitive
„ An element <Title> is different from <title>
„ Therefore the opening and closing tags must be
written in the same case
„ All XML elements must be properly nested
„ All XML documents must have a root element
„ The first element is a root element. All other
elements must be nested within this root element

XML: Concept, applications, case studies PI-6 17


15-20 April 2002

General Structure
<root>
<child>
<subchild>…….</subchild>
</child>
</root>

XML: Concept, applications, case studies PI-6 18


15-20 April 2002

9
Element Naming Rules
„ Names can contain letters, numbers
and other characters
„ Names must not begin with a number
or punctuation character
„ Names must not begin with the letters
xml or XML or Xml…
„ Names cannot contain spaces

XML: Concept, applications, case studies PI-6 19


15-20 April 2002

XML Attributes

„ XML attributes are used to describe XML


elements or to provide additional information
about elements.
„ Attributes provide additional information that
is not part of the data.
„ Ex:
„ <Book no=”99-2456” media=”CD”></Book
>

XML: Concept, applications, case studies PI-6 20


15-20 April 2002

10
XML Attributes
„ XML elements can have attributes in
name/value pairs as in HTML.
„ Attributes must always be in quotes.
Either single or double quotes are valid,
though double quotes are most
common.
„ Attributes are always contained within
the start tag of an element.

XML: Concept, applications, case studies PI-6 21


15-20 April 2002

Attributes Vs. Elements


Case 1 ( Attributes)
< Book no= “99-2356” type= “CD”>
< author>
< firstname>Padmini</firstname>
<lastname>Ranganath</lastname>
</author>
</Book>
XML: Concept, applications, case studies PI-6 22
15-20 April 2002

11
Case 2 ( Elements)
<Book>
<no>99-2356</no>
<type>CD</type>
< author>
< firstname>Padmini</firstname>
<lastname>Ranganath</lastname>
</author>
</Book>
XML: Concept, applications, case studies PI-6 23
15-20 April 2002

Where elements scores over


attributes
„ While elements can contain multiple values
attributes cannot
„ Attributes are not expandable
„ Elements can describe structure but not
attributes
„ Attributes are more difficult to manipulate by
program code than elements
„ Attribute values are difficult to validate
against a DTD

XML: Concept, applications, case studies PI-6 24


15-20 April 2002

12
What is an XML DTD ?
„ DTD stands for Document Type Definition.
„ DTD is a formal model for defining the role
of each element
„ It formally defines the relationship between
the various elements that form the
documents.
„ The purpose of a Document Type Definition is
to define the legal building blocks of an XML
document.

XML: Concept, applications, case studies PI-6 25


15-20 April 2002

XML DTD
„ It defines the document structure with a list
of legal elements.
„ An XML DTD allows computers to check that
each component of document occurs in a
valid place within the document.
„ For example it allows computers to check
that users do not accidentally enter a third
level of heading without first having a
second level heading, etc.
XML: Concept, applications, case studies PI-6 26
15-20 April 2002

13
DTD…
„ The DTD can be Internal or external
„ An internal DTD refers to a case where
the XML document has the DTD inline
„ Where as an external DTD is one where
the document instance is separated
from the formal definition of elements

XML: Concept, applications, case studies PI-6 27


15-20 April 2002

<?xml version="1.0" encoding="UTF-8" ?>


<!DOCTYPE Metadata [
<!ELEMENT Metadata (thesesinfo+)>
<!ELEMENT thesesinfo
(title,author,contributor,subject,language,univ
ersity,date)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT contributor (#PCDATA)>
<!ELEMENT subject (#PCDATA)>
<!ELEMENT language (#PCDATA)>
<!ELEMENT university (#PCDATA)>
<!ELEMENT date (#PCDATA)>
]>

14
<?xml version="1.0" encoding="UTF-8"
standalone="no" ?>
<?xml-stylesheet type="text/xsl" href="exxsl.xsl" ?
<Metadata>
<thesesinfo>
<title>Discrete coded wave forms for signal processing
Radar</title>
<creator>Abbasi, Zia Ahmad</creator>
<contributor>Prof.Farid Ghani</contributor>
<subject>Electronic Engineering</subject>
<language>English</language>
<university>Aligarh Muslim University,Aligarh, Uttar
Pradesh</university>
<date>1998</date>
</thesesinfo>

<!ELEMENT Metadata (thesesinfo+)>


<!ELEMENT thesesinfo
(title,author,contributor,subject,language,univ
ersity,date)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT contributor (#PCDATA)>
<!ELEMENT subject (#PCDATA)>
<!ELEMENT language (#PCDATA)>
<!ELEMENT university (#PCDATA)>
<!ELEMENT date (#PCDATA)>

15
Title Discrete coded wave forms for signal processin

Author Abbasi, Zia Ahmad

Guide Prof.Farid Ghani

Subject Electronic Engineering

Language English

University Aligarh Muslim University,Aligarh, Uttar Prades

Year15-20 April 2002 1998 XML: Concept, applications, case studies PI-6 31

<?xml-stylesheet type="text/xsl"
href="inxsl.xsl" ?>
<Metadata>
<thesesinfo>
<title>Discrete coded wave forms for signal
processing Radar</title>
<creator>Abbasi, Zia Ahmad</creator>
<contributor>Prof.Farid Ghani</contributor>
<subject>Electronic Engineering</subject>
<language>English</language>
<university>Aligarh Muslim University,Aligarh,
Uttar Pradesh</university>
<date>1998</date>
</thesesinfo>

16
XML Validation
„ There are two types of XML documents
„ “Well formed” XML
„ An XML document that conforms to the
syntax of XML is called ‘well formed’
„ “Valid” XML
„ An XML document that conforms to a
DTD
„ Is called a ‘Valid’ DTD
XML: Concept, applications, case studies PI-6 33
15-20 April 2002

XML strengths
„ Its ability to describe data
„ Its ability to structure data
„ Separate display from structure
„ Long term archival feature
„ Non proprietary
„ Supported by industry
„ Availability of tools
XML: Concept, applications, case studies PI-6 34
15-20 April 2002

17
XML applications
„ B2B
„ EDI
„ Journal publishing
„ Database development

XML: Concept, applications, case studies PI-6 35


15-20 April 2002

XML future
Given the direction in which it is growing
and the level of support that XML has
received the XML appears to be the
future of Web publishing

XML: Concept, applications, case studies PI-6 36


15-20 April 2002

18
Thank U

XML: Concept, applications, case studies PI-6 37


15-20 April 2002

19

Das könnte Ihnen auch gefallen