0% found this document useful (0 votes)
128 views44 pages

Web Technology

This document provides an overview of XML (eXtensible Markup Language) concepts including: - XML is a metalanguage that allows users to define customized markup languages. It focuses on describing data rather than formatting. - XML documents have a logical structure including a prolog, root element, and epilog. Physically, XML views documents as collections of entities. - The document then explains various XML markup concepts in detail like tags, attributes, entities, comments, and processing instructions that can be used to structure XML documents.

Uploaded by

jobishcthayil
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
128 views44 pages

Web Technology

This document provides an overview of XML (eXtensible Markup Language) concepts including: - XML is a metalanguage that allows users to define customized markup languages. It focuses on describing data rather than formatting. - XML documents have a logical structure including a prolog, root element, and epilog. Physically, XML views documents as collections of entities. - The document then explains various XML markup concepts in detail like tags, attributes, entities, comments, and processing instructions that can be used to structure XML documents.

Uploaded by

jobishcthayil
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 44

Web Technologies (RT 705)

Sarju S
Lecturer Department of Computer Science and Engineering www.lectnote.blogspot.com
Java XML Bean

JSP

EJB

June 30, 2010

MODULE I
Introduction to SGML -Features Of XML XML as a Subset of SGML XML Vs HTML Views of XML Document - Simple XML Document Starting and Ending Tags Attributes and Tags Entity References Comments CDATA Sections
June 30, 2010 2

What Is Markup?
Information added to a text to make its structure comprehensible Pre-computer markup
Word divisions Punctuation Copy-editor and typesetters marks Formatting conventions
3

June 30, 2010

Computer markup
Any kind of codes added to a document
Typesetting (presentational markup)
MS Word , TeX, Scribe, Lout, Script, nroff, XYVision

Declarative markup
HTML XML

June 30, 2010

Introduction to SGML
Introduction
Generalized Markup Language

SGML (Standard Generalized Markup Language) SGML Structure


SGML Declaration SGML DTD(Document Type Definition)
June 30, 2010 5

SGML Features
It is a system for defining the markup language. SGML is a meta language SGML is extensible SGML specifies the rules for tagging elements

June 30, 2010

XML- eXtensible Markup Language


XML means Extensible Markup Language extensible - not fixed format like HTML XML is a metalanguage - a language for describing other languages Enables you to define your own customized markup languages for different classes of documents
June 30, 2010 7

Example XML Document


<?xml version="1.0" encoding="iso-8859-1" ?> <book> <book-title>Paul Clifford</book-title> <author>Edward George Bulwer-Lytton</author> <year>1830</year> <price>5.50</price> <text> <chapter> <para>It was a dark and stormy night... </para> </chapter> </text> </book>
June 30, 2010 8

XML Applications
PUSH Technology Online Banking Software Distribution Web Automation Database Integration Scientific Publishing

To learn More >> Read Page No:31 to 73 XML by Example: Building e-Commerce Applications Sean McGrath
9

XML as a Subset of SGML


SGML is a very powerful intended to make SGML light enough for use on web XML is a proper subset of SGML

June 30, 2010

10

Comparison of HTML and XML


HTML XML

HTML is HyperText Markup Language It is used for displaying information and to format the document HTML is not extensible. HTML tags are predefined. Closing tags are mostly optional HTML is not case sensitive
June 30, 2010

XML is eXtensible Markup Language It is designed to describe data and to focus on what data is? XML is extensible Tags are not predefined. Closing tags are compulsory XML is highly case sensitive
11

XML Based System

June 30, 2010

12

Comparison of XML Document & HTML Document


Consider e-Business selling PCs on the internet Maker : Acer Item : PC Brand : Aspire Storage : RAM 3 GB Hard Disk 320 GB CPU : Speed 2.2 GHz
June 30, 2010 13

Comparison of XML Document & HTML Document


HTML
<html>
<body> <h1>PC For Sale</h1> <h2>Maker : Acer</h2> <h3>Brand : Aspire</h3> <table border=1 align=center> <tr><td>Storage</td><td>CPU</td></tr> <tr><td>RAM : 3GB<br>Hard Disk: 10 GB</td> <td>CPU Speed:500Ghz</td></tr> </table> </body> </html>
14

Comparison of XML Document & HTML Document

June 30, 2010

15

Comparison of XML Document & HTML Document


XML
<?xml version="1.0" encoding="UTF-8"?> <PcForSale> <Item type= "PC"> <Maker>Acer</Maker> <Brand>Aspire</Brand> <Storage> <Ram units = "GB">3 </Ram> <HardDisk units = "GB" >320</HardDisk> </Storage> <CPU>Speed 2.2 GHz</CPU> </Item> </PcForSale>
16

Comparison of XML Document & HTML Document

June 30, 2010

17

Views of an XML document


Logical structure
Prolog Root Element Epilog

Physical structure
Collection of Entities

June 30, 2010

18

Logical Structure
Prolog Everything before the root element It can be empty but at least contain the XML declaration <?xml version=1.0 ?> If DTD is associated with that document then prolog also includes Document Type Declaration. <?xml version=1.0 ?> <!DOCTYPE catalog SYSTEM catalog.dtd>
19

Logical Structure
Root element Element that contains all the other elements <?xml version=1.0 ?> <hello>Welcome to XML</hello> Root element can be empty <?xml version=1.0 ?> <hello/>
June 30, 2010 20

Logical Structure
Epilog Everything that occurs after the root element Which can contain processing instructions, comments or white spaces

June 30, 2010

21

Logical Structure

Physical Structure
In this view XML is considered as a collection of entities. Types of Entities
Predefined entity Parsed entity Unparsed entity External entity
23

June 30, 2010

Physical Structure - Types of entities

Predefined entity Certain characters (<,>,/) are used specifically for marking up the document. Entity references are used to insert the character into the document like &lt; , &gt; , &amp; etc <myelement>7 &gt; 2</myelement>
June 30, 2010 24

Physical Structure - Types of entities

Parsed entity It contains text data that becomes part of the document once the data is processed. XML processor will extract the content. <!ENTITY PUB!BPB Publishers>
<publisher>This book is from &PUB;</publisher>

June 30, 2010

25

Physical Structure - Types of entities

Unparsed entity
It is often a binary file or an image that is not directly interpreted by the parser It requires a notation Notation identifies the type or resource to which the entity is declared.
<!ENTITY myimage SYSTEM 1.gif NDATA GIF> <!Notation GIF SYSTEM utils\gifview.exe>
June 30, 2010 26

Physical Structure - Types of entities

External entity It provides a pointer to a location at which the entity can be found.
<!ENTITY myimage SYSTEM http://www.abc.com/image/gif NDATA GIF>

June 30, 2010

27

Physical Structure

June 30, 2010

Simple XML document


<greeting> Hello World </greeting>
The one line document has 3 component parts A start tag (<greeting>) An End tag ( </greeting>) Character data (Hello World)

June 30, 2010

29

Creating XML document


There are seven forms of markup that can occur in XML document. Start and End Tags Attribute Assignment Entity References Comments CDATA section Processing Instruction Document Type Declaration

30

Start and End Tags

June 30, 2010

31

Mixture of Markup and Character

June 30, 2010

Attribute assignment
Attributes are pieces of information ,typically small ,that are associated with the XML element. [ name of the attribute] = [value of the attribute]

example <printer type=laser>Acer</printer>


June 30, 2010 33

Attribute assignment

Attribute values can be delimited by either matching double June 30, 2010 quotes or matching single quotes.

34

Attribute assignment
Attribute values can contain entity references example
<!DOCTYPE test [ <!ENTITY company Acer>]> <intro title=&company; will solve all your problems/> Will give the result : A title Acer will solve your problems.
June 30, 2010 35

ENTITY References
Entities are the building blocks of XML documents. Entities are included in the XML document by means of entity reference. usage of entity reference is to slide characters in to an XML document that cannot be entered directly without confusing the XML parser Example
June 30, 2010 36

ENTITY References
<Document> if a<b and b<c then a<c </Document>

Characters (<,>) are reserved for markup and cannot be used as content .

How to solve this problem?


Answer is Entity Reference
To escape a character use entity reference.
June 30, 2010 37

ENTITY References
How can we use Entity Reference to solve this problem?

ENTITY References
Is it possible to create our own entity reference?
example <!entity iso International Organization for Standardization> We can use this entity within a sentence as : the &iso; sets the standard for character encoding.

when interepted by an XML parser the result is the International Organization for Standardization sets the standard for character encoding.
June 30, 2010 39

COMMENTS
1. XML comments take exactly the same form as HTML comment <!-- This is a comment --> 2. Note that the string - - cannot occur within a comment <!- - This is not a - -well formed XML comment - -> 3. Here is a comment spanning two lines: <!- -this is perfectly Legal comment spanning two lines- ->
June 30, 2010 40

COMMENTS
4. Here is a comment occurring within the Document type declaration:
<?xml version =1.0?> <!DOCTYPE apple[ <!- -this DTD is for apples--> <!ELEMENT apples(#PCDATA)>]> <apples>12</apples>

June 30, 2010

41

CDATA SECTION
to shield a body of text from the attentions of the XML processor. CDATA stands for character data.
syntax. <![CDATA[content]]> Example <Document> <![CDATA[ if a<b and b<c then a<c]] > June 30, 2010 </Document>

42

Processing Instruction(PI)
defined as markup that provides information to be used by software application. begins with <? and ends with ?> pair.

Example <?xml version=1.0?>


June 30, 2010 43

Document Type Declaration


is a statement embedded in an XML document whose purpose is to acknowledge the existence and location of Document Type Definition(DTD). DTD is a set of rules that defines the structure of an XML document. All Document Type Declaration starts with a string <!DOCTYPE
June 30, 2010 44

You might also like