1 / 52

Learning Outcome

EEC4113 Data Communication & Multimedia System Chapter 10: Presentation Layer – Data Formatting by Muhazam Mustapha, November 2011 and contributions by class members, October 2010. Learning Outcome.

shanon
Download Presentation

Learning Outcome

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. EEC4113Data Communication &Multimedia SystemChapter 10: Presentation Layer – Data Formattingby Muhazam Mustapha, November 2011and contributions by class members, October 2010

  2. Learning Outcome • By the end of this chapter, students are expected to be able to understand formatting of data especially with XML standard

  3. Chapter Content • ASN.1 Data Formatting • XML • XML Based Language • XML Based Data

  4. ASN.1 Data Formatting CO1

  5. Data Formatting • Presentation layer lies between application and session layer • Application layer deals with human readable data • Presentation layer is responsible to convert the data into more machine readable for lower layers CO1

  6. Data Formatting Not only handling the conversion between application and the lower layers, presentation layer also needs to handle the different platforms exist at application layer e.g. MS Windows, Linux, Solaris, VAX Conversion of data among, and, from these platforms should comply to the standards in the lower layers CO1

  7. Abstract Syntax Notation One Abstract Syntax Notation One (ASN.1) was the earliest work done on standardization of data format Only define the abstract syntax but does not restrict the way of doing encoding ASN.1 defines a general rule of formatting and a few specific rules CO1

  8. ASN.1 General Rules Looks like C syntax Example: FooProtocol DEFINITIONS ::= BEGIN FooQuestion ::= SEQUENCE { trackingNumber INTEGER, question IA5String } FooAnswer ::= SEQUENCE { trackingNumber INTEGER, answer BOOLEAN } END Example of use: myQuestion FooQuestion ::= { trackingNumber 5, question "Anybody there?" } myAnswer FooAnswer ::= { trackingNumber 6, answer False } CO1

  9. ASN.1 Specific Rules Basic Encoding Rules (BER) Canonical Encoding Rules (CER) Distinguished Encoding Rules (DER) XML Encoding Rules (XER) Packed Encoding Rules (PER) Generic String Encoding Rules (GSER) CO1

  10. Basic Encoding Rules (BER) Has 2 subsets: CER, DER DER states data size, CER puts end of data marker DER Example (from previous slide): 30 -- tag indicating SEQUENCE 13 -- length in octets 02 -- tag indicating INTEGER 01 -- length in octets 05 -- value 16 -- tag indicating IA5String 0e -- length in octets 41 6e 79 62 6f 64 79 20 74 68 65 72 65 3f -- value ("Anybody there?" in ASCII) CO1

  11. XML Encoding Rules (XER) Makes use of XML standard Example (from previous slide): <FooProtocol> <FooQuestion> <trackingNumber>5</trackingNumber> <question>Anybody there?</question> </FooQuestion> <FooAnswer> <trackingNumber>6</trackingNumber> <answer>False</answer> </FooAnswer> </FooProtocol> CO1

  12. Packed Encoding Rules (PER) More packed (compressed) version of BER It is used if limiting values of data is known No. bits for data can be limited to cover just the range of value CO1

  13. Generic String Encoding Rules Version of ASN.1 that uses human readable text format Used only in LDAP (Lightweight Directory Access Protocol) for publishing distributed computing services CO1

  14. Extensible Markup Language (XML) CO1

  15. Impact of WWW ASN.1 remains as machine to machine data transfer standard Even though ASN.1 can be sent as XML (XER) but the two have no direct common predecessor – they more like hybrid ASN.1 is still not human readable enough But XML is, hence XML is more popular for the web CO1

  16. Impact of WWW The plain text format of XML has both flavors – human and machine readability Human can easily read XML from its tags, attributes and values Machines have been equipped with an enormous no. APIs to handle XML the nature of XML makes it easy to write APIs for it CO1

  17. SGML vs XML vs HTML SGMLStandard Generalized Markup Language Simplified,keep most useful features,applied to data transfer Simplified,loosen rules,applied to web layout definition Re-tighten rules,not forgiving,not popular XMLExtensible Markup Language HTMLHypertext Markup Language XHTMLExtensible Hypertext Markup Language XML-defined Language XML-formatted Data Mozilla’s XUL GIS’s GML Microsoft’s XAML Google’s KML MathML SVG . . . . . . CO1

  18. Common Misconceptions XML and HTML are the same Not true – XML and HTML may just look the same XML tags are user defined HTML tags are fixed standard XML is just another kind of web page Not true – HTML is for web, XML is for data transfer CO1

  19. XML Structure XML consists of tags bounded data There will be pairs of tags: Opening tags: <tagname> Closing tags: </tagname> Values (content) of XML elements are denoted by a pair of opening and closing tags: <distance>50</distance> CO1

  20. XML Structure Some tags are defined not to have value: <empty /> Tags can have attributes to tell some properties of the content: <distance unit="km" >50</distance> attribute unit tells that the value of distance is in “km” CO1

  21. XML Structure Data in XML file are arranged hierarchically – nested <car> <brand>Proton</brand> <model>Waja</model> <spec> <capacity unit="cc">1200</capacity> <door>4</door> </spec> </car> CO1

  22. Support Document XML file needs a separate file to define the tags’ values and attribute The link to the support file is given some where at the top of the XML file Two most popular ways to define XML tags: DTD (Document Type Definition) XSD (XML Schema Document) CO1

  23. Support Document DTD example: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE people_list SYSTEM "example.dtd"> <people_list> <person> <name>Fred Bloggs</name> <birthdate>2008-11-27</birthdate> <gender>Male</gender> </person> </people_list> example.dtd: <!ELEMENT people_list (person)*> <!ELEMENT person (name, birthdate?, gender?, socialsecuritynumber?)> <!ELEMENT name (#PCDATA)> <!ELEMENT birthdate (#PCDATA)> <!ELEMENT gender (#PCDATA)> <!ELEMENT socialsecuritynumber (#PCDATA)> CO1

  24. Support Document XSD example: <?xml version="1.0"?> <p xsi:noNamespaceSchemaLocation="example.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> Hello world! </p> example.xsd: <?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="p" type="xsd:string"/> </xsd:schema> CO1

  25. XML Defined Language CO1

  26. XML Defined Language There are hundreds of languages defined using XML along side with its own XSD The language defines its own set of tags Normally the languages can work with JavaScript Examples: Scalable Vector Graphics (SVG) XUL (XML User Interface Language) XAML (Extensible Application Markup Language) CO1

  27. SVG Vector graphic image for web pages Defines resolution free drawing objects Created by Adobe Besides vector graphics, it also provides support for: Embedded raster image Text Printing Gradients Filter More details in PBL CO1

  28. XUL XUL or XML user interface markup language is an upgrade version of XML It was develop by the Mozilla project – intended to develop a way to design a desktop application with web programming technology XUL Slides contributed by: MUHAMMAD AZIZOL BIN AMINUDDIN,MOHAMAD JAMAL BIN KAMARUDIN CO1

  29. XUL History: CO1

  30. XUL XUL is not a programming language but a markup language Any programming feature required, can be included as JavaScript Can be viewed on Mozilla Gecko layout engine such as FireFox and Flock Can be standalone application XUL is part of (Cross Platform Front End) XPFE family CO1

  31. XUL Example: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="hello_world" title="Hello World Example by Jamal and Azizol" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <box> <button id="Hello World!" label="Hello World!"/> </box> </window> CO1

  32. XAML XAML stands for eXtensible Application Markup Language It function as HTML for Windows applications, but it is really quite a bit more expressive and powerful XAML is used extensively in .NET Framework 3.0 & .NET Framework 4.0 technologies, particularly Windows Presentation Foundation(WPF), Silverlight, and Windows Workflow Foundation(WF). XAML Slides contributed by: MUHAMAD SAFWAN BIN ZAMRI,KRITHARAN A/L SUPRNIOM CO1

  33. XAML A XAML file can be compiled into a .baml (Binary XAML) file, which may be inserted as a resource into a .NET Framework assembly. When used in Windows Presentation Foundation, XAML is used to describe visual user interface CO1

  34. XAML WPF allows for the definition of both 2D and 3D objects, rotations, animations, and a variety of other effects and features. XAML can’t be embedded in HTML. CO1

  35. XAML Silverlight Example: Silverlight project CO1

  36. XAML The given default Page.xaml code (added 1 line of code): <Canvas x:Name="parentCanvas" xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Loaded="Page_Loaded" x:Class="SilverlightProject1.Page;assembly= ClientBin/SilverlightProject1.dll" Width="640" Height="480" Background="White"> <TextBlock Text="Hello World" FontSize="50"/> </Canvas> Added line CO1

  37. XAML Output: CO1

  38. XML Formatted Data CO1

  39. XML Formatted Data The data is defined by a set of XML tags and XSD The limit and type of data depends on application and vendor Example: MathML GML (Geography Markup Language) KML (Google Map’s Keyhole Markup Language) CO1

  40. MathML Option for writing complex mathematical expression on web pages Defines mathematical expression as structures Proposed by W3C More details in PBL CO1

  41. GML Geography Markup Language A modeling language and an encoding for geographic information Designed for the web and web-based services An XML encoding for the transport Storage of geographic information, including the geometry and the properties of geographic features between distributed systems. GML Slides contributed by: NORZHAFRE HAZWAN BIN ZAINUDIN,EMMA EMELIA BINTI BARHATH ALI CO1

  42. GML Based on XML technologies (W3C) Implements concepts of the ISO 19100 series Supports spatial and non-spatial properties of objects Open and vendor-neutral and extensible Supports the definition of profiles (proper subsets) of the full GML capabilities CO1

  43. GML • Modeling feature types Road name I95 class Interstate centerLine gml:Curve maintainer DOT xyz Building an information community  reaching consensus about the vocabulary (feature types and their properties) CO1

  44. GML Geospatial Web Information Communities publish their Application Schemas (preferably in some sort of registry) so that it can be found, accessed and understood by others This enables that also the features can have properties whose values are maintained by other authorities a web of geospatial features is created Roads Parcels Traffic Messages Administrative Boundaries Buildings CO1

  45. GML Examples: Slide from Galdos Inc. SVG Views GML Data y-plane Solid Model in VRML z-plane x-plane CO1

  46. GML • Example (test.gml): <?xml version="1.0" encoding="UTF-8"?> <gml:FeatureCollection xmlns:gml="http://www.opengis.net/gml"> <gml:featureMember> <LAYER> <attrib1>attrib1_value</attrib1> <attrib2container> <attrib2>attrib2_value</attrib2> </attrib2container> <location1container> <location1> <gml:Point> <gml:coordinates>3,50</gml:coordinates> </gml:Point> </location1> </location1container> <location2> <gml:Point> <gml:coordinates>2,49</gml:coordinates> </gml:Point> </location2> </LAYER> </gml:featureMember> </gml:FeatureCollection> CO1

  47. GML • Associated .gfs: <GMLFeatureClassList> <GMLFeatureClass> <Name>LAYER</Name> <ElementPath>LAYER</ElementPath> <GeometryElementPath>location1container|location1</GeometryElementPath> <PropertyDefn> <Name>attrib1</Name> <ElementPath>attrib1</ElementPath> <Type>String</Type> <Width>13</Width> </PropertyDefn> <PropertyDefn> <Name>attrib2</Name> <ElementPath>attrib2container|attrib2</ElementPath> <Type>String</Type> <Width>13</Width> </PropertyDefn> </GMLFeatureClass> </GMLFeatureClassList> CO1

  48. GML • The output of ogrinfo test.gml -ro -al is Layer name: LAYER Geometry: Unknown (any) Feature Count: 1 Extent: (3.000000, 50.000000) - (3.000000, 50.000000) Layer SRS WKT: (unknown) Geometry Column = location1container|location1 attrib1: String (13.0) attrib2: String (13.0) OGRFeature(LAYER):0 attrib1 (String) = attrib1_value attrib2 (String) = attrib2_value POINT (3 50) CO1

  49. KML Keyhole Markup Language Keyhole Markup Language (KML) is an XML-based language schema for expressing geographic annotation and visualization on Internet-based, two-dimensional maps and three-dimensional Earth browsers KML was developed for use with Google Earth, which was originally named Keyhole Earth Viewer KML Slides contributed by: TUAN MOHD KHAIRI BIN TUAN MAT,NIK MOHAMAD RUKMAL HAKIM BIN ROKMAN CO1

  50. KML It was created by Keyhole, Inc, which was acquired by Google in 2004 The name "Keyhole" is an homage to the KH reconnaissance satellites, the original eye-in-the-sky military reconnaissance system first launched in 1976 KML is an international standard of the Open Geospatial Consortium Google Earth was the first program able to view and graphically edit KML files CO1

More Related