1 / 30

Advanced Multimedia Tech. eXtensible Mark-up Language Part I

Advanced Multimedia Tech. eXtensible Mark-up Language Part I. Prof. A. Taleb-Bendiab Room 605 a.talebbendiab@livjm.ac.uk http://www.cms.livjm.ac.uk/taleb/lectures/cmssem013. So far …. Dr. R. Pereira Module Workplan Schedule. In this Session…. Brief introduction to XML Definitions

Download Presentation

Advanced Multimedia Tech. eXtensible Mark-up Language Part I

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. Advanced Multimedia Tech.eXtensible Mark-up Language Part I Prof. A. Taleb-Bendiab Room 605 a.talebbendiab@livjm.ac.uk http://www.cms.livjm.ac.uk/taleb/lectures/cmssem013

  2. So far … • Dr. R. Pereira Module Workplan Schedule

  3. In this Session… • Brief introduction to XML • Definitions • Examples • XML and DTD • Web applications • Tutorial session in Lab • Exercise • This lecture is based on Mr. Mark Allen Lecture Notes.

  4. Web Page Example

  5. HTML Code <html > <head> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="Microsoft Theme" content="global 101, default"> <meta name="Microsoft Border" content="tlrb, default"> <title>Home Page</title> </head> <body background="../../_themes/global/glotextb.gif" bgcolor="#FFFFCC" text="#510000" link="#999900" vlink="#CC9966" alink="#990066"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td><font face="Arial, Helvetica"> <p align="center"><br> <font size="4" face="Arial">Student Learning Space</font></p> <p align="center"><a href="../Default.htm">Home</a>&nbsp;&nbsp; <a href="../cmssem011/Module%20specification.doc">Module <a href="http://www.cms.livjm.ac.uk/markallen/multi-media.htm">Tutorials</a> <a href="../cmssem011/indicative_references.htm"> Reading List</a></p> <p align="left"><font size="4">Contemporary issues in IT: Distributed Applications and E-Commerce <em>CMSCB3005</em><font size="4" face="Arial">&nbsp;</font></font></p> </html>

  6. Associated XML Code <?xml version="1.0"?>> <?xml-stylesheet type="text/xsl" href="..\xsl\ENR-change-table.xsl"?> <!DOCTYPE Components SYSTEM "Project6.dtd"> <head> <meta name="Microsoft Theme" content="global 101, default"> <title> Student Learning Space </title> </head> <body> <main> <page type=“html” href="../Default.htm"> <headings> <heading 1 href="../cmssem011/Module%20specification.doc"> <heading 2 href="http://www.cms.livjm.ac.uk/markallen/multi-media.htm"> <heading 3 href="../cmssem011/indicative_references.htm"> </headings> </main> </body> </xml>

  7. What is XML? • XML is • an eXtensible Markup Language for describing both structured and unstructured information, which could be usedon the web. • XML documents containing structured information including; • Content: words, pictures (vector graphics), e-commerce transactions, mathematical equations, object meta-data, server APIs, and other XML documents. • XML is a meta-language for defining other markup languages not like HTML or SGML • Unlike Html or SGML it provides; • extensible tag semantics • a facility to define tags and the structural relationships between them. • All of the semantics of an XML document will either be defined by the applications that process them or by stylesheets.

  8. XML System • An XML system consists of • XML Document • The content or information • Document Type Definition (DTD) • The structural definition • Defines the logical structure of the document • A Tree • XML Parser • Checks document for correctness. • Checks the document conforms to the DTD • XML Application • A program that does something useful with XML documents

  9. An Example of XML Document <?xml version = "1.0" ?> <!DOCTYPE RESTAURANTS SYSTEM "restaurant.dtd"> <?xml-stylesheet type="text/xsl" href="srt_restaurant.xsl"?> <!-- Define XSL Stylesheet to be used with current XML Document --> <RESTAURANTS> <RESTAURANT FOOD_GENRE="Chinese"> <NAME>Yin Yang</NAME> <FOOD_RATING>4</FOOD_RATING> <AMBIANCE_RATING>2</AMBIANCE_RATING> <AVERAGE_MEAL_COST>$6</AVERAGE_MEAL_COST> <REVIEW>Great food, but better to order take out than to eat in.</REVIEW> </RESTAURANT> <RESTAURANT FOOD_GENRE="Italian"> <NAME>Little Italy</NAME> <FOOD_RATING>3</FOOD_RATING> <AMBIANCE_RATING>4</AMBIANCE_RATING> <AVERAGE_MEAL_COST>$8</AVERAGE_MEAL_COST> <REVIEW>Romantic setting, great place to go with a date</REVIEW> </RESTAURANT> </RESTAURANTS>

  10. How Is XML Defined? • XML document is defined by a number of related specifications: • Extensible Markup Language (XML) 1.0 • Defining the syntax of XML. • XML Pointer Language (XPointer) and XML Linking Language (XLink) • Defining a standard way to represent links between resources. In addition to simple links, like HTML's <A> tag, XML has mechanisms for links between multiple resources and links between read-only resources. • XPointer describes how to address a resource, • XLink describes how to associate two or more resources. • Extensible Style Language (XSL) • Defines the standard stylesheet language for XML. • XQL -- Defines a standard query language for XML. • XUL -- Defines a standard user-interface language for XML.

  11. XML Markup #1 • Six kinds of markup are used in XML documents: • 1. Elements -- Delimited by angle brackets, most elements identify the nature of the content they surround. • It begins with a start-tag, <element>, and ends with an end-tag, </element>. • Attributes -- Attributes are name-value pairs that occur inside start-tags after the element name. • <div class="preface">is a div element with the attribute class having the value preface. • 2. entity references -- introduce markup into a document, some characters have been reserved to identify the start of markup. • entities are used to represent these special characters. Entities are also used to refer to often repeated or varying text and to include the content of external files. • Entity references begin with the ampersand and end with a semicolon.

  12. XML Markup #2 • For example, the lt entity inserts a literal < into a document. So the string <element> can be represented in an XML document as &lt;element>. • A special form of entity reference, called a character reference, can be used to insert arbitrary Unicode characters into your document. This is a mechanism for inserting characters that cannot be typed directly on your keyboard. • 3. Comments -- begin with <!-- and end with -->. • Comments can contain any data except the literal string. • 4. processing instructions(PIs) -- are an escape hatch to provide information to an application. • Processing instructions have the form: <?name pidata?>. The name, called the PI target, identifies the PI to the application. • 5. CDATA Sections – to instruct the parser to ignore most markup characters. • to prevent xml parser from evaluating a CDATA. • <![CDATA[ *p = &q; b = (i <= 3); ]]> 

  13. XML Markup #3 • Between the start of the section, <![CDATA[ and the end of the section, ]]>, all character data is passed directly to the application, without interpretation. • The only string that cannot occur in a CDATA section is ]]>. • 6. Document Type Declarations • XML allows you to create your own tag names. • DTD enables document to communicate their meta-information to the parser including; • allowed sequence and nesting of tags, • attribute values and their types • defaults, the names of external files that may be referenced • formats of some external (non-XML) data that may be referenced, • the entities that may be encountered.

  14. XML and DTD Syntax XML Syntax DTD Syntax • Elements & nesting • Attributes • XML document • Comments • Unicode • CDATA • Namespace • Processing Instructions • Elements declaration • Content model • Attribute declaration • Entities • - general/parameter • - internal/external • - parsed/unparsed • Notations => Parser sees meaningless element names => Parser differentiates parent-child structure => Application provides semantics

  15. DTD Declaration Examples • A set of rules • define the structure of a document • The DTD can be declared internally or externally <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE group SYSTEM "group.dtd"> <group> </group> <?xml version = "1.0" ?> <!DOCTYPE test [ <!ELEMENT name (#PCDATA)> <!ATTLIST name rating CDATA> ]> <test> </test>

  16. DTD Syntax #1 • <!ELEMENT name (content_model)> • <!ATTLIST name gender CDATA > • <!ENTITY icon SYSTEM “icon.jpg”> • ELEMENT SYNTAX • <!ELEMENT name (content_rule)> • <!ELEMENT name (a,b,c)> • <!ELEMENT name (a|b|c)> • <!ELEMENT name (#PCDATA)> • <!ELEMENT name EMPTY> • <!ELEMENT name ANY> • <!ELEMENT name (a,b?,c+,d*)> • <!ELEMENT name (a|b|c)*>

  17. DTD Syntax #2 • ATTRIBUTE SYNTAX #1 • <!ATTLIST e_name name definitions> • <!ATTLIST e_name name CDATA default> • <!ATTLIST e_name name type (a|b|c) default> • <!ATTLIST e_name name ENTITY default> • <!ATTLIST e_name name NMTOKEN default> • <!ATTLIST e_name name ID default> • Attribute Defaults • #REQUIRED -- Value must be supplied • #IMPLIED -- Value can be left blank • #FIXED -- Value is fixed • Default value supplied.

  18. DTD Syntax #3 • ATTRIBUTE SYNTAX #2 • <!ATTLIST car number CDATA #REQUIRED> • <!ATTLIST person gender CDATA #IMPLIED> • <!ATTLIST person mood CDATA #FIXED “Happy”> • <!ATTLIST car colour (red|green|blue) “green”> • <!ATTLIST car colour CDATA “green”> • ENTITIES • Text Substitution • <!ENTITY author “Mark” • &author; • Reference to external entity. • <!ENTITY picture SYSTEM “mark.jpg”> • &picture;

  19. DTD Syntax #4 • Processing Instructions • Specific to an Application • <?xml version =“1.0”?> • <?processor specific_instruction=“value”?>

  20. DTD Example <!ELEMENT RESTAURANTS (RESTAURANT*)> <!ELEMENT RESTAURANT (NAME,FOOD_RATING,AMBIANCE_RATING,AVERAGE_MEAL_COST,REVIEW)> <!ATTLIST RESTAURANT FOOD_GENRE CDATA #REQUIRED> <!ELEMENT NAME (#PCDATA)> <!ELEMENT FOOD_RATING (#PCDATA)> <!ELEMENT AMBIANCE_RATING (#PCDATA)> <!ELEMENT AVERAGE_MEAL_COST (#PCDATA)> <!ELEMENT REVIEW (#PCDATA)>

  21. Validation • Two categories of XML documents: • Well-formed Documents • it obeys the syntax and the grammar of XML documents. • A document that includes sequences of markup characters that cannot be parsed or are invalid cannot be well-formed. • not well-formed document -- is not XML document. • Checked against XML syntax • well-formed and valid: • well-formed document is valid only if it contains a proper document type declaration and if the document obeys the constraints of that declaration. • Checked against DTD

  22. XML Document Parsing DTD No Yes Yes XML Well- DTD Valid? Document formed? Required? No No Structural XML Non-conformance Syntax Error Message Error Message Stop Processing / Edit XML and/or DTD / Re-initiate Parsing Well-formed XML XML Document Further processing of Well-formed & Valid XML PARSER

  23. XML Processing and Rendering DTD SAX Application Script/Program PARSER DOM XML API XML Document XSL XSL-based Processing layer Other Markup Languages WML Scalable Vector Graphics (SVG) RDF, XMI Etc. RTF (MS Word) PDF HTML Output Output • XML Document/DTD/Parser • Document Object Model (DOM) • Script/Programming (manipulation of objects) • XSL (render ready transformation) • Browser/Display Application • (rendering)

  24. Why XML is so popular? Web Layer Request Data source Response

  25. What use is it? • Standardised Data Communication. • Multiple views of the same data. • Client and server-side processing. • Improved Searching. • Scalability and open standards. • Compressibility. • For defining other mark-up languages

  26. Example Applications #1 • SpeechML • MathML • MathML http://www.w3.org/TR/REC-MathML/ • SMIL • Synchronised Multimedia Integration Language • SMIL http://www.w3.org/TR/REC-smil/ • SAML • Security Assertion Markup Language • WSDL • Web Services Description Languages • Useful Links includes • XML http://www.w3.org/TR/REC-xml/ • XSL http://www.w3.org/TR/WD-xsl/

  27. Example Applications #2 • XML in Server-Side Technology for thin client architecture • Applications Integration

  28. Combining Java and XML Communication Fire Fighter RDBMS Login System Mobilisation tool C&C Operator Search Engine Admin tools System Admin. Reporting tools

  29. Target System Architecture

  30. Next Session… • Introduction to eXtensible Styling Language • Definitions • Examples • Tutorial session • Exercise

More Related