14 xml applications
play

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


  1. 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. XML-14 J. Teuhola 2013 263

  2. 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. XML-14 J. Teuhola 2013 264

  3. 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. XML-14 J. Teuhola 2013 265

  4. 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: 2 − − ± b b 4 ac = x 2 a XML-14 J. Teuhola 2013 266

  5. MathML example code <xml version=”1.0”> <mn>2</mn> <!DOCTYPE … > </msup> <math> <mo>-</mo> <mrow> <mn>4</mn> <mi>x</mi> <mi>a</mi> <mo>=</mo> <mi>c</mi> <mfrac> </mrow> <mrow> </msqrt> <mo>-</mo> </mrow> <mi>b</mi> <mrow> <mo>&PlusMinus; <mn>2</mn> </mo> <mi>a</mi> <msqrt> </mrow> <mrow> </mfrac> <msup> </mrow> <mi>b</mi> </math> XML-14 J. Teuhola 2013 267

  6. 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. XML-14 J. Teuhola 2013 268

  7. 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. XML-14 J. Teuhola 2013 269

  8. 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> XML-14 J. Teuhola 2013 270

  9. 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> XML-14 J. Teuhola 2013 271

  10. 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. XML-14 J. Teuhola 2013 272

  11. 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> XML-14 J. Teuhola 2013 273

  12. 14.6. Web services • Web services are applications that can communicate with other applications using standard protocols (http) over 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 XML-14 J. Teuhola 2013 274

  13. 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 XML-14 J. Teuhola 2013 275

  14. 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 XML-14 J. Teuhola 2013 276

  15. 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. XML-14 J. Teuhola 2013 277

  16. 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. XML-14 J. Teuhola 2013 278

Recommend


More recommend