Date post: | 23-Oct-2015 |
Category: |
Documents |
Upload: | shabin-muhammed |
View: | 13 times |
Download: | 0 times |
What are Markups
A text book publishing professional takes basic text
from authors on paper and write markup instructions
to tell the type setter how to make the document look
on the printed page. eg: ”insert a paragraph break
here, make this word bold ,double space this text
”,etc.
<Chapter starting><Heading “Java”><Sub heading introduction to java><begin paragraph>Java language uses interpreter----------<end paragraph><begin paragraph>----------------------------------------------------------------<end paragraph><Sub heading><begin paragraph>--------------------------------------------------------------------<end paragraph>--<Chapter end>
What are Markups (contd.)
Standard Generalized Markup Language (SGML)
• In 1986 an international standard for markup languages came into existence
called Standard Generalized Markup Language • XML is a subset of SGML intended to make SGML light enough for use on
the web • XML is a proper subset of SGML
XMLSGML
Standard Generalized Markup Language (SGML) (contd.)
Name Industry
ATA Aviation (Air Transport Authority)
Doc Book Technical Manual
Text Encoding Initiative (TEI) Encoding of literature
J2008 Automotive maintenance
Edgar Financial report of public companies
HTML Hyper Text Markup language
Pinnacles (PCIS) Semiconductor data
Some SGML initiatives
What is XML?
• XML is a framework used to create Markup Languages to describe
data in a structured manner, and an open technology for
electronic data exchange and storage.
eXtensible Markup Language (XML)
• The World Wide Web Consortium (W3C) XML Working Group derived
XML from SGML in 1996
• XML is an Extensible Markup Language because it is extensible according
to the user needs as the user can structure the data and add his own tags
• XML is actually a framework used to create other markup languages to
describe data in a structured manner
• XML documents contain only data and not formatting instructions
The relationship between SGML, XML and HTML
Text Encoding Initiative
HTML
Edgar
DocBookSGML
Channel Definition Format (CDF)
Open Financial Exchange (OFX)
Chemical Markup Language (CML)
Application languages Frameworks
XML
<h1> Personal Computers for sale </h1>
<h2> Maker: IBM PC </h2>
<h3> Model: Pentium IV </h3>
<table border =1>
<tr> <td> Storage </td></tr>
<tr> <td> RAM </td> <td>512 MB</td> </tr>
<tr><td> Hard Disk</td> <td>120 GB </td> </tr>
</table>
A Simple HTML
<PcForSale>
<Heading>Personal Computers for sale</Heading>
<Maker>IBM PC </Maker>
<Model> Pentium IV </Model>
<Storage>
<Ram Units ="MB">512</Ram>
<HardDisk Units ="GB">120</HardDisk>
</Storage>
</PcForSale>
The corresponding XML
Drawback of HTML
• A lot of useful information is lost when data is represented using HTML
• HTML has a fixed tag set, like <h1> , <table> , <tr> etc.
• HTML is an example of a markup language
Advantages of XML
• XML preserves useful information
• XML liberates information from the shackles of a fixed tag set
• XML provides a standardized frame work with which one can make his
own tags or use those defined by others that best fit the needs
• XML is a flexible framework in which you can create your own customized
markup language
• XML is a frame work for making markup languages
Electronic Documents
• Electronic documents consists of 3 distinct components.
• Data content - the words itself
• Structure - the document type and organization of its elements
• Presentation - the way the information is presented to the reader
• The significant benefits of XML is that the three aspects of a
document
are kept separate and made explicit in a computer system.
Presentation
Content
Structure
Traditional WYSIWYG Document
Presentation
Content
Structure
XML Document
Comparison between WYSIWYG and XML documents
Checking the structure of an XML document
• XML includes a mechanism for defining rules that control how documents
are structured and these rules are called Document type
Definitions (DTD)
• In Document Type Definitions by listing the elements types to be used and
indicating the structural order they can occur the structure of a XML
document can be checked
• A utility program called an XML parser is used to test whether or not the
document meets the prescribed rules
XMLDocument
Valid XML
XML RulesChecker (Parser)Structure
Rules (DTD) Invalid XML
Checking the structure of an XML document (contd.)
XML Style Language (XSL)
• XSL is used with XML to make XML look nicer in a browser
• XSL is similar to Cascaded Style Sheet used with HTML
• The use of XSL is to capture details about how the various elements in a
document should look and then to store them in a separate document
• Separating the content from the presentation allows the presentation to be
changed by simply changing the style sheet
• XSL is a simplified subset of the International Standard Style Language
known as DSSSL (ISO/IEC).
SGML
ISO 8879
DSSSL
ISO/IEC 10179 + CSS
XML
XSL
The relationship between XML, XSL and ISO Standards
eXtensible Link Language (XLL)
• In HTML <A> element is used for hypertext-linking
• The element is built directly into the language
• XLL standard is used with XML for hypertext-linking
SGML
ISO 8879
DSSSL
ISO/IEC 10179 + CSS
XML
XSL
Adding XLL to the family of XML standards
XLL
HyTime
ISO/IEC 10744 + TEI
Applications of XML
The world wide web and E-commerce cannot survive with out XML
There are a lot of examples where XML is used
1. Online Banking – Open financial Exchange Initiative.
2. Data base Integration.
Online Banking
• With the advent of the web the need for an inter change data representation
for financial data become necessary
• Users want to be able to purchase goods from anywhere on the web with
funds drawn from institutions anywhere in the world
• Users are least concern about the way the financial transactions are
represented
• The solution is a web-friendly internationally agreed standard notation for
expressing financial transactions
Online Banking (contd.)
•The hierarchical structure of the information found in financial transactions
is easily represented using the structured document philosophy of XML
<Statement Request>
<Bank Account>
<BankID>123456<BankID>
<AccountID>9999<AccountID>
<AccountType>CHEKING </AccountType>
<PersonName>Tom Hanks</PersonName>
</Bank Account>
</Statement Request>
This example conform to the Open Financial Exchange (OFX) specifications
Online Banking (contd.)
The transaction from a customer to a bank, requesting the establishment of a
recurring payment with 12 monthly installments<Recurrence> <Number>12</Number> <Frequency> MONTHLY </Frequency> <Payment Info> <From Bank> <Bank Id> 555432180 </Bank Id> <Account Id> 763984 </Account Id> <Account type> CHEKING </Account type> </From Bank> <Amount> 395.00. </Amount> <Payee ID> 77810. </Payee ID> <Pay Account >444-78-97572</Pay Account > <Date Due> 19971115 </Date Due> <Memo> Auto loan payment </Memo> </Payment Info></Recurrence>
Client Software
(eg. Microsoft Money)
OFX Documents
The Web OFX Documents
Financial Institution’s Software
OFX Conversion
Web Server
OFX interchange between financial institutions
Database Integration
• A lot of information in the world is stored in data bases like personal files,
health records, football results, stock prices etc
• The data base needs to be constantly updated and often change rapidly
• A mechanism is needed to access and modify the database using a web
interface
• The solution is to capture the database related information such as tables
fields, values etc. from the form and translate the data into XML format
and transfer it to the database
Name
Phone Number
Address
Submit
Data entry screen for a database
Data entry screen for a database
Web Browser
Web Server
Relational Database
Web Page Request
Web Page
XML tagged Data
XML tagged Data
<Phone book>
<Name> James Thomas </Name>
<Phone Number>27598191 </phone Number>
<Address> 20 MG Road Bangalore 560001 </Address>
</Phone book>
XML format of data sent to the Database for entry
The Commercial benefits of XML
• By using XML there are a number of benefits like
• The content of an XML page can be manipulated and rearranged and even
calculated to generate extra content at the client end with help of
scripting languages like Java
• The same content can be made to look completely different for different
users or different uses
• The content can be intelligently searched with the browser based on what it
contains
The Commercial benefits of XML (contd.)
• It is very difficult to move a document from one software package to another
• Document conversion from one format to another has become difficult due to
• The volume of document produced is increasing day by day
• The demands had changed these days from paper print out to other
requirements like online help files, Web pages, multilingual version,
speech synthesis etc
• The traditional documents are hard to reuse because of the tight coupling
between presentation and contents found in most documents
The Commercial benefits of XML (contd.)
• High quality formatting can be added automatically by specifying what the
document contains
• For XML different types of formatting can be applied to the same content in
order to achieve different results
• By using XML the content is freed from the shackles of any one particular
formatting system
• An XML document can meta amorphous to many different shapes and sizes
• The structure and the content are retained independently thus allowing the
document to be reformatted over and over again to a number of formats
XML Document
XML Web Browser
HTML
Online Help
Paper
Braille
Formatter
Formatter
Formatter
Formatter
Creating multiple formatted outputs from a XML document
XML Document XML DocumentHarvested XML Document
An XML document created from the component parts of other documents
Document Creation
• When a document is created it should be specified what the document is,
what components they contain and how the components are structured
• When the computer is told what is in the document then it can differentiate
between letters, invoices, copyright notices etc.
• By using XML the computer can be told what is in a document
• Name the component parts based on what they are
<Copyright>
<Para>This document is copyright….</Para>
</Copyright>
Benefits of XML
• XML documents are self describing
• When documents contain rich structural information complex queries can
be
precisely answered and searches gets good results
• In industry information interchange is very necessary for the existence
• It will be very difficult for information interchange with out a commonly
accepted standard
• By using an industry standard interchange notation the number of
converters can be minimized
Format A Format B
Format C Format D
Data exchange where there is no standard format for interchange
Format A Format B
Format C Format D
XML Interchange Format
Data exchange using standard format for interchange
Benefits of XML in brief
• The content of an XML page can be manipulated and rearranged and
even
calculated to generate extra content
• The same content can be made to look completely different for different
users or different uses
• XML is a completely open standard that safeguards the ownership of data
• XML documents describe themselves making searching, indexing and
locating information easier
• XML allows a high degree of automation in the labor intensive areas
Two views of an XML document
• An XML document can be looked at in two very distinct ways
• Logical structure
• Physical Structure
• In a logical structure an XML document is a hierarchy of information
• The character data of the document hangs in individual chunks out of a tree
like structure created by markups
Two views of an XML document (contd.)
• In a physical structure a single logical XML documents can be made up of a
number of distinct physical files known in XML as entities
• The full document is rooted in the entity known as the document entity
• Like the logical structure, the physical structure of an XML document is
hierarchical in nature
• An entity can contain references to other entities which themselves can
contain references to other entities
Logical View
IBMPC
Item type = “PC”
make specification blurb
brandsupplier id = “Compusa”
CPUType = “Pentium IV”
Speed units = “3 GH3”
Hard disktype =”IDE”size =””120”units = “GB”
IBM inspire A versatile PC…
Physical View
IBM PC
Entity A
( part1.xml )
Entity B
( part2.xml )
Entity A1
( part11.xml )
Entity A2
( part12.xml )
Two classes of XML document
• A well formed XML document is one from which as XML Processor can
successfully build a tree structure
• An XML Processor can successfully build a tree without a DTD
• Well-formed XML documents can be further classified as valid if they meet
the constrains spelled out in an associated DTD
• If an XML document is valid it is also well formed
• The set of all valid XML documents is a subset of the set of all well formed
XML documents
Two classes of XML document
Valid XML Documents
Well Formed
XML Documents
Two classes of XML processors
• An XML processor capable of checking for validity is known as a validating
XML processor
• The msxml processors from Microsoft is an example of a validating XML
processor
• An XML processor that ignores any validity constraints spelled out in DTD
is known as a nonvalidating XML processor
• Elfred is an example of nonvalidating XML processor
• Any processor capable of checking for validity is capable of checking for
well-formedness
Two classes of XML processors
Validating XML Processors
Nonvalidating XML Processors
How to create XML Documents
• Seven forms of markup can occur in XML documents and they are
1. Start and End tags
2. Attribute assignments
3. Entity references
4. Comments
5. Processing instructions
6. CDATA sections
7. Document Type Declarations
Start and End tags
• The presence of elements in an XML document is denoted by tags of various
forms
• The elements have start and end points denoted by start and end tags
• Elements can be nested to an arbitrary depth to describe very rich
information structures.
Some examples of Start tag and End tag
Tag Meaning
<greeting> Start a greeting element
</introduction> End an introduction element
<John Mathew> Bad start tag no space allowed in the element type name
<42> Bad start tag element type names cannot start with a number
</ product> Bad end tag no space allowed between the slash and the element type name
Start and End tags (contd.)
• Elements can be nested to any arbitrary depth using start and end tags
• By nesting elements to depth very rich information structures can be
described
• An empty element can be represented by a backslash before the closing “>” of
start tag
eg:- <introduction/>
Start and End tags (contd.)
<TypesOfCar> <Saloon> <Normal> <automatic> <Car> Model A </Car> </automatic> <manual> <Car> Model B </Car> </manual> </Normal> <FourWeelDrive> <automatic> <Car> Model C </Car> </automatic> </FourWeelDrive> </Saloon></TypeOfCar>
Attribute Assignments
• Attributes are pieces of information that are associated with XML elements
• In HTML we have the align attribute of the p element, the border attribute
of the table element
• Attribute come in verity of shapes and sizes that are controlled by DTD
• Attribute assignments always appear within the start-tag of an element
• The normal syntax of an attribute is
Element[name of attribute] ”=” [value of attribute]
eg. <Car colour=”Red”> , <Table border=2> ,
<animal legs=”4” blood=”cold”>
Entity references
• Entities are the physical building blocks of the XML documents
• An entity is a unit of text as single as character or as complex as an entire
document
• Consider the following piece of XML document
<Document>
If a<b and b< c then a<c
</Document>
Entity references (contd.)
• When the XML Parser parses the document it will complain when it sees
the
second “b” character because at that point it was expecting an equal
sign to start the value for the and attribute of the b element
• XML has a number of predefined entities
• In an XML document prepend an “&” and append a”;” to the name of the
entity so the above example can be rewritten as
<Document>
If a & lt; b and b< c then a & lt; c
</Document>
Entity references (contd.)
Entity Reference Interpretation
< <
> >
& &
' ‘
" “
Five built-in Entities in XML
Entity references (contd.)
• Entity references can be used to include entire files of XML text within the
text of other files
<Book>
&Chapter 1;
&Chapter 2;
&Chapter 3;
</Book>
• The three chapters of a book stored in separate entities to be gathered in to a
single Book element
Entity references (contd.)
• Shorthand notation are used in XML.
<!ENTITY dbms “Data Base Management System”>
• When dbms is referred the XML parser will insert the replacement text
“Data Base Management System”
eg. <ulysses> &dbms; is managed by Administrator
will be expanded as
Data Base Management System is managed by Administrator
Comments
• XML comments take exactly the same form as HTML comments.
<!--This is a comment -->
• The string “--“ cannot be used within a comment.
<!--This is -- not a comment -->
Processing Instructions
• Processing Instruction is used to store application specific information in an
XML document
• The processing instructions pass straight through as SGML parser because
they are for the consumption of an application
eg1. <?rtf\page?> is a processing instruction to force a particular type setting
device to output a page break at particular place
eg2. <?XML version =”1.0” ?>
• This shows the version of XML and is a standard for all XML documents
CDATA sections
• In some cases a document may contain large numbers of characters that are
specially considered by an XML parser like < and >
• XML allows a block of text to be insulated from attention of the parser using
a CDATA section
<Document>
<![CDATA[ If a<b and b<c and a<c ]] >
</Document>
• By prefixing the string <![CDATA [ and appending the string ]]> the entire
section in insulated and passes through the parser with out any
problem
Document Type Declaration (DTD)
• The Document Type Definitions lists the elements types to be used in an
XML document and indicates the structural order they occur
• A DTD is to be associated with an XML document, the association is
achieved using the following declaration
<!DOCTYPE first SYSTEM “first.dtd”>
•It says the DTD for the document first is available in the file first.dtd
Creating XML DTD’s
Creating a DTD contain the following steps
• Element Type Declaration
• Attribute List Declarations
1) Attribute Types
2) Attribute Defaults
• Entity Declarations
Element Type Declarations
• To validate an XML document the validating XML parser needs to know
three principle things about each element
• What the element type is named
• What elements of that type can contain
• What attribute an element of that type has associated with it
• The element type name and its content model are declared together in an
element type declaration
1) <!ELEMENT contact (name, address, telephone )>
An element of type contact must contain 3 sub elements, namely name,
address, and telephone in exactly that order.
eg: <contact>
<name> James Thomas</name>
<address>Bangalore</address>
< telephone>2226473</telephone>
</contact>
Element Type Declarations (contd.)
Element Type Declarations (contd.)
2. <!ELEMENT contact (name, address?, telephone )>
• An element of type contact can contain three sub elements
• Firstly it must have a name element
• This is optionally followed by an address element
• Lastly a telephone element
eg: <contact>
<name> James Thomas</name>
<telephone>2226473</telephone>
</contact>
Element Type Declarations (contd.)
3. <!ELEMENT fruit(apple/orange)>
An element of type fruit contains either a single apple element or a single
orange element
4. <!ELEMENT fruit(apple/orange)+>
An element of type fruit contains one or more sub elements that are either
apple element or orange elements
eg : <fruit>
<apple> ----------</apple> <fruit>
<apple>-----------</apple> Or <orange>--------</orange>
<orange>---------</orange> </fruit>
</fruit>
Element Type Declarations (contd.)
5. <!ELEMENT fruit(apple/orange)*>
An element of type fruit contains zero or more sub elements that are either
apple element or orange element
eg : <fruit>
</fruit>
6. <!ELEMENT InStock EMPTY>
An element of type InStock does not contain anything
eg : <InStock/>
Element Type Declarations (contd.)
7. <!ELEMENT para(#PCDATA| list)*>
An element of type para contains a mixture of character and list elements
in any order.
eg : <para> <para> XML is a frame work
Here is my list </para> Or </para>
<list> ------ </list>
</para>
Or
<para>
<list> ------</list>
</para>
Element Type Declarations (contd.)
8. <!element InStock EMPTY>
•This is an error because the keyword “ELEMENT” must always be in
uppercase
• This is for all XML Keywords
Attribute List Declarations
• Attributes have to be declared in the DTD for the XML parser to check for
validity
• An attribute list declaration has four aspects
• The element type to which it belongs
• What the attribute is named
• What type of data the attribute value can contain
• How assignments to the attribute are treated by the parser ie. What to do if
a
value is not supplied
Declaring an Attribute’s Name and associating an element type
<!ATTLIST product
name…
color…
>
An element of type product has two attributes known as name and color…
eg:- <product name=”Parker” color=”Black”>
Attribute Types
• There are different types of attributes
• There is a plain value attribute known as a CDATA attribute
• This is declared using the CDATA keyword
• A list of permissible values for an attribute can be supplied using an
enumerated type attribute.
Attribute Type Declaration
1. <!ATTLIST product name CDATA -->
An element of type product has an attribute known as name, whose
value
can be any string of characters
2. <!ATTLIST product name CDATA …. color(red/green)--->
An element of type product has two attributes known as name and
color.
The color attribute value must be either the string “red” or the string
“green”. Eg: <product name=”Hero Honda” color=”red”>
Attribute Type Declaration (contd.)
3. <!ATTLIST product code ID ---->
An element declared of type product has an attribute known as code.
The values of the code, attribute must be unique among attributes of
the ID type across the entire XML document.
Eg: <product code=”B42”>
Attribute Defaults
• The four flavors of attribute default are
• A value must be supplied (Required attribute)
• A value may be supplied but need not be (Implied attribute)
• The value is fixed in the DTD (Fixed attribute )
• In the absence of value use the one given in the DTD.
Attribute Defaults (contd.)
1. <!ATTLIST product name CDATA #REQUIRED>
An element of types product has an attribute known as name, whose
value can be any string of characters. A value for this attribute must
be supplied when it is used in an XML document.
2. <!ATTLIST product name CDATA “IBMPC” >
An element of type product has an attribute known as name. The name
attribute value can have any string of characters. In the absence of a
value for the attributes in the document, use the default value
“IBMPC” Eg:<product name =”Turbo”>
Attribute Defaults (contd.)
3. <!ATTLIST product color(red/green) “red”) >
An element of type product has an attribute named color. The color
attribute must be either the string “red” or the string “green”. In the
absence of a value for the attribute in the document, use the default
value “red” E.g.: <product color=”red”>
4. <!ATTLIST product color(red/green) ) # REQUIRED >
An element of type product has an attribute named color. The color
attribute must be either the string “red” or the string “green”. A value
must be supplied when the element is used in a document.
Eg: <product color=”red”>
Attribute Defaults (contd.)
5. <!ATTLIST product color(red/green) ) # IMPLIED >
An element of type product has an attribute named color. The color
attribute must be either the string “red” or the string “green”. If a
value is not supplied leave it up to the XML application to decide what
to do.
e.g : <product color=”red”>
6. <! ATTLIST product name CDATA # FIXED “IBMPC” >
An element of type product has an attribute known as name. The value
of this attribute is fixed to the value “IBMPC”. Any other value is an
error.
Eg: <product name=”IBMPC”>
Entity declarations
• Entity takes a verity of forms and can be classified in various ways.
1. <!ENTITY spbm “Stately, plump, Black, Mulligan” >
There is an entity known as spbm when referenced in an XML
document the parser will insert the replacement text Stately, plump,
Black, Mulligan
Eg: <Ulysses> &spbm; stepped ….
Entity declarations (contd.)
2. <!ENTITY chapter1 SYSTEM http://www.digitome.com/chap1.xml>
There is an entity known as chapter1. When referenced in an XML
document, the parser will insert the contents of the file
http://www.digitome.com/chap1.xml.
Eg: <Ulysses> &chapter1;
Viewing XML Document in an HTML browser
• There are mainly two methods of displaying XML Document in an HTML
browser
1. Displaying XML in an HTML browser with Data Source Object
technology (DSO)
2. Converting XML to HTML via the XSL Stylesheet Language
Displaying XML in an HTML browser with Data Source Object Technology
• Microsoft Internet Explorer contains built in XML parser known as MSXML
• The Internet Explorer uses a technology called Data Source Objects
• The original intent of Data Source Object was to easily integrate relational
database data and the Web
• The Internet Explorer uses a XMLDSO applet to map XML to HTML
•The following is an XML example to be shown in a browser
The XML part
<?xml version =”1.0”?><PSC>
<PC><NAME> IBM PC </NAME><CAPACIY> 100 </CAPACITY><PRICE> 20000</PRICE>
</PC><PC>
<NAME> COMPAC PC </NAME><CAPACIY> 200 </CAPACITY><PRICE> 30000</PRICE>
</PC> <PC>
<NAME> SONY PC </NAME><CAPACIY> 300 </CAPACITY><PRICE> 40000</PRICE>
</PC></PCS>
The HTML part
<html>
<head>
<title> Example 1 </title>
<BODY>
<h1> Example 1 </h1>
<P>
XML catalog displayed in an HTML table using Data Binding
<applet code =com.xml.dso. XMLDSO.class width-100% height=25
id=xmldso >
<PARAM NAME=”url” VALUE=”cat.xml” >
</applet>
The HTML part (contd.)
<table id=table border=2 width=100% datasrc=#xmldso><thead>
<th> Name<th>Capacity<th>price
</thead><tr><td valign=top> <div datafld= NAME></td><td valign=top> <div datafld= CAPACITY></td><td valign=top> <div datafld= PRICE></td></tr>
</table> </BODY></html>
PCS
PC
HTML
table
cellcellcell
row
name pricecapacity
XML DSO
Applet
Using XMLDSO to connect XML elements with HTML
Displaying XML in an HTML browser with Data Source Object Technology
• The datasrc attribute is used to connect the table to the applet with the id
xmldso
• The datafld attribute is used to map the xml data to the HTML table
•The XMLDSO applet acts as a glue that binds the name element of the source
XML document to the first cell of the HTML table row
• The capacity element of the source XML document is bound to the second
cell
of the HTML table row
Storing XML in an HTML document
• XMLDSO can also have XML data provided to it as part of the HTML
page rather than accessing it externally
• The source XML can be embedded within the applet element
• To allow the applet to access the HTML page set the MAYSCRIPT
attribute to TRUE
Storing XML in an HTML document (contd.)
<html> <head> <title> Example 1 </title> <BODY> <h1>Example 1 </h1> <P> XML Catalog displayed in an HTML table using XML Data Binding <applet code= com.ms.xml.dso. XMLDSO.class width=100% height=25 id=xmldso mayscript=TRUE > <!--XML stored in an HTML page as part of an element --> <?xml version =”1.0” ? ><PSC>
<PC><NAME> Acme Blaster </NAME><CAPACIY> 100 </CAPACITY><PRICE> 2000</PRICE>
</PC>
Storing XML in an HTML document (contd.)
<PC><NAME> Speedy PC </NAME><CAPACIY> 200 </CAPACITY><PRICE> 4000</PRICE>
</PC> <PC>
<NAME> Gonzo PC </NAME><CAPACIY> 300 </CAPACITY><PRICE> 5000</PRICE>
</PC> </PCS></applet><!--table declaration as in Example 1 -- > <table id=table border=2 width=100% datasrc=#xmldso>
<thead><th> Name<th>Capacity<th>Price
</thead>
Storing XML in an HTML document (contd.)
<tr>
<td valign=top> <div datafld= NAME> </td>
<td valign=top> <div datafld= CAPACITY> </td>
<td valign=top> <div datafld= PRICE> </td>
</tr>
</table>
</BODY>
</html>
Displaying XML documents in a browser using XML tag
• Internet Explorer 5 and higher version allows XML document to be
embedded into an HTML document
• The <XML> tag is used to mark the beginning of the XML document and
</XML> tag is used to mark the end
• This type of XML representation in an HTML page is called data island
• For data islands the Attribute ID is set to “xml Doc”
• In the HTML file a DATASRC attribute which is set to “#xmlDoc” is added
to the table element’s start tag
Converting XML to HTML with XSL
• An XSL style sheet consists of a set of rules that tell an XSL processor how
to
convert an XML document into a displayable form on a browser
• XSL can be used to produce style sheets that are independent of any one
output notation
• A single XSL style sheet can be used to target multiple out put notations
such
as HTML, TeX, RTF and so on
Converting XML to HTML with XSL (contd.)
• As the HTML output is a major use of XSL a number of HTML specific
features have been built directly into the XSL language
• An XSL style sheet is based on the idea of rules that trigger when the
specified elements are encountered in an XML document
• The rule specifies what should be generated in the HTML output
• XSL can be used to produce new results by performing calculations on the
XML data
PCS
PC
HTML
table
cellcellcell
row
name pricecapacity
XSL
Processor
Generating HTML from XML with XSL
XSL Stylesheet