XML Mod4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 89

XML Facts

◼ officially recommended by W3C since 1998


◼ a simplified form of SGML (Standard
Generalized Markup Language)
◼ primarily created by Jon Bosak of Sun
Microsystems
XML Facts
◼ Hyper text markup language was configured for showing data and XML
was designed to hold data.
◼ It's utilized to send and store information with aspire on what data
comprises.
◼ It's highly required for
➢Publishers
➢Technical
➢informative
➢Commercial
➢Media
➢Financial & Legal firms
& additional business sector
What is XML?

◼ XML stands for EXtensible Markup Language


◼ XML is a markup language much like HTML
◼ XML was designed to carry data, not to display
data
◼ XML tags are not predefined. You must define
your own tags
◼ XML is designed to be self-descriptive
◼ XML is a W3C Recommendation
What is XML?(Cond..)
◼ A meta language that allows you to
create and format your own document
markups
◼ a method for putting structured data
into a text file; these files are
- easy to read
- unambiguous
- extensible
- platform-independent
What is XML? (Cond..)

◼ a family of technologies:
- XML 1.1
- Xlink
- Xpointer & Xpath
- CSS, XSL, XSLT
- XML DOM
- XML Namespaces
- XML Schemas
The Difference Between XML
and HTML

◼ XML is not a replacement for HTML.


◼ XML and HTML were designed with different goals:

•HTML was designed to •XML was designed to


display data, with focus transport and store
on how data looks data, with focus on
what data is
•HTML is about
displaying information. •XML is about carrying
information.
Quick Comparison
◼ HTML ◼ XML
- uses tags and - uses tags and
attributes attributes
- content and - content and format
are separate;
formatting can be formatting is
placed together contained in a
<p><font=”Arial”>text</font>
stylesheet
- tags and attributes are - allows user to specify
pre-determined and what each tag and
rigid attribute means
XML Standards – an Overview

◼ XML Core Working Group:


◼ XML 1.0 (Feb 1998), 1.1 (candidate for recommendation)
◼ XML Namespaces (Jan 1999)
◼ XSLT Working Group:
◼ XSL Transformations 1.0 (Nov 1999)
◼ XPath 1.0 (Nov 1999)
◼ eXtensible Stylesheet Language XSL(-FO) 1.0 (Oct 2001)
◼ XML Linking Working Group:
◼ XLink 1.0 (Jun 2001)
◼ XPointer 1.0 (March 2003, 3 substandards)
◼ XQuery 1.0 (Nov 2002) plus many substandards
◼ XMLSchema 1.0 (May 2001)
XML Documents

What‘s in an XML document?


◼ Elements
◼ Attributes
XML Documents Form a Tree Structure

◼ XML documents must contain a root element. This


element is "the parent" of all other elements.
◼ The elements in an XML document form a document tree.
The tree starts at the root and branches to the lowest
level of the tree.
◼ All elements can have sub elements (child elements):
◼ <root>
<child>
<subchild>.....</subchild>
</child>
</root>
A Simple XML Document
Processing Instruction Freely definable tags

<?xml version=“1.0”?>
<Book>
<author> Ditel & Ditel </author>
<title> Internet and World Wide Web </title>
<price> 850 </price>
</Book>
A Simple XML Document with
Attributes Attributes with
name and value

<article>
<author>Gerhard Weikum</author>
<title> The Web in Ten Years </title>
<text>
In order to evolve
</text>
</article>
XML Components

◼ there are 4 components for XML


content:
- The XML document
- DTD (Document Type Declaration)
- XML Schema
- XSL (Extensible Stylesheet Language)
◼ The DTD, schema and XSL do not
need to be present in all cases
Types of XML Document

◼ Well Formed XML Document


➢ A well-formed document in XML is a document that
adheres to the syntax rules specified by the XML 1.1
specification in that it must satisfy both physical and
logical structures.
◼ Valid XML Document
➢ An XML document validated against a DTD & XML
Schema is "Well Formed" and "Valid".
A well-formed XML document

◼ elements have an open and close tag,


unless it is an empty element
◼ attribute values are quoted
◼ if a tag is an empty element, it has a
closing / before the end of the tag
◼ open and close tags are nested correctly
◼ there are no isolated mark-up characters
in the text (i.e. < > & ]]>)
◼ if there is no DTD, all attributes are of type
CDATA by default
A valid XML document
◼ Has an associated DTD and schema
and complies with the constraints in
the DTD and schema.
XML basics
◼ <?xml> - the XML declaration
- not required, but typically used
Attributes include:
➢ version
➢ encoding – the character encoding used in
the document
➢ standalone – if an external DTD is required
<?xml version=”1.0” encoding=”UTF-8”>
<?xml version=”1.0” standalone=”yes”>
XML basics
◼ <!DOCTYPE …> to specify a DTD
for the document
2 forms:
<!DOCTYPE root-element SYSTEM “URIofDTD”>
<!DOCTYPE root-element PUBLIC “name”
“URIofDTD”>
XML basics
◼ <!-- --> comments
- contents are ignored by the processor
- cannot come before the XML declaration
- cannot appear inside an element tag
XML basics
◼ <tag> text </tag> an element
- can contain text, other elements or a
combination
- element name:
must start with a letter or underscore and
can have any number of letters, numbers,
hyphens, periods, or underscores
- case-sensitive;
- may not start with xml
XML basics
◼ Namespaces:
- not mandatory, but useful in giving
uniqueness to an element
- help avoid element collision
- declared using the xmlns:name=value
attribute; a URI is recommended for value
- can be an attribute of any element; the
scope is inside the element’s tags
XML basics
◼ <![CDATA[ ]]>
- to define special sections of character
data which the processor does not
interpret as markup
- anything inside is treated as plain text
XML Advantages(1)

◼ XML Separates Data from HTML


◼ XML Simplifies Data Sharing
◼ XML Simplifies Data Transport
◼ XML Simplifies Platform Changes
◼ XML Makes Your Data More Available
◼ XML is Used to Create New Internet
Languages
XML Advantages (2)
◼ important because it removes two
constraints which were holding back
Web developments:
1. dependence on a single, inflexible document
type (HTML);
2. the complexity of full SGML, whose syntax
allows many powerful but hard-to-program
options
SGML,HTML
Data Description Definition
Meta Markup
Configuration Language

XML Facts Overview


Technologies
Tags
XML W3C
Difference Recommendation
Attributes
HTML & XML
Components
Basics
Element
DTD
Content Document
Types CDATA
XML Schema
Valid Namespaces

Well Formed XSL


XML
DTD & XMLSCHEMA
XML Validation

• XML with correct syntax is "Well Formed" XML.

• XML validated against a DTD / XML schema is


"Valid" XML.
Well Formed XML Documents

• A "Well Formed" XML document has correct


XML syntax.
• The syntax rules were
➢XML documents must have a root element
➢XML elements must have a closing tag
➢XML tags are case sensitive
➢XML elements must be properly nested
➢XML attribute values must be quoted
Valid XML Documents

• A "Valid" XML document is a "Well


Formed" XML document, which also
conforms to the rules of a Document Type
Definition (DTD):
Valid Documents

➢ A well-formed XML document is valid if it conforms to its


DTD, that is,
➢ The document conforms to the regular-expression grammar
➢ The attributes types are correct, and
➢ The constraints on references are satisfied
Document Type Definitions (DTDs)

➢ DTD: Document Type Definition; A way to specify the structure of


XML documents.
➢ A DTD adds syntactical requirements in addition to the well-formed
requirement.
➢ DTDs help in
➢ Eliminating errors when creating or editing XML documents.
➢ Clarifying the intended semantics.
➢ Simplifying the processing of XML documents.
➢ Uses “regular expression” like syntax to specify a grammar for the
XML document.
➢ Has limitations such as weak data types, inability to specify
constraints, no support for schema evolution, etc.
Example: An Address Book
<person>
<name> Homer Simpson </name> Exactly one name

<greet> Dr. H. Simpson </greet> At most one greeting

<addr>1234 Springwater Road </addr> As many address lines


as needed (in order)
<addr> Springfield USA, 98765 </addr>
<tel> (321) 786 2543 </tel>
Mixed telephones and
<fax> (321) 786 2544 </fax> faxes
<tel> (321) 786 2544 </tel>
As many as
<email> [email protected] </email>
needed
</person>
Adding a DTD to the Document

A DTD can be

➢ Internal
➢ The DTD is part of the document file

➢ external
➢ The DTD and the document are on separate files
➢ An external DTD may reside
➢ In the local file system (where the document is)
➢ In a remote file system
Connecting a Document with its DTD
➢ An internal DTD

<?xml version="1.0"?>
<!DOCTYPE db [<!ELEMENT ...> … ]>
<db> ... </db>

➢ A DTD from the local file system:

<!DOCTYPE db SYSTEM "schema.dtd">

➢ A DTD from a remote file system:

<!DOCTYPE db SYSTEM
"http://www.schemaauthority.com/schema.dtd">
Specifying the Structure

➢ name a name element

➢ greet? an optional (0 or 1) greet elements

➢ name, greet? a name followed by an optional greet

➢ addr* to specify 0 or more address lines

➢ tel | fax a tel or a fax element

➢ (tel | fax)* 0 or more repeats of tel or fax


➢ email* 0 or more email elements
Specifying the Structure (continued)

➢ So the whole structure of a person entry is specified by

name, greet?, addr*, (tel | fax)*, email*

➢ Regular expression syntax (inspired from UNIX regular expressions)

➢ Each element type of the XML document is described by an


expression (the leaf level element types are described by the data
type (PCDATA)

➢ Each attribute of an element type is also described in the DTD by


enumerating some of its properties (OPTIONAL, etc.)
Element Type Definition

For each element type E, a declaration of the form:

<!ELEMENT E content-model>

where the content-model is an expression:

Content-model ::=
EMPTY | ANY | #PCDATA | E’ |
P1, P2 | P1 | P2 | P1? | P1+ | P1* | (P)

– E’ element type
– P1 , P2 concatenation
– P1 | P2 disjunction
– P? optional
– P+ one or more occurrences
– P* the Kleene closure
– (P) grouping
Element Type Definition

The definition of an element consists of exactly one of the


following:

➢ A regular expression (as defined earlier)


➢ EMPTY: element has no content
➢ ANY: content can be any mixture of PCDATA and elements
defined in the DTD
➢ Mixed content which is defined as described on the next slide
➢ (#PCDATA)
The Definition of Mixed Content

Mixed content is described by a repeatable OR group

(#PCDATA | element-name | …)*

➢ Inside the group, no regular expressions – just element


names

➢ #PCDATA must be first followed by 0 or more element


names, separated by |

➢ The group can be repeated 0 or more times


Address-Book Document with an Internal DTD

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


<!DOCTYPE addressbook [
<!ELEMENT addressbook (person*)>
<!ELEMENT person (name, greet?, address*,
(fax | tel)*, email*)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT greet (#PCDATA)>
<!ELEMENT address (#PCDATA)>
<!ELEMENT tel (#PCDATA)>
<!ELEMENT fax (#PCDATA)>
<!ELEMENT email (#PCDATA)>
]>
The Rest of the Address-Book Document

<addressbook>
<person>
<name>Jeff Cohen</name>
<greet> Dr. Cohen</greet>
<email>[email protected]</email>
</person>
</addressbook>
Some Difficult Structures

Each employee element should contain name, age and ssn


elements in some order

<!ELEMENT employee
((name, age, ssn) | (age, ssn, name) |
(ssn, name, age) | ...
)>

Too many permutations!


Attribute Specification in DTDs

<!ELEMENT height (#PCDATA)>


<!ATTLIST height
dimension CDATA #REQUIRED
accuracy CDATA #IMPLIED >

➢ The dimension attribute is required

➢ The accuracy attribute is optional

➢ CDATA is the “type” of the attribute – character data


The Format of an Attribute Definition
<!ATTLIST element-name attr-name attr-type
attr-default>
➢ The default value is given inside quotes
➢ Attribute types:
➢ CDATA
➢ ID, IDREF, IDREFS
➢ ID, IDREF, IDREFS are used for references
➢ Attribute Default
➢ #REQUIRED: the attribute must be explicitly provided
➢ #IMPLIED: attribute is optional, no default provided
➢ "value": if not explicitly provided, this value inserted by default
➢ #FIXED "value": as above, but only this value is allowed
XML Schema
What is XML Schema?

• The origin of schema


▪ XML Schema documents are used to define and
validate the content and structure of XML data.
▪ XML Schema was originally proposed by Microsoft,
but became an official W3C recommendation in May
2001
Why Schema? (1)

•Separating Information from Structure and Format

•Information
•Information
•Structure •Format
•Format
•Structure

•Traditional Document: •“Fashionable” Document: A document


•Everything is clumped together is broken into discrete parts, which
can be treated separately
Why Schema? (2)

•Schema Workflow
DTD versus Schema

Limitations of DTD Advantages of Schema


• No constraints on character • Syntax in XML Style
data • Supporting Namespace and
• Not using XML syntax import/include
• No support for namespace • More data types
• Very limited for reusability and • Able to create complex data type by
extensibility inheritance
• Inheritance by extension or restriction
XML Schema
An XML Schema:

• defines elements that can appear in a document


• defines attributes that can appear within elements
• defines which elements are child elements
• defines the sequence in which the child elements can appear
• defines the number of child elements
• defines whether an element is empty or can include text
• defines default values for attributes

The purpose of a Schema is to define the legal building blocks of an


XML document, just like a DTD.
XML Schema – Better than DTDs

XML Schemas

➢ are easier to learn than DTD


➢ are extensible to future additions
➢ are richer and more useful than DTDs
➢ are written in XML
➢ support data types
XML Schema Components

◼ Abstract Data Model


◼ Simple and Complex Type Definitions
◼ Declarations
XML Abstract Data Model

• The XML Abstract Data Model


– composes of Schema Components.
– is used to describe XML Schemas.
• Schema Component
– is the generic term for the building blocks that
compose the abstract data model of the schema.
13 Kinds of Schema Components

• Simple type definitions ◼ Annotations


• Complex type definitions ◼ Model groups
• Attribute declarations ◼ Particles
Wildcards


Element declarations
◼ Attribute Uses

• Attribute group definitions


• Identity-constraint definitions
• Model group definitions
• Notation declarations
XML document & XML Schema

•XML Document •XML Schema


•(.xml) •(.xsd)
•Declaration
•… •Type Definition

•Information •Elements
•Items •Attributes
Declaration & Definition

• Declaration Components
– are associated by (qualified) names to
information items being validated.
– It is like declaring objects in OOP.
• Definition Components
– define internal schema components that can be
used in other schema components.
– Type definition is like defining classes in OOP.
Type Definitions

• Why Type Definitions?


• Simple Type Definition VS. Complex Type Definition

•Simple Type • Attributes & Elements


•Definition without element children

•Complex Type • Elements


•Definition
Simple Type Definition

• Simple Type Definition can be:


– a restriction of some other simple type;
– a list or union of simple type definition;or
– a built-in primitive datatypes.
• Example
•<xs:simpleType name="farenheitWaterTemp">
• <xs:restriction base="xs:number">
• <xs:fractionDigits value="2"/>
• <xs:minExclusive value="0.00"/>
• <xs:maxExclusive value="100.00"/>
• </xs:restriction>
•</xs:simpleType>

Complex Type Definition

• Inheritance
Each complex type definition is either
– a restriction of a complex type definition
– an extension of a simple or complex type definition
– a restriction of the ur-type definition.
• Example
•<xs:complexType name="personName"> •<xs:complexType name="extendedName">
• <xs:sequence> • <xs:complexContent>
• <xs:extension base="personName">
• <xs:element name="title" • <xs:sequence>
•… …
minOccurs="0"/> • <xs:element name="generation"
• </xs:sequence> • minOccurs="0"/>
• </xs:sequence>
•</xs:complexType> • </xs:extension>
• </xs:complexContent>
•</xs:complexType>
An XML Instance Document Example

<book ISBN = "0836">


<title> INTERNET AND WORLD WIDE WEB</title>
<author>Charles M</author>
<qualification> Extroverted beagle </qualification>
</book>
The Example’s Schema

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


<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="book">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="author" type="xs:string"/>
<xs:element name=“qualification“ type=“xs:string”/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

•book.xsd
XML Schema
Reusability and Conformance

◼ XML Schema Reusability


◼ XML Schema Conformance
Building Reusable XML Schema

• Two mechanisms
– Including and Redefining existing XML
Schemas components in an XML Schema
definition
– Extending or Restricting existing data types in
an XML Schema definition
Building Reusable XML Schema- (1)

• xs:include • xs:redefine
– Similar to a copy and paste – Similar to xs:include
of the included schema – except that it lets you
– The calling schema doesn't redefine declarations from
allow to override the the included schema.
definitions of the included
schema.
Conformance Example: note.xml and note.xsd
•<?xml version="1.0"? >
•<note timestamp=“2002-12-20”>
• <to>Dove</to>
• <from>Jani</from>
• <heading>Reminder</heading>
• <body>Don't forget me this weekend!</body>
•</note>
•<?xml version="1.0"?>
•<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" >
•<xs:element name="note">
• <xs:complexType>
• <xs:sequence>
• <xs:element name="to" type="xs:string"/>
• <xs:element name="from" type="xs:string"/>
• <xs:element name="heading" type="xs:string"/>
• <xs:element name="body" type="xs:string"/>
• </xs:sequence>
• <xs:attribute name=“timestamp” type=“xs:date” />
• </xs:complexType>
•</xs:element>
•</xs:schema>
XML Parsers

• Every XML application is based on a parser


• Two types of XML documents:
– Well-formed:if it obeys the syntax of XML
– Valid:if it conforms to a proper definition of legal
structure and elements of an XML document
• Two types of XML Parsers:
– Non-validating
– Validating
Two Ways of Interfacing XML Documents with
XML Applications

• Object-based: DOM • Event-based: SAX (Simple


(Document Object API for XML)
Model) – Originally a Java-only API.
– Specified by W3C – Developed by XML-DEV
– Tree is built mailing list community
– The parser loads the – No tree is built
XML doc into computer – The parser reads the file
memory and builds a tree and triggers events as it
of objects for all elements finds elements/attribute/text
& attributes in the XML doc
Available XML Schema-supported Parsers

• Apache® Xerces 2 Java/C++ free


– Validating/Non-validating
– DOM and SAX
• Microsoft® XML Parser 4.0 free
– DOM and SAX
• TIBCO® XML Validate commercial
– SAX-based implementation
• SourceForge.net® JBind 1.0 free
– A data binding framework linking Java and XML
• And many many more…
•What is XML Software Development
process?
1. Begin with developing content model using XML
Schema or DTD

2. Edit and validate XML documents according to the content


model

3. Finally, the XML document is ready to be used or processed by


an XML enabled framework
What is XML Software Development
process?

•The xml software development process


•Xml schema enable translations from XML documents to
databases.
XML Integrated Development Environments
(IDE) -1

•Microsoft Visual
studio
•.NET
• XML
IDE
•Data base
•WEB
•Programming
DEVELOPMENT
TOOLS
•Java
programming
tools •XML IDE provides comprehensive XML
development support and complements
other software development tools
XSL
eXtensible Stylesheet Language

XSLT
What is XSL?
◼ XSL stands for Extensible Stylesheet Language
◼ CSS was designed for styling HTML pages, and can be used to
style XML pages
◼ XSL was designed specifically to style XML pages, and is
much more sophisticated than CSS
◼ XSL consists of three languages:
◼ XSLT (XSL Transformations) is a language used to transform XML
documents into other kinds of documents (most commonly HTML, so
they can be displayed)
◼ XPath is a language to select parts of an XML document to transform
with XSLT
◼ XSL-FO (XSL Formatting Objects) is a replacement for CSS
◼ There are no current implementations of XSL-FO, and we won’t cover it

2
How does it work?
◼ The XML source document is parsed into an XML
source tree
◼ You use XPath to define templates that match parts of
the source tree
◼ You use XSLT to transform the matched part and put
the transformed information into the result tree
◼ The result tree is output as a result document
◼ Parts of the source document that are not matched by a
template are typically copied unchanged

3
Simple XPath

◼ Here’s a simple XML document: ◼ XPath expressions look


<?xml version="1.0"?> a lot like paths in a
<library> computer file system
<book>
<title>XML</title> ◼ / means the document
<author>Gregory Brill</author> itself (but no specific
</book> elements)
<book> ◼ /library selects the root
<title>Java and XML</title> element
<author>Brett McLaughlin</author> ◼ /library/book selects
</book> every book element
</library > ◼ //author selects every
author element,
wherever it occurs

4
Simple XSLT
◼ <xsl:for-each select="//book"> loops through every
book element, everywhere in the document

◼ <xsl:value-of select="title"/> chooses the content of


the title element at the current location

◼ <xsl:for-each select="//book">
<xsl:value-of select="title"/>
</xsl:for-each>
chooses the content of the title element for each book
in the XML document

5
Using XSL to create HTML
◼ Our goal is to turn this: ◼ Into HTML that displays
<?xml version="1.0"?> something like this:
<library>
<book> Book Titles:
<title>XML</title>
<author>Gregory Brill</author>
• XML
</book> • Java and XML
<book> Book Authors:
<title>Java and XML</title> • Gregory Brill
<author>Brett McLaughlin</author> • Brett McLaughlin
</book>
</library >
▪ Note that we’ve grouped
titles and authors
separately
6
What we need to do
◼ We need to save our XML into a file (let’s call it
books.xml)
◼ We need to create a file (say, books.xsl) that describes
how to select elements from books.xml and embed
them into an HTML page
◼ We do this by intermixing the HTML and the XSL in the
books.xsl file
◼ We need to add a line to our books.xml file to tell it to
refer to books.xsl for formatting information

7
books.xml, revised
◼ <?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="books.xsl"?>
<library>
<book>
<title>XML</title> This tells you where
<author>Gregory Brill</author> to find the XSL file
</book>
<book>
<title>Java and XML</title>
<author>Brett McLaughlin</author>
</book>
</library >

8
Desired HTML
<html>
<head>
<title>Book Titles and Authors</title>
</head>
<body> Blue text is data extracted
<h2>Book titles:</h2> from the XML document
<ul>
<li>XML</li>
<li>Java and XML</li> Brown text is our
</ul>
<h2>Book authors:</h2> HTML template
<ul>
<li>Gregory Brill</li>
<li>Brett McLaughlin</li> We don’t necessarily
</ul> know how much data
</body>
</html>
we will have

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

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

<html> ... </html>

</xsl:template>
</xsl:stylesheet>

10
Selecting titles and authors

<h2>Book titles:</h2>
<ul>
<xsl:for-each select="//book">
<li> Notice the
<xsl:value-of select="title"/> xsl:for-each
</li> loop
</xsl:for-each>
</ul>
<h2>Book authors:</h2>
...same thing, replacing title with author
▪ Notice that XSL can rearrange the data; the HTML result
can present information in a different order than the XML

11
All of books.xml
◼ <?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="books.xsl"?>
<library>
<book>
<title>XML</title>
<author>Gregory Brill</author>
</book>
<book>
<title>Java and XML</title>
<author>Brett McLaughlin</author>
</book>
</library > Note: if you do View Source,
this is what you will see, not the
resultant HTML
12
All of books.xsl

<?xml version="1.0" encoding="ISO-8859-1"?> <h2>Book authors:</h2>


<xsl:stylesheet version="1.0" <ul>
xmlns:xsl="http://www.w3.org/1999/ <xsl:for-each
XSL/Transform"> select="//book">
<xsl:template match="/">
<html> <li>
<head> <xsl:value-of
<title>Book Titles and Authors</title> select="author"/>
</head> </li>
<body> </xsl:for-each>
<h2>Book titles:</h2> </ul>
<ul> </body>
<xsl:for-each select="//book"> </html>
<li> </xsl:template>
<xsl:value-of select="title"/>
</li> </xsl:stylesheet>
</xsl:for-each>
</ul>

13
How to use it
◼ In a modern browser you can just open the XML
file
◼ Older browsers will ignore the XSL and just show you
the XML contents as continuous text
◼ You can use a program such as Xalan, MSXML,
or Saxon to create the HTML as a file
◼ This can be done on the server side, so that all the client
side browser sees is plain HTML
◼ The server can create the HTML dynamically from the
information currently in XML

14

You might also like