Transcript XML

XML
1
© Netskills Quality Internet Training, University of Newcastle
What is XML?



"eXtensible Markup Language"
New development in web creation
Overcomes limitations of HTML





2
small number of tags
limited features
several versions of the language
XML allows you to create your own tags
Separates content from presentation
© Netskills Quality Internet Training, University of Newcastle
SGML, HTML and XML

SGML




HTML


created using SGML for web delivery
XML


3
Standard Generalised Markup Language
ISO standard since 1986
complex but widely used "meta-language"
a simplified version of SGML for users to
create their own 'markup language'
not just a new version of HTML, a different
concept
© Netskills Quality Internet Training, University of Newcastle
Creating XML
Processing instruction
<?xml version="1.0"?>
<library>
Tags - "elements"
<book>
<author>
<firstname>Bill</firstname>
<lastname>Bryson</lastname>
</author>
<booktitle>Notes From a Small
Island</booktitle>
<publisher>Transworld</publisher>
</book>
</library>
4
© Netskills Quality Internet Training, University of Newcastle
More XML Markup




Empty elements <curtainup/>
Attributes <book section="short loan">
Special characters &lt; &#8478;
Comments <!-- some text -->
Data sections
<![CDATA[
*a = &b;
c = (d<=3);
]]>

5
© Netskills Quality Internet Training, University of Newcastle
Using Style with XML

Cascading Style Sheets (CSS) for simple
web presentation
booktitle {
margin-left: 10%;
font-weight: bold;
}



Present in multiple formats - print, audio...
XSL eXtensible Style Language
Transformations of XML

6
e.g. reorder elements
© Netskills Quality Internet Training, University of Newcastle
XSL Transformations
XSL commands
<H1>
<xsl:for-each select="library/book"
order-by="author/lastname">
<xsl:value-of
select="author/lastname"/>
XML elements
</xsl:for-each>
</H1>
HTML template for formatting
7
© Netskills Quality Internet Training, University of Newcastle
Uses of XML


Creating web pages - better structure
Improved indexing and searching
www.goxml.com/
www.w3.org/XML/



8
Simple "database" functionality - organising and
manipulating data "fields" within the page
Configuring/manipulating information at client presenting information in different ways to different
users
"E-business" - business to business transactions,
passing of tailored information e.g. inventory,
ordering etc
© Netskills Quality Internet Training, University of Newcastle
Linking Developments
XLink
 Multiple destinations for a link
 Different presentations of a linked resource



replace existing page with new (as now)
embedded in existing page
display in new window
XPointer
 Replaces internal anchor

9
Jump to any XML element within document
© Netskills Quality Internet Training, University of Newcastle
XHTML: HTML in XML

Preparing HTML for use in XML
browsers

HTML defined in XML
Must close all tags <p> </p> or <p/>
 Tags in lower case
 Quote attribute values src="logo.gif"
 validate/correct documents
www.w3.org/People/Raggett/tidy

10
© Netskills Quality Internet Training, University of Newcastle
Browser Compatibility
Support for XML and CSS in common
browsers:
 Netscape 4 - no XML, moderate CSS
 IE4 - partial XML, reasonable CSS
 IE5 - good XML and CSS
 XML viewers available (special browers or
plug-ins)
 Server can change XML to HTML before
delivery
11
© Netskills Quality Internet Training, University of Newcastle
XML Applications
XML is well established in some areas e.g.
MathML (Mathematics Markup Language)
<expr>
<mci>x</mci>
<power/>
<mcn>2</mcn>
</expr>
<plus/>
<mcn>4</mcn>
12
© Netskills Quality Internet Training, University of Newcastle
x2+4
XML Applications
MathML (Mathematics Markup Language)
www.w3.org/TR/REC-MathML
CML (Chemical Markup Language)
www.venus.co.uk/omf/cml/
RDF (Resource Description Framework)
www.w3.org/RDF/
SMIL (Synchronised Multimedia Integration Language)
www.w3.org/TR/1998/PR-smil-19980409/
MusicML
www.tcf.nl/trends/trends6-en.html
CFML (Cold Fusion, for database integration)
www.allaire.com/documents/cf45docs/
acrobatdocs/45refcard.pdf
13
© Netskills Quality Internet Training, University of Newcastle
References
W3Cs XML HomePage
www.w3.org/XML/
XML Homepage
www.xml.com
XML FAQ
www.ucc.ie/xml
Ariadne web articles
www.ariadne.ac.uk/issue16/what-is/
14
© Netskills Quality Internet Training, University of Newcastle