14. XML applications Generally: An XML application is one where the - - PowerPoint PPT Presentation

14 xml applications
SMART_READER_LITE
LIVE PREVIEW

14. XML applications Generally: An XML application is one where the - - PowerPoint PPT Presentation

14. XML applications Generally: An XML application is one where the essential data are represented and processed as well-formed XML documents. Usually the following conditions hold: A DTD or schema is attached to documents, defining


slide-1
SLIDE 1

XML-14 J. Teuhola 2013 263

  • 14. XML applications
  • Generally: An XML application is one where the

essential data are represented and processed as well-formed XML documents.

  • Usually the following conditions hold:

– A DTD or schema is attached to documents, defining the vocabulary (elements, attributes), and restricting the hierarchies of elements. – A unique namespace is specified. – One or more processors are written, defining the meaning of the elements (operational semantics).

  • According to this definition, even XSLT and

XSL-FO are XML applications.

slide-2
SLIDE 2

XML-14 J. Teuhola 2013 264

14.1. XHTML

  • XHTML = Extensible Hypertext Markup

Language: Web page description language, processed (interpreted) by web browsers.

  • Roughly speaking, XHTML = well-formed HTML

– Matching start and end tags – XML-style prolog: <?xml version=”1.0”?>

<!DOCTYPE html PUBLIC ”-//W3C//DTD XHTML 1.0 Strict//EN” ”http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

– Case-sensitive: elements and attributes in lowercase

  • Allows inclusion of other XML-based languages

with namespaces.

slide-3
SLIDE 3

XML-14 J. Teuhola 2013 265

14.2. Office Open XML (OOXML, OpenXML)

  • An XML-based file format for representing office

documents like (rich) text, spreadsheets, slide presentations, etc.

  • Several sublanguages (27 namespaces!), e.g.

– WordprocessingML for word-processing – SpreadsheetML for spreadsheets – PresentationML for presentations

  • Adopted by Microsoft in Office 2007
  • An OOXML document file contains various XML files

compressed within a zip package.

  • The Office Open XML format specification is a free, open

standard by Ecma international in 2006; after some revision an ISO/IEC standard in Nov 2008.

slide-4
SLIDE 4

XML-14 J. Teuhola 2013 266

14.3. MathML – Mathematical Markup Language

  • Meant for showing mathematical formulas on web pages
  • Different from Office MathML (OMML) but similar
  • Formulas were earlier presented as gif-images, which

are not editable.

  • Browsers may need a plugin or applet to be able to show

MathML (Firefox understands MathML).

  • Manual writing of MathML is tedious – formula editors

exist which enable output in MathML.

  • Example:

a ac b b x 2 4

2 −

± − =

slide-5
SLIDE 5

XML-14 J. Teuhola 2013 267

MathML example code

<xml version=”1.0”> <!DOCTYPE … > <math> <mrow> <mi>x</mi> <mo>=</mo> <mfrac> <mrow> <mo>-</mo> <mi>b</mi> <mo>&PlusMinus; </mo> <msqrt> <mrow> <msup> <mi>b</mi> <mn>2</mn> </msup> <mo>-</mo> <mn>4</mn> <mi>a</mi> <mi>c</mi> </mrow> </msqrt> </mrow> <mrow> <mn>2</mn> <mi>a</mi> </mrow> </mfrac> </mrow> </math>

slide-6
SLIDE 6

XML-14 J. Teuhola 2013 268

14.4. SMIL – Synchronized Multimedia Integration Language

  • Language for describing audiovisual

presentations; well readable, easy to learn

  • W3C standard; to be coupled with XHTML
  • ”Internet counterpart to Powerpoint”.
  • Showing with a ”player” (e.g. Ambulant)
  • Multiple media types (text, image, video, audio).
  • Multiple files can be shown simultaneously.
  • Typical structure:

– Head part defines the regions on the screen – The body declares the media components: source files, positioning, timing.

slide-7
SLIDE 7

XML-14 J. Teuhola 2013 269

SMIL element types

  • Timing elements:

<excl> = exclusive display, <par> = parallel display, <seq> = display in sequence

  • Timing attributes:

begin=start time, dur=duration, endsync= synchronized stopping of parallel elements, repeatcount

  • Media elements:

<text>, <image>, <video>, <audio>, <animation>, etc.

slide-8
SLIDE 8

XML-14 J. Teuhola 2013 270

SMIL sample code

<!-- Document prolog to be added --> <smil> <head> <layout> <root-layout width=”640” height=”480” background-color=”#000000”/> <region id=”background” width=”600” height=”440” left=”20” top=”20” z-index=”0”/> <region id=”image-region” width=”300” height=”440” left=”20” top=”20” z-index=”1”/> <region id=”text-region” width=”300” height=”440” left=”320” top=”20” z-index=”1”/> … </layout>

slide-9
SLIDE 9

XML-14 J. Teuhola 2013 271

SMIL sample code (cont.)

<body> <par> <audio src=“audio.mp3" begin="0" dur="10s" /> <img region=”image-region” src=”fig.gif” begin=”2s” dur=”10s”/> <seq id=”captions”> <text src=”cap1.txt” region=”text-region” begin=”2s” dur=”4s”/> <text src=”cap2.txt” region=”text-region” dur=”4s”/> </seq> </par> </body> </smil>

slide-10
SLIDE 10

XML-14 J. Teuhola 2013 272

14.5. SVG = Scalable Vector Graphics

  • Language for describing 2D graphics in XML
  • W3C recommendation 2001
  • Basic graphics types: line, polyline, polygon, path,

circle, ellipse, rect

  • Vector graphics, images, and text can be grouped and

styled.

  • Features: masks, filters, transformations, animations.
  • Suitable e.g. for online maps to plot roads, buildings, etc.
  • Different from DrawingML language in Office Open

XML, but SVG can be converted to DrawingXML.

slide-11
SLIDE 11

XML-14 J. Teuhola 2013 273

SVG sample code

<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-flat-20030114.dtd"> <svg xmlns="http://www.w3.org/2000/svg“ version="1.1" baseProfile="full"> <g stroke="black" stroke-width="0.1cm"> <rect x="2cm" y="2cm" width="14cm" height="8cm" fill="white" /> </g> <g> <rect x="2cm" y="5cm" width="14cm" height="2cm" fill="blue" /> <rect x="6cm" y="2cm" width="2cm" height="8cm" fill="blue" /> </g> </svg>

slide-12
SLIDE 12

XML-14 J. Teuhola 2013 274

14.6. Web services

  • Web services are applications that can communicate

with other applications using standard protocols (http)

  • ver the Internet.
  • In a communication activity, one application

acts as a client, and another as a server. The action can be like a remote procedure call.

  • The transmitted data is in XML form.
  • Web services are based on 3 open standards:

– SOAP = Simple Object Access Protocol – WSDL = Web Services Description Language – UDDI = Universal Description, Discovery & Integration

  • Tutorial by Anders Møller and Michael Schwartzbach

http://www.brics.dk/~amoeller/WWW/webservices/index.html

slide-13
SLIDE 13

XML-14 J. Teuhola 2013 275

SOAP - Simple Object Access Protocol

  • SOAP is a simple exchange protocol, using e.g.

HTTP or FTP in transmission.

  • Messages are encoded in XML using a standard

schema.

  • SOAP-messages are one-directional, but

typically grouped into request & response pairs.

  • Parts of SOAP standard:

– Definition of the SOAP envelope (header + body) – Definition of encoding of objects – Definition of remote procedure calls (RPC) – HTTP binding

slide-14
SLIDE 14

XML-14 J. Teuhola 2013 276

WSDL - Web Services Description Language

  • WSDL is an XML-based language for describing

web (SOAP) services.

  • A WSDL document tells the URI-address,

methods, and call parameters of the (SOAP)

  • service. Five main parts:

– types defines the data types used – message defines the message(s) to be transmitted – portType defines the operations supported – binding defines a.o. presentation formats – service specifies ports of web addresses

slide-15
SLIDE 15

XML-14 J. Teuhola 2013 277

UDDI - Universal Description, Discovery & Integration

  • Problem: How do application developers know about

existing WSDL documents?

  • UDDI is a public directory of the services (’machine-

accessible yellow pages’)

  • Technically, UDDI is an interface for searching for web

services from a central register.

  • Selection conditions can be given to restrict the search.
  • Private, intra-organization net services do not have to be

registered, even if SOAP and WSDL were used locally.

  • A global UDDI has not emerged – enterprise-level UDDI

is rather popular.

slide-16
SLIDE 16

XML-14 J. Teuhola 2013 278

14.7. Semantic Web

  • Goal: machine-understandable semantics
  • ’Smart data’ = data + various kinds of metadata
  • Tools: conceptual models and logics, taxonomies,

thesauri, associations, rules, etc.

  • Semantic web approaches with XML syntax:

– RSS (“Really Simple Syndication”): popular way of describing and sharing online, dynamic web content. – RDF (“Resource Description Framework”): markup language for describing information and resources on the web; developed by W3C. – OWL (“Ontology Web Language” ): builds on RDF; more expressive.

slide-17
SLIDE 17

XML-14 J. Teuhola 2013 279

Conclusion

  • XML has gained a strong status as a universal formalism
  • f marking up almost any kind of character-based

information.

  • The XML domain involves

– a few general core technologies (such as XML Schemas, XSLT, XLink, XPath, XQuery, DOM, SAX) – quite a large number of commonly agreed application schemes, – an uncountable number of locally defined ways of usage; including the exercise projects of this study module!!

End of slides