Web Technology
Web Technology
Sarju S
Lecturer Department of Computer Science and Engineering www.lectnote.blogspot.com
Java XML Bean
JSP
EJB
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
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
Introduction to SGML
Introduction
Generalized Markup Language
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
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
10
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
12
15
17
Physical structure
Collection of Entities
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
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
Predefined entity Certain characters (<,>,/) are used specifically for marking up the document. Entity references are used to insert the character into the document like < , > , & etc <myelement>7 > 2</myelement>
June 30, 2010 24
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>
25
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
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>
27
Physical Structure
29
30
31
Attribute assignment
Attributes are pieces of information ,typically small ,that are associated with the XML element. [ name of the attribute] = [value of the attribute]
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 .
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>
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.