Title: Multiple device types
1 Multiple device types
2Technologies
- XML
- XSL
- ASP
- JSP
- WAP, WML
- Java 2 Micro Edition
- Visual Embedded Toolkits
3Example Systems
- Mobile Information Server - Microsoft
- Cocoon APACHE project vendor neutral
4What is XML
- A meta markup language
- A set of rules for creating semantic tags to
structure data - It is made up of Documents, Elements and
attributes
5Example of an XML Document
ltcoursegt ltslide id 003gt lttitlegtExample of
an XML Documentlt/titlegt ltauthorgt John
Byrnelt/authorgt lt/slidegt lt/coursegt
6Some rules
- XML elements are made up of start and end tags
- e.g. lttitlegtExample of an XML Documentlt/titlegt
- An element can contain one or more attributes.
These are name value pairs - e.g.an attribute of the slide element is id
003 - All elements must have an end tag
- All elements must be cleanly nested
- Values are quoted
- Documents have a unique first element
-
An XML Document is an XML element that can but
might not include nested XML elements
7Data Interchange
XML
XML is the Webs language for data interchange
(HTML for rendering) For example databases from
different vendors may exchange information using
XML
8Building XML Applications
- Step 1 Write a DTD
- A Document Type Definition defines
- the tags that can exist in your document.
- The sequence of the tags
- The attributes allowed
- The values associated with attributes
9Example DTD
lt?xml encoding"UTF-8"?gt lt!ELEMENT
address(person)gt lt!ELEMENT person
(name,e-mail)gt lt!ELEMENT name (surname,
first)gt lt!ELEMENT surname (PCDATA)gt lt!ELEMENT
first (PCDATA)gt lt!ELEMENT email (PCDATA)gt
10About the sample
- This DTD says that our address is composed of
one or more people, where each person has a name,
and optional e-mail address. - The name is composed of a surname name, and a
first name. And the content of each of these is
UTF-8 string data.
11The XML Document
- Step 2 is the production of a document
- The Document is generated by filling in the
template described by the DTD with appropriate
values - The values for elements may various sources
including database queries
12Interpreting Documents
- Step 3 Application Programmers Interfaces
(APIs) can be Used to manipulate XML Documents - Two such APIs exist
- The DOM (Document Object Model)
- The SAX (Simple API for XML)
13Displaying XML
- Your browser can display XML ?
- If not then transform the XML into something your
browser can display (such as HTML) XSL
Stylesheets can do this
Result
XML
XSL
14Basic syntax of XML
- In XML, your tags must be properly nested
- In XML, standalone tags, called empty tags, must
have a trailing slash before the closing
angle-bracket. - An XML document must have a single root element,
which surrounds all others. - In XML, attribute values must be quoted.
- XML markup tags are case sensitive.
- Whitespace is relevant between start and end
tags. - XML is extensible and uses a Document Type
Declaration (DTD) to define the allowable grammar
rules for tags and attributes.
15XSL introduction
- Extensible Stylesheet Language
- Has 2 parts
- Formatting Objects
- Transformation Rules (XSLT bit!)
- It provides a presentation language for documents
16XSLT
- For tranforming XML to different targets use the
XSL - Transformations
- It can operate independently of XSL it can
create - transformations without the use of the
formatting - objects
17XSL Processor
Link to stylesheet
XML file
HTML or (depends on Stylesheet used.
HTML or WML or .
XSL file
Result
18Sample Stylesheet file extension .xsl
ltxslstylesheet xmlnsxsl "http//www.w3.org/1999
/XSL/Transform" version"1.0"gt
ltxsloutput method"html"/gt ltxsltemplate
match"/"gt lthtmlgt ltxslapply-templates
select"//book"/gt lt/xsltemplategt ltxsltemplate
match"book"gt This will appear in the result.
lt/xsltemplategt
19XML files Located on server
Tomcat Servlet engine
Cocoon Handles XML
Servlets can use the Cocoon Parser and
manipulate XML documents
Browser requests UML file
20Using IIS
xml
Server
xsl
Multiple devices (HTML WML)
21If ( InStr(testmime,"wml"))Then
xmlDocument.load(Server.MapPath("index.xml")) xsl
Document.load(Server.MapPath("/stylesheets/wmlpage
.xsl")) Response.Write(xmlDocument.transformNod
e(xslDocument))
22Else xmlDocument.load(Server.MapPath("/student/ja
b/index.xml")) xslDocument.load(Server.MapPat
h("/student/jab/stylesheets/webpage.xsl"))
Response.Write(xmlDocument.transformNode(xslDocume
nt)) End If
23 WAP
- HTTP/HTML adjusted to small devices
- Consists of a network architecture,a protocol
stack and a Wireless Markup Language (WML) - For Internet connection a WAP-gateway is required
- Specifications at http//www.wapforum.org
24WAP - INTERNET
WEB SERVER
25 26 WML
- WML based on XML and HTML.
- Not pages of frames, but decks with cards.
- Images WBMP, WAP specific
- Generally all compiled to binary by WAP gateway
Additional area of potential problems.
27 WMLScript
- The WAP Javascript equivalent.
- Located in separate files
- Also compiled by WAP gateway
- Allows automation of WML and phone functions.